To manage translations 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 --no-fuzzy -o ./odoo_es.po
- Export the translation template file for the add-on module from the Odoo command-line interface and place it in the module's expected location:
$ ./odoo-bin -d mydb --i18n-export=my_module.po --modules=my_module $ mv my_module.po ./addons/my_module/i18n/my_module.pot
- If no translation file is available yet for the target language, create the PO translation file, reusing the terms that have been already found and translated in the compendium:
$ msgmerge --compendium ./odoo_es.po -o
./addons/my_module/i18n/es_ES.po
/dev/null ./addons/my_module/i18n/my_module.pot
- If a translation file exists, add the translations that can be found in the compendium:
$ mv ./addons/my_module/i18n/es_ES.po /tmp/my_module_es_old.po $ msgmerge --compendium ./odoo_es.po -o./addons/my_module/i18n/es_ES.po
/tmp/my_module_es_old.po ./addons/my_module/i18n/my_module.pot
$ rm /tmp/my_module_es_old.po
- To take a peek at the untranslated terms in a PO file, use this:
$ msgattrib --untranslated ./addons/my_module/i18n/es_ES.po
- Use your favorite editor to complete the translation.