How it works...

Step 1 uses commands from the gettext toolbox to create a translation compendium for the chosen language—Spanish, in our case. It works by finding all the es_ES.po files in the Odoo code base, and passing them to the msgcat command. We use the --use-first flag to avoid conflicting translations (there are a few in the Odoo code base). The result is passed to the msgattrib filter. We use the --translated option to filter out the untranslated entries and the --no-fuzzy option to remove fuzzy translations. We then save the result in odoo_es.po.

Step 2 of the preceding section calls odoo.py with the --i18n-export option. You need to specify a database on the command line, even if one is specified in the configuration file and the --modules option, with a comma-separated list of modules to export the translation.

In the gettext world, fuzzy translations are those created automatically by the msgmerge command (or other tools) using a proximity match on the source string. We want to avoid these in the compendium.

Step 3 creates a new translation file by using existing translated values found in the compendium. The msgmerge command is used with the --compendium option to find the msgid lines in the compendium files, matching those in the translation template file generated in step 2. The result is saved in the es_ES.po file.

If you have a preexisting .po file for your add-on with translations you would like to preserve, you should rename it and replace the /dev/null argument with this file. The renaming procedure is required to avoid using the same file for input and output.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset