How to do it...

To manage translations from the command line, assuming that your Odoo installation is at ~/odoo-work/odoo, follow these steps:

  1. 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
  1. 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
  1. 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
  1. 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
  1. To take a peek at the untranslated terms in a PO file, use this:
    $ msgattrib --untranslated ./addons/my_module/i18n/es_ES.po
  1. Use your favorite editor to complete the translation.
..................Content has been hidden....................

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