Usually program messages and documentation are written in English. Using a framework made from a set of tools and libraries it is posible to have your favorite applications speaking your native non-English language. This process of adapting an application to a specific language is known as localization. The localization process includes translating the program's interfaces and documentation to the various languages users need and, in some countries or regions, making the inputs and outputs conform to particular conventions. KBabel is a tool which will assist you in the internationalization process to make an application's interface speak many languages.
Every internationalization-aware program makes available for translation one or more message-catalog files. The extension of these files is .pot. POT is an acronym for “Portable Object Template”.
Every translator takes a POT file copy and begins translating messages. That, this file will became a PO file - Portable Object and represents only one language.
Each translator takes a copy of one of these POT templates and begins filling in the blanks: each message is translated into the language desired. The file containing the translated text is referred to as a PO (Portable Object) file.
Once all the messages have been translated the PO file is compiled into a machine-readable binary format, known as a MO (Machine Object) file. These files, which will be stored with a .mo extension, act as a database to minimize the time taken by the applications to look up each translated message.
There is a question in the air: do I need to know what is inside a PO file even though I have KBabel? The answer is, undoubtfully, yes. There are situations when a message catalog can become corrupt and needs to be manually fixed. Most of these problems are the so-hated CVS conflicts which occur when a translating process is coordinated by a concurent version system (see the CVS documentation). KBabel can't help you very much if a problem like this arises so a text editor some knowledge of PO-files is needed. Let's see how a PO file is made.
PO files consist of pairs of messages—a msgid and a msgstr. The msgid is the text in English and the msgstr is the text translated into the appropriate language. The text that accompanies each msgid and msgstr is enclosed within C-like double quotes. An example, taken from a PO file for Noatun, is msgid "Open a Playlist"
Empty lines and those starting with # are ignored. Lines starting with a # represent comments and are a useful means of providing a note detailing which file this message is going to be used in and, in the case of the application writers, to provide additional comments to aide translation. KBabel displays these comment lines for every message.
In many cases the first msgid-msgstr pair in PO file is a fake entry (acting as PO file header) that contains various information about the translated PO file, such as the application name, translating date, translator name and so on.
Recent versions of GNU gettext added another usefull i18n feature called plural forms. English uses only singular and one plural form of nouns, e.g. “1 file ” and “10 files”. This leads many developers to an idea that world is that simple and they can use messages like “Do you want to delete %1 file(s)?”, where %1 denotes a number of files to be deleted. But this is fundamentally wrong. For Slovak translation you need 3 different forms of the message. This number is different for different languages and even if it is the same, e.g. Czech uses 3 forms as well, a rule to decide which form to use can be very different.
Plural forms in PO files are here to help. Unfortunately, KDE developers do not like the plural forms implementation in GNU gettext and they introduces their own format and handling for them.