تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
5300 أدوات العرض

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
يوليو 24
6799
2
يوليو 24
3898
4
يونيو 24
25466
3
أبريل 24
2377
1
فبراير 24
3963