コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
5323 ビュー

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

アバター
破棄

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?

最善の回答

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'}

アバター
破棄
関連投稿 返信 ビュー 活動
4
7月 24
6807
2
7月 24
4001
4
6月 24
25477
3
4月 24
2383
1
2月 24
4080