Difference between revisions of "A Simple Guide to Use Internationalization Library"
(New page: Category:Internationalization == Overview == This page focuses on very simple/general steps to bring i18n library up in your project. == Steps == # Choose and create a directory to p...) |
m |
||
Line 6: | Line 6: | ||
== Steps == | == Steps == | ||
# Choose and create a directory to put exported translated files (*.mo). | # Choose and create a directory to put exported translated files (*.mo). | ||
− | # In your project, initialize a <e>{ | + | # In your project, initialize a <e>{I18N_LOCALE_MANAGER}</e> using the dir created in step 1. |
− | # Write normal code that uses <e>{I18N_LOCALE}.translation</e> or <e>{I18N_LOCALE}.plural_translation</e> to get translated texts. <e>{I18N_LOCALE}</e> instances can be queried from <e>{ | + | # Write normal code that uses <e>{I18N_LOCALE}.translation</e> or <e>{I18N_LOCALE}.plural_translation</e> to get translated texts. <e>{I18N_LOCALE}</e> instances can be queried from <e>{I18N_LOCALE_MANAGER}</e>. |
# Run [[po_generation_tool]] to extract template file (.pot) to be translated. | # Run [[po_generation_tool]] to extract template file (.pot) to be translated. | ||
# 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. | # 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. |
Revision as of 07:54, 24 February 2011
Overview
This page focuses on very simple/general steps to bring i18n library up in your project.
Steps
- Choose and create a directory to put exported translated files (*.mo).
- In your project, initialize a
{I18N_LOCALE_MANAGER}
using the dir created in step 1. - 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}
. - Run po_generation_tool to extract template file (.pot) to be translated.
- 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.
- Translate .po files using external tools like poEdit for Windows and KBabel or gtranslator for KDE and Gnome.
- Export .mo files using the tools above. And copy them into the directory created in step 1.
- Run the executable, you get translated strings at run-time.