First thing you have to think about when creating anything, is your audience. Usually people, who will look and try to comprehend your work. And when we are talking about computer stuff, bigger part of comprehension is made through text. And the best way is to speak your audience’s native language. And I would like to describe one approach to managing translations. One translation is usually pair of two sentences, or some kind of ID and sentence. They are usually stored in huge pile of translation files and is difficult to maintain them.
Main part of Linux (lets say open source) world found its way for managing translations. Current holy grail is named Gettext and is used not only in operating systems. You can manage translations with Gettext also in e.g. Gimp (even in a small plugins like my selection tool Laso) or WordPress.
Practical way to .mo and .po
These files are also called gettext catalogs.
.mo – a binary file (for computers) containing translations
.po – a text file (for humans) containing translations
You usually care only about .po files. Conversion between .po and .mo file is possible in both directions.
msgid “Native language”
msgstr “La langue maternelle”
msgid “Translation files .mo and .po”
msgstr “Les fichiers de traduction .mo et. .po”
msgid “How to create translation”
msgstr “Comment créer traduction”
Example of .po file and corresponding .mo translation file.
Main steps to translation files
- Create stuff (e.g. program) that needs translation
- Generate .po file from source codes
- Mark all strings for translation by defined function (usually _() )
- Use directly Gettext, or easier program PoEdit (wizard from menu File > New catalog)
- Generate .mo file from .po file
- Visit online converter http://tools.konstruktors.com/
- Upload .po file to second section
- Download created .mo translation file
- Spread your translations
I hope this little howto for translation files could be useful. Broader explanation could be found in manual files for Gettext, or PoEdit.
Detailed introduction (and one of the best) is located at http://flossvalley.blogspot.cz/2008/07/quick-and-dirty-guide-to-poedit.html.