[imp] improvements to python-side translations gathering method
bzr revid: nicolas.vanhoren@openerp.com-20110812095449-m1u7hwh9583n769t
This commit is contained in:
@@ -159,18 +159,23 @@ class WebClient(openerpweb.Controller):
|
||||
return r
|
||||
|
||||
@openerpweb.jsonrequest
|
||||
def translations(self, addon_name, lang):
|
||||
f_name = os.path.join(openerpweb.path_addons, addon_name, "po", lang + ".po")
|
||||
with open(f_name) as t_file:
|
||||
po = read_po(t_file)
|
||||
|
||||
transl = {"messages":[]}
|
||||
|
||||
for x in po:
|
||||
if x.id:
|
||||
transl["messages"].append({'id': x.id, 'string': x.string})
|
||||
|
||||
return transl
|
||||
def translations(self, mods, lang):
|
||||
transs = {}
|
||||
for addon_name in mods:
|
||||
transl = {"messages":[]}
|
||||
transs[addon_name] = transl
|
||||
f_name = os.path.join(openerpweb.path_addons, addon_name, "po", lang + ".po")
|
||||
if not os.path.exists(f_name):
|
||||
continue
|
||||
try:
|
||||
with open(f_name) as t_file:
|
||||
po = read_po(t_file)
|
||||
except:
|
||||
continue
|
||||
for x in po:
|
||||
if x.id:
|
||||
transl["messages"].append({'id': x.id, 'string': x.string})
|
||||
return transs
|
||||
|
||||
|
||||
class Database(openerpweb.Controller):
|
||||
|
||||
Reference in New Issue
Block a user