Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
5310 Lượt xem

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

Ảnh đại diện
Huỷ bỏ

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?

Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 7 24
6806
2
thg 7 24
3993
4
thg 6 24
25475
3
thg 4 24
2382
1
thg 2 24
4075