Step by Step: The Translation of POTs and POs

General material on the subject can be found in the Info pages for the Gettext package. For a basic understanding of what is expected in KDE translation it follows a description of how the handling of POTs and POs looked like before it was done with specialized programs like Lokalize:

  • If there is no translation for a given program (i.e. there are no PO files with the same name in the appropriate folder "l10n-kde4/$LANGUAGE/messages/package-name/") — and only if this is the case! — then a POT file is loaded into an text editor and saved with the ".po" ending in the folder where it was missing. This results in a file with a name like "l10n-kde4/$LANGUAGE/messages/package-name/program-name.po". For instance: if you are sure that Kate was not translated to your language yet, you load the recent l10n-kde4/templates/messages/kdebase/kate.pot and save it as l10n-kde4/$LANGUAGE/messages/kdebase/kate.po . Then you can start translating.

    From now on you do all your work for the given program with the PO file. Most of the work consists of updating, improving, and unifying earlier translations (i.e. POs which are already there).

  • After you have filled out (or updated) the header (who, when, etc. as well as deleting the first "fuzzy" tag, see below) you fill in the empty strings with new translations. In POs that were already translated at an earlier time you check the "fuzzy" translations and correct them if necessary. Either way, remove the "fuzzy" tag at the beginning of the line after you finished working on it.

Nowadays, most of these steps are done automatically by specialized programs like Lokalize — from choosing the POT files and saving them as POs, through header updates and removing fuzzy entries to syntax checks.

A sample header could look like this:

msgid ""
msgstr ""
"Project-Id-Version: Some Program\n"
"POT-Creation-Date: 2009-08-23 02:43+0200\n"
"PO-Revision-Date: 2009-08-28 12:25+0200\n"
"Last-Translator: Somebody <>\n"
"Language-Team: Some Language <>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Lokalize 1.0\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"

If you are working with a text editor do not remove the initial "msgid / msgstr". Otherwise, the compilation will terminate with a parse error. On the other hand, you should remove the "fuzzy" which is initially there.

The entries for Content-Type and the Transfer-Encoding are not relevant at the moment. But the charset should be set to UTF-8 in this case, i.e. 8bit Unicode Transfer Format.

The actual translation would look as follows. The original line:

#: kedit.cpp:90 kedit.cpp:1071
msgid "Show &Status Bar"
msgstr "" would translate like this (assuming you were translating it to German):

#: kedit.cpp:90 kedit.cpp:1071
msgid "Show &Status Bar"
msgstr "&Statusleiste anzeigen"

And from the incorrect:

#: ReniceDlg.cpp:31
#, fuzzy
msgid "Renice Process"
msgstr "Laufende Prozesse" would produce the correct translation:

#: ReniceDlg.cpp:31 
msgid "Renice Process"
msgstr "Neue Prozesspriorität"

After the corrections have been done you need to delete the "fuzzy" tag. Otherwise, the corrected string will just be ignored during compilation.

Finally there might be lines at the end of the file beginning with "#~" like this:

#~ msgid "Where do you want to go tomorrow?"
#~ msgstr "Where do you want to go tomorrow?"
#~ msgid "No comment available"
#~ msgstr "Keine Erklärung verfügbar"

These lines have been commented out, but may be used later on to translate messages should they reappear in program. If you want you can delete them from time to time in the interest of disk space and bandwidth. Lokalize, for instance, does not do this automatically.

For any other questions on this topic you are once more advised to look at the Info pages for the GNU gettext package (see the KDE on-line help).