Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
3526 มุมมอง

We are using the xmlrpc API of Odoo. When making requests to models like account.account, we get the information back in French. If I add { context: { lang: "
"en_GB" } } to the request it's returned in English.


But where can one decide what the default language is that the API will use to return the data in? Preferably in the UI.

อวตาร
ละทิ้ง
ผู้เขียน

Hi! This was indeed first put on French, but after changing this, the data is still returned in French instead of English. So it seems that this doesn't have an influence on it. I think changing that field only has impact on the UI of Odoo, and not in what language data is returned through the API.

ผู้เขียน คำตอบที่ดีที่สุด

@Julien Plaitin: I'm not able to comment on your post, so I created a new reply on my original post.

I never found a solution that would automatically add the right language based on what the user has set in their environment. What we eventually did in our tool (Monitr) is the following:

  1. User connects with Odoo
  2. Fetch all possible languages their environment supports
  3. User decides which language they would prefer to use
  4. Save this in our database
  5. Use that value in the context of all requests
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

I think the language the API returns is the one set in the user-defined defaults. However, I don't know why Odoo does it like that.

Do you have any more insights on this?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

Can you see the language configured for the user which you have used to trigger the xml rpc script. May be the language set by the user is French.






Thanks

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ส.ค. 25
964
1
ส.ค. 25
1204
2
ก.ค. 25
3938
API xmlrpc - upload pdf bills to account แก้ไขแล้ว
3
ก.ค. 25
1265
1
มิ.ย. 25
2996