Enable Dark Mode!
configure-translation-to-custom-module-add-new-language-in-odoo-16.jpg
By: Archana V

Configure Translation to Custom Module & Add new language in Odoo 16

Technical

In Odoo, translations must be done according to each user's language. In some cases, we need to translate fields, labels, and strings depending on the user's language.

In this blog, we will discuss how to add language translation to a custom module in Odoo 16 and how to add a new language in Odoo.

Settings>Translation>Languages

configure-translation-to-custom-module-add-new-language-in-odoo-16-1

Here, we have many languages. First, we need to enable a new language other than English. Here I am activating the Arabic(Syria)language.

configure-translation-to-custom-module-add-new-language-in-odoo-16-2

And then, we have to export the translation for our custom module.

configure-translation-to-custom-module-add-new-language-in-odoo-16-3

Clicking on the export translation menu, we have a pop-up window.

configure-translation-to-custom-module-add-new-language-in-odoo-16-4

First, we can select the language, and the file format is po file, and then we have to add our custom module. Here we have a custom module,“Estate”.

configure-translation-to-custom-module-add-new-language-in-odoo-16-5

After completing all fields in the export settings, we can click on the button Export.

configure-translation-to-custom-module-add-new-language-in-odoo-16-6

Here we can save the PO file in our local, and then we can just copy the downloaded PO file into the pycharm custom addons. We need to create a new directory inside the custom add-ons folder and add the downloaded PO file to the directory.

configure-translation-to-custom-module-add-new-language-in-odoo-16-7

Inside the downloaded PO file, we can do the required translations for each entity here.

#.module:estate
#:model:ir.ui.menu,name:estate.estate_first_level_menu
msgid "Advertisement"
msgstr ""
#.module:estate
#:model:ir.model.fields,field_description:estate.field_estate_property__bedrooms
msgid "Bedrooms"
msgstr ""
#.module:estate
#:model_terms:ir.ui.view,arch_db:estate.estate_property_view_tree
msgid "Channel"
msgstr ""

The msg_id will be the English version of the translated version corresponding to the specific language. You can choose here, and we can also manually add the corresponding translated words. Because this is a custom module, here I just translated the above.

configure-translation-to-custom-module-add-new-language-in-odoo-16-8

Here you can see the menu Advertisement is converted into the corresponding Arabic version, and also the field Bedrooms is converted into the corresponding Arabic version. Then upgraded the custom module, but we can't see any changes because the current language for the administrator is English.

configure-translation-to-custom-module-add-new-language-in-odoo-16-9

So we need to change it to Arabic.

configure-translation-to-custom-module-add-new-language-in-odoo-16-10

Then we can open our module where we can see the field bedrooms and the menu advertisement is changed to the corresponding Arabic name.

configure-translation-to-custom-module-add-new-language-in-odoo-16-11

Import Translations In Odoo 16

Navigating to Settings > Import/Export > Import Translation will bring up the import translation wizard, where you can import the translations.

configure-translation-to-custom-module-add-new-language-in-odoo-16-12-cybrosys

By clicking on the import translations menu, it will open up a wizard, as shown below,

configure-translation-to-custom-module-add-new-language-in-odoo-16-13-cybrosys

Add a language name, add a language code, and upload the PO/translation file that will be imported, which are all selectable in the translation wizard. The file types that are supported are.csv,.po, and.pot.

We can choose to overrule phrases that have already been translated by using the "Override Existing Terms'' button. The PO file is also editable, downloadable, and deletable. When finished, import the translations into Odoo by clicking the "Import" button.

Seeing The Translated Text

You can click on the translation icon that is shown in the Odoo field to view the translated content there. I'm thinking of a sample of Odoo merchandise.

configure-translation-to-custom-module-add-new-language-in-odoo-16-14-cybrosys

You can see the translated product name and view all other installed translations in the popup.

configure-translation-to-custom-module-add-new-language-in-odoo-16-15-cybrosys

This is how we can define translations in Odoo 16. Then we can see How To Add New Languages To Odoo 16.

To Include A New Language to Languages 

To include a new language to languages in Odoo, we have to create a.csv file named ‘res.lang.csv’ under the data directory.

The res.lang.csv file contains the following.

"id","name","code","iso_code","direction","grouping","decimal_point","thousands_sep","date_format","time_format","week_start"
"base.lang_isk","Icelandic / íslenska","is","is","Left-to-Right","[]",",",,"%d-%m-%Y","%H:%M:%S","7"

This is all about how to add a new language to Odoo 16 and how to define translation to a custom Module.

To read more about configuring translation to custom module & add a new language in Odoo 17, refer to our blog How to Configure Translation to Custom Module & Add a New Language in Odoo 17


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment

 


whatsapp_icon
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message