Table of Contents
The basic principles behind GUI translation are the same, irrelevant of whether you are working on GNOME or KDE, or the distribution specific applications. This chapter will deal with the process of GUI translation in a very generic, non application specific manner.
The basic job of the translator is to work on PO or Portable Object files. PO files are nothing but plain text files with key-value pairs for string values. Each translator chooses a POT (PO Template) file for him/herself, and after completing it, he/she submits the file to the concerned mailing list. In the mailing list, another volunteer takes up the file for review, and submits the reviewed file back to the original translator for final checking. Once the final checking is done, the file is integrated with the main application (in the official source tree).
This chapter will describe the basic structure of a PO file, its specialities. Then it will go on to describe the various standards followed by the Ankur with respect to translations (standardized word list, standardized shortcut keys, etc). The final section describes (in brief) KBabel - a special tool that eases certain mundane tasks associated with translation.
Each and every PO has a "header", containing copyright information, charset, package name, etc. An example of a blank header is shown below:
# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "POT-Creation-Date: 2003-05-01 13:15+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n"
The first job of the translator is to fill up the header, as shown below:
# Bengali Translation of ProcMan # Copyright (C) FSF # This file is distributed under the same license as the ProcMan package. # Sayamindu Dasgupta <unmadindu@Softhome.net>, 2003. # msgid "" msgstr "" "Project-Id-Version: GNOME 2.2\n" "POT-Creation-Date: 2003-04-16 04:26+0200\n" "PO-Revision-Date: 2003-04-16 17:20+0530\n" "Last-Translator: Sayamindu Dasgupta <unmadindu@Softhome.net>\n" "Language-Team: Bengali (bn) <gnome-translation@bengalinux.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n"
However, please be very careful while filling up the header, especially while working in the charset and initial descriptive text fields. This can save a lot of subsequent trouble and frustation. Also, remember to remove the line containg "#, fuzzy" from the header.
The actual messages come after the header, in the following format:
#: src/infoview.c:100 msgid "Total : " msgstr ""
The first line (#: src/infoview.c:100) signifies the file and the line number (in the source code) in which the message appears.
The second line (msgid "Total : ") contains the actual message that has to be translated (in this case, it is Total : ).
The third (msgstr "") line contains the placeholder for the translated string.
Thus, in a translated file, the above example would look like:
#: src/infoview.c:100 msgid "Total : " msgstr "মোট :"
However, sadly, all is not as simple as it seems. There are some special cases which need to be handled differently. The next section illustrates some of the more common exceptional cases.
Also called shortcut keys and hotkeys, accelerator keys can cause havoc in the translation, as you need to pay special attention that two GUI items in the same level do not have the same accelerator key.
Accelerator keys are defined in the following way:
#: collection/eog-collection-view-ui.xml.h:14 #: viewer/eog-image-view-ui.xml.h:17 msgid "_view" msgstr "_ansicht"
The above example has been taken from a German PO file. In an actual GUI environment, in the English locale, the accelerator will be "v", that means, the user will have to press Alt+v from his/her keyboard to activate that particular GUI element. In the German locale, however, the user will have to press Alt+ a instead from his/her keyboard for activation of the element.
In Bangla, things further complicated by the conjuncts ( juktakkhar). One cannot assign conjuncts as accelerator keys, for in that case, the user may get confused about which component of the conjunct he/she is going to use as the shortcut.
For example let us consider the Bangla version of the example above:
#: collection/eog-collection-view-ui.xml.h:14 #: viewer/eog-image-view-ui.xml.h:17 msgid "_view" msgstr "দ_র্শন"
In the above example, it is not clear whether the accelerator key is র or whether it is ্ or whether it is শ.
So the alternative is to use the following format:
#: collection/eog-collection-view-ui.xml.h:14 #: viewer/eog-image-view-ui.xml.h:17 msgid "_view" msgstr "দর্শন (_দ)
But this does not solve the entire problem. Consistency and avoiding conflicts is another major issue. For this, Ankur has a standardized list of common GUI terms and their associated shortcuts. The list is available later in this document in the section entitled Standard on Accelerator Keys.
However, in certain cases, you may encounter the Ampersand (&) character instead if the underscore (_). For example:
#: collection/eog-collection-view-ui.xml.h:14 #: viewer/eog-image-view-ui.xml.h:17 msgid "&view" msgstr "&ansicht"
Let us consider a particular line in a C program:
printf ("The current temperature is %d", temp);
When this paricular line of code is executed, the characters within the quotes will get printed on the screen. However the "%d" will get replaced by the value of the variable "temp". So, basically, the "%d" acts like a placeholder.
Apart from "%d", other such possible characters are, %o, %x, %u, %c, %s, %f, %e, %g, %p, etc. Moreover, sometimes, numerals are associated with these characters in the form of "%3d", "%5.1f", etc. "%3d" means that the number printed in that place will be at least 3 characters wide, and "%5.1f" means that the number printed in its place will be at least 5 characters wide and 2 after the decimal point.
So, as you may guess from the above examples, you may often come across messages in the format:
#: src/util.c:194 #, c-format msgid "%d bytes" msgstr ""
That will get translated as:
#: src/util.c:194 #, c-format msgid "%d bytes" msgstr "%d বাইট"
However, pay special attention to the second line in the above example ("#, c-format"). This means that the conversion character should be left as it is.
When there is a "#, no-c-format" in the second line, the character after the % sign should be translated. For example:
#: src/interface.c:306 #, no-c-format msgid "% Memory / Swap Usage History" msgstr "% মেমরি/সোয়্যাপ ব্যবহারের ইতিহাস"
Other characters that should be left alone include:
\n (signifies a newline)
\t (signifies a tab)
\" (signifies a metaquote or escaping a symbol)
Markup tags like <b>, <i>, <span>, etc. (In general, anything between '<' and '>' should be left alone).
Sometimes, the messages are not restricted to just one line. The translations in those cases are also done in multiple lines. For example:
#: src/procactions.c:126 #, c-format msgid "" "Process Name : %s \n" "\n" "You do not have permission to end this process. You can enter the root " "password to gain the necessary permission." msgstr "" "ক্রিয়ার নাম: %s \n" "\n" "এই ক্রিয়ার (প্রসেস-এর) সমাপ্তি ঘটাবার অনুমতি আপনার নেই । চাইলে রুট পাস-ওয়ার্ড দিয়ে " "দরকারি অনুমতিটি জোগাড় করে নিতে পারেন ।"
You must make sure that the number of lines in the msgstr section is exactly equal to the number of lines in the msgid section. Even if the translation ends before the required number of lines are completed, put blank lines ("") to fill up the required quota.
Consider the following example:
#: src/nautilus-file-management-properties.glade.h:31 #, fuzzy msgid "<span weight=\"bold\">Other Previewable Files</span>" msgstr "<span weight=\"bold\">চিত্রের ফাইল</span>"
The "#, fuzzy" in the second line signifies that when the PO file gets converted into a machine readable MO file, the translation of the message following the "#, fuzzy" line will get ignored. This is useful if you are not sure of any translation, or if there is some kind of confusion.