Enable Dark Mode!
how-to-define-translations-in-a-custom-module-add-a-new-language-in-odoo-18.jpg
By: Ruksana P

How to Define Translations in a Custom Module & Add a New Language in Odoo 18

Technical Odoo 18

Odoo is an open-source ERP platform with strong multi-language support. While its default modules support multiple languages simultaneously, custom modules require manual translation. This enables users within the same database to access the system in their preferred language at the same time.

When the user changes the preferred language, the language, decimal separator, thousand separator, date and time format, first day of week, and text direction will be updated based on the settings defined in the language form.

This guide will walk you through the process of defining translations for a custom module and adding a new language in Odoo 18.

Activate a New Language in Odoo 18

To add a new language, follow these steps:

Navigate to General Settings:

* Go to Settings > Translation > Languages to view the available languages.

* Ensure that you have the necessary permissions to modify or add new languages.

How to Define Translations in a Custom Module & Add a New Language in Odoo 18-cybrosys

Activate the Desired Language:

* Select the language you want to add and activate it to make it available for use in Odoo.

How to Define Translations in a Custom Module & Add a New Language in Odoo 18-cybrosys

To add languages for the custom module, first, we want to activate the desired language.

Export translation

To add Arabic translation for the custom module, click the export translation menu.

How to Define Translations in a Custom Module & Add a New Language in Odoo 18-cybrosys

Fill in the details in the pop-up.

Language: This field lets you specify the target language for translation. Here, we will select Arabic.

File Format: Select the format for exporting translations. Options include CSV, PO, and TGZ archives. In this example, we will use the PO format.

Export Type: Choose whether to export translations for the entire module or a specific model. In this blog, we are translating the entire Vehicle Rental module. However, if you need translations for a specific model, you can select it here.

Apps to Export: This section allows you to select the modules for which you want to add or update translations. Multiple modules can be selected as needed.

If Model is chosen in the Export Type field, two additional fields will appear:

* Model to Export: Select the specific model that requires translation.

* Model Domain: Apply filters to export only the records that meet specific conditions.

How to Define Translations in a Custom Module & Add a New Language in Odoo 18-cybrosys

Now we get the PO file, and we can download the file directly.

How to Define Translations in a Custom Module & Add a New Language in Odoo 18-cybrosys

We can add this to the module's i18n directory.

How to Define Translations in a Custom Module & Add a New Language in Odoo 18-cybrosys

We can add the desired msgstr here as shown below. And upgrade the module.

How to Define Translations in a Custom Module & Add a New Language in Odoo 18-cybrosys

Change the current user’s language as shown below.

How to Define Translations in a Custom Module & Add a New Language in Odoo 18-cybrosys

We get the terms in Arabic as shown below.

How to Define Translations in a Custom Module & Add a New Language in Odoo 18-cybrosys

Import Translations

To import your translation files into Odoo, go to Settings > Translations > Import Translation, edit the existing terms, and upload them.

How to Define Translations in a Custom Module & Add a New Language in Odoo 18-cybrosys

To overwrite the existing terms, we can enable that field.

Add a New Language to the Languages 

To include a new language 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"

And finally, add this CSV file to the data list and 'base' to the depends list in the manifest.

'depends': ['base'],
'data': [
   'security/ir.model.access.csv'
],

We can see this in language records

How to Define Translations in a Custom Module & Add a New Language in Odoo 18-cybrosys

Translating modules in Odoo is essential for businesses operating in multilingual environments. By utilizing Odoo’s export and import features, you can efficiently translate entire modules or specific models into your desired language. Selecting the appropriate language, file format, export type, and apps ensures a smooth and accurate translation process.

Whether you're translating a single model or an entire module, Odoo’s flexible translation tools allow for customization based on your needs. By following the correct workflow, you can enhance user experience and make your Odoo system accessible to a wider audience.

To read more about How to Configure 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