Using gettext tools to make translations easier
The PO file format is part of the gettext
i18n and localization system that’s commonly used in Unix-like systems. This system includes tools to ease translation work.
This recipe demonstrates how to use these tools to help translate our add-on modules. We want to use it on a custom module, so the my_hostel
module we created in Chapter 3, Creating Odoo Add-On Modules, is a good candidate. However, feel free to replace it with some other custom module you have at hand, replacing the tutorials’ my_hostel
references as appropriate.
How to do it...
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...