Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
4761 Visualizzazioni

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
Abbandona

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?

Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
4
lug 24
5888
2
lug 24
1431
4
giu 24
23921
3
apr 24
1447
1
feb 24
1825