Changes

Jump to: navigation, search

Coding for translation using weblate

826 bytes added, 29 June
no edit summary
In order to be considered for inclusion in the official Gramps release, any piece of code must support internationalization. What this means is that the Python module must support [[Translating Gramps|translations]] into different languages. Gramps provides support to make this as easy as possible for the developer.
 
= Adding a new language =
 
To add a new language, navigate to the "gramps" component in Weblate and click on the '''Tools -> Start new translation''' menu option. Then select a language code. You need to be a Weblate administrator to do this.
 
Then the language code must be added to the [https://github.com/gramps-project/gramps/blob/master/po/LINGUAS LINGUAS] file.
 
An entry must also be made in the <code>_LOCALE_NAMES</code> dictionary in the [https://github.com/gramps-project/gramps/blob/master/gramps/gen/utils/grampslocale.py#L70 grampslocale.py] file.
= How to allow translations =
See [[Addons_Development#Localization|Addons development]] for more details.
 
= Workflow =
 
== Generating the template file ==
 
Strings marked for translation are automatically extracted into a template file called <code>gramps.pot</code>. This is used to update the <code>.po</code> file for each translation.
 
When translated strings are changed the template file should be regenerated with the following:
 
cd po
python update_po.py -p
 
Weblate will then merge each translation file with the new template and notify translators of new strings to translate.
 
== Adding and removing files ==
 
Every python file in Gramps should be listed in either <code>POTFILES.in</code> if it contains translated strings or <code>POTFILES.skip</code> if it doesn't. These files are used when generating the template file.
 
If a file is added or removed from Gramps, these files should be updated accordingly.
 
== Adding a new language ==
 
To add a new language, navigate to the "gramps" component in Weblate and click on the '''Tools -> Start new translation''' menu option. Then select a language code. You need to be a Weblate administrator to do this.
 
Then the language code must be added to the [https://github.com/gramps-project/gramps/blob/master/po/LINGUAS LINGUAS] file.
 
An entry must also be made in the <code>_LOCALE_NAMES</code> dictionary in the [https://github.com/gramps-project/gramps/blob/master/gramps/gen/utils/grampslocale.py#L70 grampslocale.py] file.

Navigation menu