Gettext Tools
The GNU gettext tools help produce, use, and update the translation files. To expedite translations, Odoo employs the gettext-like method "underscore" (). We can use it to designate string literals in the code that need to be translated with the language that is appropriate for the situation. To use it in the Python code, we must import it from the Odoo packages.
The string literals can be written within _() after we import it because doing so will include them in the translation file.
Export the translation file (PO file) for the relevant module for that language now.
We can see that the PO file contains the string literal that needs to be translated. The msgid will contain the untranslated string. The translated string for the relevant language can be added to msgstr.
Once the translations have been added or updated, there are two ways to add them to Odoo. To add or change translations in Odoo.
Create a new directory called "i18n" inside the module and place our translation files there if we need to update the translations automatically with the module. This is quite helpful when we release apps or modules that support several languages. The ISO code for the language in Odoo will be used as the filename for the translation files (for example, fr CA.po). The directory also contains the Odoo translation template, which is added with the filename serving as the module name (for example, point of sale.pot).
When the languages are activated, Odoo will automatically load the translations that were added with the modules.