Community mailing list archives

community@mail.odoo.com

Re: Multi Language only on Data, not Application Labels

by
Martin Trigaux (mat)
- 04/18/2016 11:35:40
On 18/04/16 17:09, kittiu@gmail.com wrote:
> But is it possible that system load translation only for data.
>
> For example, we want to keep data in both Thai and English language. But
> we will always want to have only English labels.

Yes it is possible but not specially easy.

What you call data vs view translations are actually both data translations.
Technically, for a field content to be translatable, you need to add the 
attribute 'translate=True' on the field you want to translate. This is 
what has been done on the product object (product.template) for instance.

To get a field label to be translated, it is actually possible because 
the field "field_description" on the field object (ir.model.fields).
To get the content of a view translated, it is actually the field 
"arch_db" on the view object (ir.ui.view).
To get a menu translated, it is actually the field "name" on the view 
object (ir.ui.menu).
...
you understand the logic.

The exception being for the translations generated from the python code 
(e.g. popup warning messages) or the web client code (e.g. widgets, 
"create" button, ....)

So you need to think exactly what do you want to translate, and what do 
you want to keep.

If you want to only disable the translations of the labels and views, 
it's probably easier to only remove the attribute 'translate=True' on 
the fields of the appropriate modules (doing a field inheritance).

If you want to disable the translations on all the python code, you will 
probably want to modify the method _ in openerp.tools.translate.
If you want to disable the translations of all the web client code, you 
will probably want to modify the javascript method _t and _lt.

You can also always remove the translations in the menu Settings > 
Translations > Applications Terms > Translated Terms but keep in mind 
that they will come back at the next module update.

Martin

-- 
Martin Trigaux
Odoo
https://odoo.com
https://github.com/mart-e