Sunday, June 20, 2010

Urdu translation of Drupal

We have recently migrated the Urdu translation project to Drupal's localization server. If you want to help us with the translation, come along and join us at localize.drupal.org.
Click on this link for Urdu translation.

Saturday, June 19, 2010

Google Urdu translation (Alpha)

In case you haven't read or heard the news yet, Google has added Urdu language among the languages supported by Google Translate. Right now, this support is in Alpha stage and needs a lot of improvement. If you want to make it better, read this article on how you can help:
http://www.urdujahan.com/blog/computer-technology/2010/teach-urdu-to-google/

Friday, June 18, 2010

Reading Urdu text (installing Urdu fonts) in GNU/Linux

A lot of times, when I tell my Linux user friends about a great website in Urdu, or just type Urdu text in the instant messages, they tell me that they have trouble reading the text. This mostly happens because they don't have (Unicode) Urdu fonts installed. And unfortunately many of them don't know, or don't remember, how to install fonts in GNU/Linux so I have to tell them every time. Therefore, I decided to write a detailed guide where to point them when this happens again. And obviously, it needed to be written in English so that they could read.

Basically there are just three steps. Download a font, copy to a certain directory and update the font information cache to speed up loading. However, this guide will seem way too lengthy for such a simple task because of the additional information for new GNU/Linux users.

So let's begin.

First of all, check your package manager. Some Urdu fonts are available directly from your Linux distribution's software repository. Just open the package manager, search for packages containing "Urdu" and you are sure to find at least Nafees Web Naskh and PakType fonts. Install them from here if you like.

Now we proceed to manual installation of the fonts that you do not find in the package manager.

Here are some links to download some of the most popular Urdu fonts.

Fonts from CRULP (Nafees Nastaleeq, Nafees Naskh, etc.)

BBC's Urdu Naskh Asiatype font

Dozens of other fonts from UrduWeb's download section

Once you have downloaded some fonts, the next step is to install them. The fonts you download will mostly be in True Type Font (TTF) or Open Type Font (OTF) format. Some of them will be compressed as a ZIP, RAR or Gzipped TAR archive. Just extract them to get the TTF or OTF files.
Now copy these TTF or OTF files to either /usr/share/fonts or /home/yourusername/.fonts directory.

Copying to .fonts (notice the dot) in a user's home directory (eg; /home/saad/.fonts) will install the fonts only for that user account. Files starting with a dot (.) are hidden in GNU/Linux by default. To show them in your file manager, select View -> Show Hidden Files (Shortcut: Ctrl+H). If there is no .fonts directory already present, just make one and copy the (uncompressed) fonts there. Now that was simple! Wasn't it?

For a system-wide installation (for all users), fonts are copied to /usr/share/fonts. This requires root (the administrator user in Linux) privileges because normal users do not have permission to write to system directories. There are a number of ways to do this.

For example, if you don't like the command line, you can run your GUI based file manager as root (administrator) user.
In case of GNOME Desktop Environment, run this command: gksu nautilus
In case of KDE: kdesu dolphin
In case of Xfce: gksu thunar
(The commands gksu and kdesu are used to run a GUI based application as root)
Copy the fonts to /usr/share/fonts. Make a subdirectory especially for Urdu fonts if you like. And make sure that all users have permission to read them (by right clicking the files and opening properties->permissions).

If you are having trouble this way, then there's always the command line. :)

Open the terminal. And to make it easier, place all the TTF files in one directory.
First change directory to where you have these font files. For example:
cd /home/username/Downloads/Fonts
Then get "superpowers" by becoming root so that you have permission to copy the fonts to /usr/share/fonts (See the "sudo method" below if this one doesn't work for you). You will be asked for the root password.
su
If you like, make a subdirectory /usr/share/fonts/urdu to manage the fonts easily:
mkdir /usr/share/fonts/urdu
Now copy all the files ending with .ttf to /usr/share/fonts/urdu:
cp *.ttf /usr/share/fonts/urdu
Make sure that the installed fonts are readable by all users:
chmod a+r /usr/share/fonts/urdu/*
but not executable (for security reasons):
chmod a-x /usr/share/fonts/urdu/*
When you are done with your superpowers, exit root user and return to normal mode:
exit

In some Linux distributions (like Debian and Ubuntu), with the default configuration, you cannot become root with the su command. There you will need to add sudo before every command you want to run as root. For example, in this case:
sudo mkdir /usr/share/fonts/urdu
sudo cp *.ttf /usr/share/fonts/urdu
sudo chmod a+r /usr/share/fonts/urdu/*
sudo chmod a-x /usr/share/fonts/urdu/*
In this case you don't need to exit. As soon as you are done with a command, you will return to being a normal user without superpowers.

After copying the fonts, run the fc-cache command to update the font information cache. This cache is used to speed up startup of applications that use the fontconfig library.

That's it! Your fonts are installed and ready to use. Any running applications will need to be restarted to take effect.

Hello World!

Greetings Earth creatures!
Welcome to my boring blog.
Here you will find all the boring stuff I like, some of which includes Physics, Free and Open Source Software, Python programming language and HowTo's and tricks about using Urdu language in GNU/Linux (if I was generous enough to post something :P).