[IMP] improved code to load data from po.
bzr revid: tpa@tinyerp.com-20120716060056-3az6awpd6gw39hii
This commit is contained in:
@@ -355,14 +355,11 @@ class WebClient(openerpweb.Controller):
|
||||
|
||||
proxy = req.session.proxy("translation")
|
||||
messages = proxy.load(req.session._db, mods, langs, "web")
|
||||
# keep loading from .po (Reason to run web without embedded mode)
|
||||
if not messages['web']['messages']:
|
||||
for addon_name in mods:
|
||||
transl = {'messages':[]}
|
||||
messages[addon_name] = transl
|
||||
addons_path = openerpweb.addons_manifest[addon_name]['addons_path']
|
||||
for mod in messages:
|
||||
if not messages[mod]['messages']:
|
||||
addons_path = openerpweb.addons_manifest[mod]['addons_path']
|
||||
for l in langs:
|
||||
f_name = os.path.join(addons_path, addon_name, "i18n", l + ".po")
|
||||
f_name = os.path.join(addons_path, mod, "i18n", l + ".po")
|
||||
if not os.path.exists(f_name):
|
||||
continue
|
||||
try:
|
||||
@@ -372,7 +369,7 @@ class WebClient(openerpweb.Controller):
|
||||
continue
|
||||
for x in po:
|
||||
if x.id and x.string and "openerp-web" in x.auto_comments:
|
||||
transl["messages"].append({'id': x.id, 'string': x.string})
|
||||
messages[mod]["messages"].append({'id': x.id, 'string': x.string})
|
||||
return {"modules": messages,
|
||||
"lang_parameters": lang_obj}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user