Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
5292 Prikazi

Hello,

Is there a way to force a translation? 

E.g.:
I have a user with english as default language, but I want to force a french translation.

Is there a way to do this? _('fr', 'somethig to translate')

I could see that it's not possible to set the self.env.lang property from a method, so any help would be welcome..

Thank you in advance
Regards

Avatar
Opusti

I wanted to make comment but site is not allowing me to make comment. Because this is not an answer please convert it as comment. May I know why do you want to translate to French for an English user?

Best Answer

Language propagate with context, see - self.env.context or self._context, for example:

self.env.context = {'lang': 'en_US', 'default_state': 'open', 'uid': 1, 'active_model': 'res.partner'}

Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
4
jul. 24
6784
2
jul. 24
3746
4
jun. 24
25433
3
apr. 24
2360
1
feb. 24
3779