Localization

From den4b Wiki
Revision as of 00:00, 10 August 2014 by Den4b (talk | contribs)
Jump to navigation Jump to search

This article describes localization (translation) of the software into different languages. Please study this material carefully before attempting to contribute.

Note: Previous versions of localization articles are still available for reference, but they should no longer be used: Localization, Localization Old.

Translation files

Translations are stored in PO files (as produced by gettext) are are distributed together with the application, inside Languages folder:

  • Languages\Application.poTemplate file.
  • Languages\Application.ru.poRussian (RU) translation file.
  • Languages\Application.es.poSpanish (ES) translation file.
  • Languages\Application.fr.poFrench (FR) translation file.
  • ...

Template file (Application.po) is used for creating translations for new languages and normally should not be edited.

Translation files (Application.XX.po) contain translated text. A two letter country codes in the file extension to identify a particular language. All possible country codes are defined in ISO 3166-1 alpha-2.

To create a translation file for a new language:

  1. Create a copy of Application.po (template file)
  2. Rename it to Application.XX.po (translation file), where XX is a two-letter country code for the new language.
  3. Edit new translation file using instructions below.

Editing translation file

The process involves translation of individual textual messages to create a mapping from original text to a different language.

Translation files (*.po) should be edited with specifically designed translation tools:

  • Virtaal – preferred editor.
  • Poedit – alternative editor. Its use if discouraged because it changes the formatting of the file and results in large diff's.

Note: Translation files could also be edited manually using a text editor, but this is highly discouraged as tiny mistakes can result in corruption of the entire file.

Loading specific language

Application automatically tries to recognize system language on launch and loads appropriate translation file.

To load a specific language (translation) file, either:

  • Set "LANG" environmental variable to a two-letter language code.
  • Add "--lang XX" command line parameters to the application, where XX is a two-letter language code.