Translation engine in odoo
-
Upload
ranjit-pillai -
Category
Technology
-
view
3.595 -
download
0
Transcript of Translation engine in odoo
Translation Engine in Odoo
Ranjit Pillai (rpi-odoo)Jr. Application EngineerTiny ERP Pvt. Ltd.
Agenda
● Architecture of Translation Engine
● Load Translation from po file
● Export Translation into pot file
● About Transifex
● Integrate Translation Web Service: Gengo
Architecture of Translation Engine
Odoo Translation
Engine(ir.translation)
po file pot file
Webpage/View
Transifex(Translator)
Import/Load Export
Template FileTranslated File
Language in context
Translated View
UTW
TW
❖ UTW - Untranslated Words❖ TW - Translated Words
Load Translation
● Load the particular language Settings>Translation>Load a Translation
● Change the user’s language Preferences>Language
Odoo Translation
Engine(ir.translation)
po fileImport/Load
Webpage/View
Language in context
Translated View
Export Translation into POT file
● To generate .pot file go to Settings>Translation>Import/Export>Export Translation
Odoo Translation
Engine(ir.translation)
pot fileExport
Translation Export Types
Implicit exports
● Odoo automatically exports translatable strings like:○ In non-QWeb views, all text nodes are exported as well as the content of the “string”, “help”,
“sum”, “confirm” and “placeholder” attributes.
○ In QWeb templates, all text nodes are exported except inside t-translation=’off’ blocks, the content of the “title”, “alt”, “label” and “placeholder” attributes are also exported.
○ for class:`openerp.fields.Field`, unless their field is marked with “translate = False”: their “string” and “help” attributes are exported.
○ If “selection” is present and a list (or tuple), it is exported.
○ help/error messages of `openerp.models.Model._constraints` and `openerp.models.Model._sql_constraints` are exported.
Translation Export Types(Cont.)
Explicit exports
● When it comes to more "imperative" situations in Python code or Javascript code, Odoo cannot automatically export translatable terms so they must be marked explicitly for export. This is done by wrapping a literal string in a function call.
○ In Python, the wrapping function is :`openerp._`■ title = _("Bank Accounts")
○ In JavaScript, the wrapping function is generally :`openerp.web._t`■ title = _t("Bank Accounts")
Structure of translation terms
Note.pot
fr.po (inside note/i18n)
ir.translationmodel
● Example of type = model:
Structure of translation terms(cont.)
Stock.pot
fr.po (inside stock/i18n)
ir.translationmodel
● Example of type = code:
● Other types are selection, constraint and sql_constraint
Directory Structure of i18n in Odoo
POT files are basically the template files for PO files. It will have all the translation strings (the msgstr parts) left empty.
PO files are the files which contain the actual translations. 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 and so on..
Translating Odoo with Transifex
● The easiest way to translate Odoo is to use the dedicated Translation interface on Transifex.
● Transifex provides a web-based translation interface, which can be used to translate.
● Translation Teams on Transifex○ Every language is managed by a dedicated translation team. Anyone is free to join any translation
team at any point. Within each team, members can have different roles:■ Translator: free to join, can submit translation suggestions (this is your role when you initially join a
team)
■ Reviewer: can approve translation suggestions from Translators.
■ Coordinator: can manage the members of the team and appoint Reviewers.
Translating Odoo with Transifex(cont.)
● Architecture of Transifex
<module>.pot Transifex
<lang>.po
<lang>.po
<lang>.po
<lang>.po
Gengo Translation
● Gengo is a web-based human translation platform.● In Odoo, Gengo is used to translate the text of the Website.
Send Words
Receive TranslatedWords
Thank You !!!
References
References:
● https://github.com/odoo/odoo/wiki/Translations● https://www.odoo.
com/documentation/master/reference/translations.html
Useful Links:
● Transifex Tutorial : http://docs.transifex.com/tutorials/client/● Odoo & Transifex : https://www.transifex.com/odoo/public/● GNU gettext : http://www.gnu.
org/software/gettext/manual/gettext.html