support Click to see our new support page.

Odoo 12 Translation Using PO Templates

blog_177_img
Author

IjasNov. 13, 2019

PO Templates In Odoo 12 translation

POT Files

Odoo 12 have advanced translation tools. POT files are the template files for PO files. The full form of POT is Portable Object Template. They will have all the translation strings left empty. A POT file is essentially an empty PO file without the translations, with just the original strings. You should edit it with a PO editor such as POEdit, or your preferred text editor.

This is how a .pot file looks like :

po templates code

 

Let us see how a .pot file is generated :

First you need is to activate developer mode ,

Go to

settings -> translation -> export translation

Here do not specify any language and set the file format to PO files and also select apps to export, then click the export button.

 PO export language -odoo

 

Then a POT file for the specified app will be generated.

po template-odoo 12 translation

If we did not specify any apps, then a pot file for all the base modules will be generated.

 po tempalte file-odoo 12 translation

PO Files

PO files are the files which contain the actual translations. The full form of PO is Portable Object .Each language will have its own PO file, for example, for French there would be a fr.po file, for German there would be a de.po, for American English there might be en-US.po. You can even use po files to customize the displayed text without changing the code, by for example, creating an adapted file such as en-my_company.po.

The core of each PO file is very simple. It is form of simply pairs of the source text. That is, which is present in the code. And target text, the text which is to be in the translation. For example, in the French PO file you might have a translation of a string as follows:

msgid "Hello world"
msgstr "Bonjour le monde"

The msgid contains the text actually in the code. Whereas, the msgstr contains the text into which it is to be translate. If there is no translation given in the msgstr, then the default msgid string will be display.

 

Odoo 12 Translation

PO files are simply text files and can thus be edit by any text editor.

Go to

settings -> translation -> export translation

po files-odoo 12 translation

Then select the language for which you want to create PO file and select the file format as .PO, select the applications you want to translate then click the export button.

po files in odoo

Then we will get a screen like this,

po file screen-odoo 12 translation

This page contains the link to download the generated PO file. Download the PO file. Copy the downloaded file and paste it inside the module in ‘i18n’ folder.

This is how a PO file looks like:

po files odoo

 

Odoo implementation in Kerala

LinkedIn LinkedIn