My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
HowtoTranslate  
How to translate Tryton.
Phase-Implementation, Phase-Support, Phase-QA, Featured
Updated Oct 22, 2011 by cedkrier@gmail.com

How to translate Modules

Create the language

  • You must first create the language in "Administration>Localization>Languages" if it doesn't exist.
We follow the RFC 4646 for the code naming but replace - by _ (it is the POSIX Locale). Here is a validator.

Set the language translatable

  • You must check the translatable checkbox of the language to be able to translate it.

Update installed modules

  • You must update the installed modules if you are not working on a new language.

Update report translations

  • You must update the translations records for the reports with the wizard "Administration>Localization>Set Report Translations".

Clean translations

  • You must clean the translations that are no longer needed with the wizard "Administration>Localization>Clean Translations".

Synchronize translations for the language

  • You must synchronize the translations records for the language with the wizard "Administration>Localization>Synchronize Translations".
This may take some time depending on the number of modules you have installed.
  • Now you can translate the terms.
The fuzzy field is checked when the source term have been changed since the last update, so you must verify that the translation is always correct and uncheck the fuzzy field.
Hint:
  • The task can be facilitated by filtering on various fields - module, src, value...
  • For a convenient display of multiline items just click on "Form>Switch View". You simply move between the items using "Form>Next" / "Form>Previous".

Export translations

Manual Export

  • You must now export the translation with the wizard "Administration>Localization>Export Translations" and save the file in the module directory.
    • Select language and module name to export
    • Click on icon "Save as..." and select module's repository
    • The name of the file must be the language code with the extension ".po" (e.g. de_DE.po).
    • You must also declare the filename in the __tryton__.py of the module using the key 'translation' (see for an example in ir module).

Scripted Export

  • You can use the script localize_modules.py that will put translation for each modules in the right place.
Before updating a module or the whole database, changes should be exported, because otherwise your changes can be overwritten with old values from old po file.

Submit translations

How to translate Tryton client

For the client translation we use Babel.

Change directory

  • Change to the tryton client directory.

Prepare po file

  • Extract translation strings into the translation template file:
  • python ./setup.py extract_messages --output-file share/locale/tryton.pot
  • Update the translation file with the generated translation template:
  • python ./setup.py update_catalog -l de_DE -i share/locale/tryton.pot -o share/locale/de_DE/LC_MESSAGES/tryton.po

Edit po file

  • Translate the missing and fuzzy terms in the translation file (share/locale/de_DE/LC_MESSAGES/tryton.po) with your favorite editor (example: poedit).

Generate mo file

python ./setup.py compile_catalog -v --directory share/locale/ --locale de_DE
Hint: if you are using poedit, this is already done automatically

tryton.desktop

  • Create a line for GenericName[de]
  • Create a line for Comment[de]

Create nsh file

  • Copy english.nsh into german.nsh
  • Translate the file

Submit translations

How to translate Documentation

For the documentation translation we use translate-toolkit

Change directory

  • Change to the doc directory of the repository.

Prepare po files

  • For each rst file extract translation strings into translation template file:
txt2po index.rst index.pot -P
  • Update the translation files with the generated translation templates:
pot2po index.pot de_DE/index.po -t de_DE/index.po

Edit po files

  • Translate the missing and fuzzy terms in each translation files (de_DE/index.po) with your favorite editor.

Generate rst files

po2txt de_DE/index.po de_DE/index.rst -t index.rst
Never edit directly the *.rst files

Edit nsh file

  • Copy the file english.nsh into german.nsh
  • Translate the strings
  • Add the new language in setup.nsi and setup-single.nsi under the ;Languages section

Submit translations

  • the files to submit are *.pot, de_DE/*.po, de_DE/*.rst, german.nsh, setup.nsi and setup-single.nsi
  • see HowtoContribute
Comment by giedr...@inovera.lt, Dec 20, 2011

If you have created the new language and you want to see it in the default language list (on new database creation dialog), then you must modify trytond/protocols/dispatcher.py file, and add it to the returned list after elif method == 'list_lang': line.


Sign in to add a comment
Powered by Google Project Hosting