[imp] added loading of encoding parameters

bzr revid: nicolas.vanhoren@openerp.com-20110816122450-1cpa3oq8j31hr4xd
This commit is contained in:
niv-openerp 2011-08-16 14:24:50 +02:00
parent f713807311
commit 81ea898b8c
2 changed files with 18 additions and 1 deletions

View File

@ -175,7 +175,15 @@ class WebClient(openerpweb.Controller):
for x in po:
if x.id:
transl["messages"].append({'id': x.id, 'string': x.string})
return {"modules": transs}
lang_model = req.session.model('res.lang')
ids = lang_model.search([("code", "=", lang)])
if ids:
lang_obj = lang_model.read(ids[0], ["direction", "date_format", "time_format",
"grouping", "decimal_point", "thousands_sep"])
else:
lang_obj = None
return {"modules": transs,
"lang_parameters": lang_obj}
class Database(openerpweb.Controller):

View File

@ -566,6 +566,12 @@ openerp.base.OldWidget = openerp.base.Widget.extend({
openerp.base.TranslationDataBase = openerp.base.Class.extend({
init: function() {
this.db = {};
this.parameters = {"direction": 'ltr',
"date_format": '%m/%d/%Y',
"time_format": '%H:%M:%S',
"grouping": "[]",
"decimal_point": ".",
"thousands_sep": ","};
},
set_bundle: function(translation_bundle) {
var self = this;
@ -577,6 +583,9 @@ openerp.base.TranslationDataBase = openerp.base.Class.extend({
_.each(modules, function(name) {
self.add_module_translation(translation_bundle.modules[name]);
});
if (translation_bundle.lang_parameters) {
this.parameters = translation_bundle.lang_parameters;
}
},
add_module_translation: function(mod) {
var self = this;