summaryrefslogtreecommitdiff
path: root/addons/base
diff options
context:
space:
mode:
authorniv-openerp <nicolas.vanhoren@openerp.com>2011-08-12 11:54:49 +0200
committerniv-openerp <nicolas.vanhoren@openerp.com>2011-08-12 11:54:49 +0200
commit313dcc6f45f1098326a94fa8bdc19facb205b53f (patch)
treeea461b2e9716568530391271a686b3eed63c711f /addons/base
parent5569e478463b7aded057e534535165accb44a2e9 (diff)
[imp] improvements to python-side translations gathering method
bzr revid: nicolas.vanhoren@openerp.com-20110812095449-m1u7hwh9583n769t
Diffstat (limited to 'addons/base')
-rw-r--r--addons/base/controllers/main.py29
1 files changed, 17 insertions, 12 deletions
diff --git a/addons/base/controllers/main.py b/addons/base/controllers/main.py
index 83a1a94e90b..99b8ff49ef4 100644
--- a/addons/base/controllers/main.py
+++ b/addons/base/controllers/main.py
@@ -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):