A Simple Guide to Use Internationalization Library

Revision as of 08:54, 24 February 2011 by Manus (Talk | contribs)


Overview

This page focuses on very simple/general steps to bring i18n library up in your project.

Steps

  1. Choose and create a directory to put exported translated files (*.mo).
  2. In your project, initialize a {I18N_LOCALE_MANAGER} using the dir created in step 1.
  3. Write normal code that uses {I18N_LOCALE}.translation or {I18N_LOCALE}.plural_translation to get translated texts. {I18N_LOCALE} instances can be queried from {I18N_LOCALE_MANAGER}.
  4. Run po_generation_tool to extract template file (.pot) to be translated.
  5. Copy the .pot file to .po files with the name of the language you need. For example, es_ES.po for Spanish, ko_KR.po for Korean.
  6. Translate .po files using external tools like poEdit for Windows and KBabel or gtranslator for KDE and Gnome.
  7. Export .mo files using the tools above. And copy them into the directory created in step 1.
  8. Run the executable, you get translated strings at run-time.