wiki:TranslatingExe

Translating eXe

TableOfContents(2)?

Overview

eXe uses the gettext system for translation, plus a few custom scripts for translating the contents of the XML files. The translation life cycle looks something like this:

  1. Get translations in from pootle and emailed .po files
  2. Run mki18n.py script to extract the english strings
  3. Upload new .po files to pootle and email out to translators.

Pootle Server

eXe Translations are done using our pootle server. We prefer the translations to be done online, so that multiple translators can work on the same translation at the same time. The pootle server is located at:

http://pootle.exelearning.org/

Developer Maintanance of .po files

Extracting English Strings

One part of the translation process is extracting English strings from the source code into the .po files. We have written a script that does this for us and even compiles all the .mo files. It is located in the source tree under tools/mki18n.py. This script only runs under Linux at present and the gettext tools must be installed.

mki18n.py outputs some error messages which must be fixed up in the .po files so it's best to run it inside some sort of IDE like vim that can show you where the problem lines are. So here's how I run it:

cd ~/projects/exe
gvim
:set makeprg=python\ tools/mki18n.py
:make

Once it's done, vim will take you to the first error. :cc to see the error message :cn to go to the next error. Basic vim editing commands can be found in the vim tutorial that comes with the program.

Most of the error messages generated are to do with line endings being different between the English string and the translated string, others are to do with non utf-8 characters being used in the .po files. So if one of the string pairs ends in \n or \r, change the translation string to match, never change the English string. Other errors include %s missing in the translations, here it's hard to fix without knowing something of the language; I just guess, for example in the Slovenian language: "Show %s image" came up as "Välj bild". In this case I'm just being presumptuous and putting the %s at the end, the only other way is to contact the translator, which can take days.

Also it is important to scan through the whole output of mki18n.py because some errors are not associated with a certain line and therefore not shown in vim.

For Translators

Getting Started

Getting started on Pootle is a 3 step process:

  1. Registration - Click the registration link on the right of the screen and fill in your details
  2. Activation - The Pootle site will send you an activation code by email, and navigate the site to the Activation page (You can get there yourself by clicking the "Activation" link in the home page.
  3. Log in - Once activated you can log in to the site and have access to suggest new translations of strings.

More Power!

Default users only have the access power to suggest new strings. If you want power to work on a certain translation or two, please email the exe-team [email protected]… .

Translating

Play around with the interface. Admittedly it's not very intuitive. Here's some quick hints to get you oriented:

  1. Pootle likes to do things in batches. eg. If you click Quick Translate, you'll get all the untranslated and fuzzy strings, after you finish a string and click Skip, Submit or Suggest, you'll be taken along to the next string.
  2. You can change the size of the translate box by clicking Grow, Shrink (for height) and Broaden, Narrow (for width). You can set permanent option by clicking "home" (on the right side of the screen in the box), then "Change Options", and filling out that form. Also while you're in this form, choose the exe project and you language, that way whenever you log in you'll get a quick link to where you do your work.

Please feel free to fix up this wiki from your own experience, or email me if you think something needs changing/adding but you don't want to do it your self. [email protected]

Below is the old way of doing things (before the Pootle server came along). I just left it here because it might be useful for people from other projects or something.

Translating a PO File (Old Way)

To make a translation of exe, you need to get a .po file. Email [email protected]… and he'll send you one for the language that you are translating.

To do the translation, load the .po file into the poedit program. See below for how it works:

attachment:poedit.png

Area A is the list of "strings"/phrases in the program that need to be or are translated. If they are blue, they have no translation. Area B is the english version of the currently selected string. Area C is where one types in the maori version of the string.

Some strings might not make sense as in the program you are looking at them out of context. For example there is a string that is just the letter O. This is the Ctrl+O shortcut for open file. You can get a little bit more information on each string by right clicking on it in area A. All this will do is show a little bit of the source code context where the string originated from.

If you have any queries please give me an email ( [email protected]… ). Also once you've finished the file, please send it to me.

Please bear in mind that as the program progresses, the strings used in the program change. So usually about a week before the release we'll send po files out to the translators and try not to change any strings during that week. If we do end up having to change some, you might get a po file on the day of the release or something like that (hopefully not), if you don't have time to change it on that day, it won't matter that much because it'll probably be a single string, that no one will ever see anyway.

To test out your translation as you are making it, simple save in poedit, this will create a .mo file (.mo's are just compiled (computer language) versions of .po's). Copy this file into the appropriate exe locale subdirectory. The directory name depends on the short name of your language. For example on windows if your po file is called exe_es.po (es is for spanish), you'll need to create this directory:

C:\Program Files\exe\locale\es\LC_MESSAGES

and copy the .mo file to C:\Program Files\exe\locale\es\LC_MESSAGES\exe.mo (notice that the _es has been dropped).

Another example so you can get the idea:

For the Italian translation on red hat linux the exe_it.mo file must be copied to: /usr/share/exe/locale/it/LC_MESSAGES/exe.mo

And Finally on Ubuntu Linux things are different because it appears all .mo files must be put in a shared public directory (it may be the same on Debian linux) so our Chinese translation is copied from exe_zh.mo to /usr/share/locale/zh/LC_MESSAGES/exe.mo.

Many thanks for your contributions to the project. Drop me an email if you have any questions [email protected]… .

Timetable

On the 10th of each month, there is a release so on the 5th of the month, we'll send out links to the pofiles and reminders to all translators, the po files must be emailed back by the 9th of the month to make it into that release.

Technical Stuff

For [:I18n:internationalization] we use the Gnu GetText Library.

Languages are described using the ISO 639 two letter language codes (e.g. es=Spanish, zh=Chinese). This may be followed by a ISO 3166 two letter country code in the case of country specific locales (e.g. fr_CA=Canadian French).

The file can be edited with any editor which supports UTF8, but we recommend POEdit which is specifically for editing these files.

Installing a MO File

From a translated PO file we can then generated a compiled file (MO file) which can be used in eXe. e.g.

c:\Program Files\exe\locale\es\LC_MESSAGES\exe.mo
c:\Program Files\exe\locale\de\LC_MESSAGES\exe.mo}}}
Note "Program Files" may be known by a localized name in a localized version of Windows.

The user chooses which MO file to use via the preferences dialog in Tools | Preferences.  The "X-Poedit-Language" attribute is used to describe the translation in the local language.
Last modified 10 years ago Last modified on 2009-05-22T06:12:54+09:00

Attachments (1)

Download all attachments as: .zip