Translate texts through the web client user interface

The simplest way to translate is to use the translation feature provided by the web client. These translation strings are stored in the database and can later be exported to a .po file, either to be included in an addon module or just to later be imported back manually.

Text fields can have translatable content, meaning that their value will depend on the current user's language. We will also see how to set the language-dependent values on these fields.

Getting ready

We need to have the Developer Mode activated. If it's not, activate it in the Odoo About dialog.

How to do it...

We will demonstrate how to use translate terms through the web client using the User Groups feature as an example:

  1. Navigate to the screen to translate. Select the Settings top menu and then open Users | Groups to open the corresponding view.
  2. On the top menu bar, click on the Debug menu icon and select the Technical Translation option:
    How to do it...
  3. A list of the available translation terms for that view will be shown. Edit Translation Value in a line to change (or add) its translation text. If looking for a particular source string, use the list filters to narrow down the displayed texts:
    How to do it...

    The Group name is a translatable field. Let's translate a record's value to the several languages installed:

  4. Navigate again to the User Groups menu option, open one of the group records in the form view, and click on Edit:
    How to do it...
  5. Note that the Name field has a special icon at the far right. This indicates that it is a translatable field. Clicking on the icon opens a Translate list with the different installed languages, allowing us to set the translation for each of those languages.

How it works...

Translated terms are stored in the database table for the model ir.translation. The Technical Translation option in the Debug menu provides a quick access to those terms, in context with the currently selected view.

Similarly, the model fields with translatable content feature an icon to access the list of the installed languages and to set the appropriate value for each language.

Alternatively, the translation terms can be accessed from the Settings top menu, using the Translations | Application Terms | Translated Terms menu option. Here we can see all the terms available for our instance, but should need to use data filters to locate the terms we might be interested in.

There's more...

Alongside the Translated Terms menu option, we also find the Synchronize Terms option. Selecting it will display a dialog window to provide the desired language, and will then launch the process to extract translatable strings from the installed addon modules and add any new ones to the Translated Terms table. It is equivalent to performing the Export Translation followed by the Import Translation steps described earlier.

This can be useful after changing some models or views, to have the new strings added so that we can translate them.

It can also be used to populate the strings from the en_US default language. We can then make use of the translation terms to replace the original English texts with new ones, better for the end user's specific business vocabulary.

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

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