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

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

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

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

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”.

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

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.

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.

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 upgrade the custom module,but we can't see any changes because the current language for the administrator is English.

So we need to change it to Arabic.

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

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 custom Module.