Q:

Alter Odoo XmlRPC context to use a specific language

I need to get the translated data from odoo with a specific language using XMLRPC 
by default odoo sends data in the default language which is English
api.execute_kw(db, uid, pwd, 'res.country', 'search_read', [[]], {'fields': ['name']})

how to add context to this request to use a specific translation language.

A:

let's say the endpoint is api
you just need to add the param context as shown in the following code
api.execute_kw(db, uid, pwd, 'res.country', 'search_read', [[]], {'fields': ['id', 'name'], 'context' :{'lang': "fr_FR"}})

A:

Here I have listed some example syntax for xmlrpc(Odoo Web Service API) common ORM methods to add context as a param.
Create
api.execute_kw(db, uid, password, 'res.partner', 'create', [{'name: Atul'}], {'context' :{'tag': 1}})

Search
api.execute_kw(db, uid, pwd, 'res.partner', 'search_read', [[('name', '=', "Atul")]], {'context' :{'tag': 1}})

Search Read
api.execute_kw(db, uid, pwd, 'res.partner', 'search_read', [[('name', '=', "Atul")]], {'fields': ['id', 'name'], 'context' :{'tag': 1}})

Read
api.execute_kw(db, uid, password, 'res.partner', 'read', [ids], {'context' :{'tag': 1}})

Write
api.execute_kw(db, uid, password, 'res.partner', 'write', [[id], {'name': "Atul Arvind"}], {'context' :{'tag': 1}})

Unlink
api.execute_kw(db, uid, password, 'res.partner', 'unlink', [[id]], {'context' :{'tag': 1})

Hope this helps!

