Using i18n and poedit

by Anders Persson (modified: 2014 Jul 24)

This is working at Windows 8.0

Download poedit from http://www.poedit.net/

I have not described how to create a new translation file since that is described in the poedit documentation.

Update your code to us Eiffels i18n library explained at: https://dev.eiffel.com/Internationalization/User_guide

I have done according to this:

When I want to show a string to the user I add the following local variable:

locale_manager : I18N_LOCALE_MANAGER

Then I create the locale manager.

create locale_manager.make ("locales")

Whern I then need a string in the code I use for example:

locale_manager.system_locale.translation ("Text to translate to other languages")

Add a folder "locales" to your Eiffel project

Then the Eiffel code is prepered to support i18n translations.

Next step is to configure poedit to find the eiffel files:

Open poedit and select "File->Settings". Then the tab Parsers. Create a "New" parser and name it "Eiffel"

List of extensions "*.e"

Parser command:

Your_Eiffel_installation\tools\spec\win64\bin\po_generation_tool -o %o -D Path_to_source_code

In my installation I have hard coded the paths. I have not been able to use relative paths. If one have several projects one probably need to update when working with the translations.

LIn key word list I just wrote the same as was recommended for pyhton http://wiki.wxpython.org/poEdit. I do not know the purpose of it.

-k%k

http://www.eiffelroom.org/files/poedit%20settings.JPG

To make the update process easy then use the catalouge manager.

Close the settings and open the catalouge manager.

Add a new project and add the path to the locales folder in your Eiffel project.

Click ok and then you can use the "Update All" to update your translation files.

If any strings are added or changed it will be seen for each translation. Double click at the language to update the translation for that language.

http://www.eiffelroom.org/files/poedit%20calalouges.JPG