Difference between revisions of "Localization"
(→Create new translations: X-Language-Name for conflicting situations) |
(Translators linked) |
||
Line 1: | Line 1: | ||
− | This article describes localization (translation) of applications into different languages. Please study this material carefully before attempting to contribute. | + | This article describes localization (translation) of applications into different languages. Please study this material carefully before attempting to contribute. List of contributors is available in the [[Translators]] article. |
− | Products which currently support this new method | + | Products which currently support this new method of localization: |
* [[ReNamer]] | * [[ReNamer]] | ||
* (more will be added soon) | * (more will be added soon) |
Revision as of 14:05, 7 November 2014
This article describes localization (translation) of applications into different languages. Please study this material carefully before attempting to contribute. List of contributors is available in the Translators article.
Products which currently support this new method of localization:
- ReNamer
- (more will be added soon)
Note: Previous versions of localization articles are available for reference, but they should no longer be used: Localization Old 2013, Localization Old 2014.
Translation files
Translations are stored in PO files (as produced by gettext) are are distributed together with the application, inside Languages folder:
- Languages\Application.po – Template file.
- Languages\Application.ru.po – Russian (RU) translation file.
- Languages\Application.es.po – Spanish (ES) translation file.
- Languages\Application.fr.po – French (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 language code in the file extension identifies a particular language.
Create new translations
To create a translation file for a new language:
- Create a copy of Application.po (template file)
- Rename it to Application.XX.po (translation file), where XX is a two-letter language code.
- Translate entries to the new langauge using instructions below.
- Populate PO file headers, copy from any other translation file and modify appropriately.
Example of relevant entries in PO file headers for a new translation file:
msgid "" msgstr "" ... "Language: ru\n" "X-Country: ru\n" "X-Country-Name: Russia\n" "X-Language-Name: Russian\n" "X-Language-Name-Native: Русский\n" "X-Translators: Your Name\n" ...
- Language codes are defined in ISO 639-1
- Country codes are defined in ISO 3166-1 alpha-2.
- In conflicting and ambiguous situations:
- Name the translation file using Application.XX_YY.po format, where XX is a language code and YY is a country code.
- Set X-Language-Name header to highlight the difference between translations.
- For example: "en_US" code for English (United States), "en_GB" code for English (United Kingdom).
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:
- Poedit – Editor for Windows, Linux and Mac.
- Virtaal – Editor for Windows, Linux and Mac.
- Better PO Editor - Editor for Windows only.
Notes for advanced users:
- 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.
- Poedit forcefully wraps long entries causing "noise" in diffs, so PO files need to be cleaned via
msgcat --no-wrap
before committing. [1].
Guidelines for translators
Guidelines for translators:
- Try not the exceed the length of the translated text, comparing to the length of the original text.
- Some components may not fit longer text, so it is better to make it shorter rather than longer.
- Beware of the special formatting, symbols and placeholders, e.g. "\n", "%s", "%d".
- Make sure to maintain such formatting, translate only actual words.
- If you don't have a good translation for some text, just leave those blank.
- Other people may be able to fill in the blanks later.
Attribution to the translator:
- Add your name to "X-Translators:" field in PO file headers.
- Please keep names of other translators (separate multiple names with a comma).
Loading specific language
All available language files are automatically added to the "Languages" menu on startup. Select a desired language and restart the application.
When selected language is set to "Autodetect" mode:
- Application automatically tries to recognize system language and loads appropriate translation file.
- It is also possible to load a specific language file, by either:
- Adding "--lang XX" command line parameters to the application, where XX is a two-letter language code.
- Setting "LANG" environmental variable to a two-letter language code.
Publishing your translation
Please send new and updated translation files via email, as attachments.
The email address can be found in the About dialog of every application.