Use gettext tools to ease translations
The PO file format is part of the gettext
internationalization and localization system commonly used in Unix-like systems. This system includes tools to ease the translation work.
This recipe demonstrates how to use these tools to help translate our addon modules. We want to use it on a custom module, so my_module
created in Chapter 3, Creating Odoo Modules is a good candidate. But feel free to replace it with some other custom module you have at hand, replacing the recipe's my_module
references as appropriate.
How to do it...
To manage the translation from the command line, assuming that your Odoo installation is at ~/odoo-work/odoo
, follow these steps:
- Create a compendium of translation terms for the target language, for example, Spanish. If we name our compendium file
odoo_es.po
we should write the following code:$ cd ~/odoo-work/odoo # Use the path to your Odoo installation $ find ./ -name es_ES.po | xargs msgcat --use-first | msgattrib \--translated...