Swathantra Malayalam Computing




A "hands on" translation guide (GNU/Linux Malayalam)

Suresh Valiya Parambil


“A little less conversation, a little more action please”
“All this aggravation ain't satisfactioning me” -Elvis

The requirements to use this guide.

30-45 minutes of your time.
A Malayalam enabled Linux box.
A .po file

.po stands for 'portable object'. These files contain "entries", one entry for each string to be translated. Entries should be separated from each other by a single blank line. A typical entry looks like:

#: main.c:713 memprof.glade.h:34
msgid "MemProf"
msgstr "translate me"

The first line of the entry, which begins "#:” is a list of all the places in the source code that contains the string being translated. There may be several of these lines.

The second line, which begins "msgid", is the English-language string being translated. It may span more than one line.

msgid "MemProf"

The third line, which begins "msgstr", is the translated string. It may span more than one line. Whatever words we have inside the quotes is the ones we need to translate to Malayalam.

msgstr "translate me"

There may be a second line based on the .po file you use, which also begins with "#,” contains "flags". The flags line is not always present. We dont need to worry about this line.

Now you know what .po file is, if you need more info on this check out http://www.gnu.org/manual/gettext/html_chapter/gettext_toc.html
While selecting a .po file, please make sure that you have that executable, so that you can see the translated version.

OK, I am going to use “memprof.po” which is related to “memprof” application. So whenever you see “memprof” replace it with your file name.

Open memprof.po file in an editor, preferably KBabel, as it supports Malayalam. Find a message string which will be visible in first screen, Say if you are using memprof, the locate “help” and place “സഹായം” in “Translated string” window. If you are using gedit it may look like this.

#: memprof.glade.h:58
msgid "_Help"
msgstr "സഹായം"

Save the file, No you need to compile the “memprof.po” file and create a “memprof.mo” file. “mo” stands for machine object. This is the compiled form of .po file or say run-time translation file. Don’t worry, it is very easy.

msgfmt memprof.po -o memprof.mo

Where “msgfmt“is the application which compiles .po to .mo.
-o option specifies the output file name.

OK, you are almost there, now to see your translation, you may

Copy the memprof.mo file to /usr/share/locale/XYZ/LC_MESSAGES/
Where XYZ is ‘ml_IN.UTF-8’ or ‘ml’ or ‘ml_IN’ based on how you enabled Malayalam

OR

Create a symbolic link; it is easy to do this way when you are on a 'hands on' mode.

Change directory to /usr/share/locale/XYZ/LC_MESSAGES/
Where XYZ is ml_IN.UTF-8 or ml or ml_IN based on what you did to enable malayalam

Create a symbolic link as follows

ln -s /ABC/memprof.mo memprof.mo

Where ABC is the absolute path to your .mo file. Let's keep the directory as same as .po files.

Now set the LANGguage and locale

export LANG=ml_IN.UTF-8
export LC_ALL=ml_IN.UTF-8

OK, now start your application, for which you created .mo file.

memprof &

Now you should be able to see your translation, provided that you translated something which is visible in the first screen.

OK, close the application and try few more lines, compile, if you haven’t created the symbolic link, then copy the new mo file to the same location. Open your application again you should be able to see your new translation and so on.

See, it is so easy, I am still wondering why is the Malayalam translation is not complete.

“Come on baby I'm tired of talking”
“Grab your computer and let's start translating “

Leftover: You may encounter 2 more file types while translating, .pot and .gmo files.

".pot" stands for “portable object template “, which means it is a .po file template, if you encounter a .pot file then open it and save it as .po file. That’s it. ".gmo" is same as .mo file, only difference is that ‘g’ denotes that it is a ‘gnome’ mo file.



(C) Swathantra Malayalam Computing & Suresh VP. 

Trademarks are owned by their owners.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License,
Version 1.2 or any later version published by the Free Software Foundation;
A copy of the license is located at www.gnu.org/copyleft/fdl.html, in the section entitled "GNU Free Documentation License".
The information given in this document is believed to be correct, the author will accept no liability for the content of this document.
Use this document at your own risk.

Questions, Comments, Corrections? Email webmaster