summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/coresetup.js
diff options
context:
space:
mode:
authorniv-openerp <nicolas.vanhoren@openerp.com>2013-08-05 16:55:14 +0200
committerniv-openerp <nicolas.vanhoren@openerp.com>2013-08-05 16:55:14 +0200
commit38699e04cf74399c4ee35881feddc170e4073c87 (patch)
treeaa73f73220e22bd5f492f284f78c0fe4f3d5e34a /addons/web/static/src/js/coresetup.js
parentb3c4d025908bc8923069154de4673fae283cd18e (diff)
Copied a part of translation database to openerpframework.js
bzr revid: nicolas.vanhoren@openerp.com-20130805145514-uuywlhleyfz2xoj4
Diffstat (limited to 'addons/web/static/src/js/coresetup.js')
-rw-r--r--addons/web/static/src/js/coresetup.js54
1 files changed, 3 insertions, 51 deletions
diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js
index 59f2c6a3a96..7f73b867a0e 100644
--- a/addons/web/static/src/js/coresetup.js
+++ b/addons/web/static/src/js/coresetup.js
@@ -375,58 +375,13 @@ instance.web.Bus = instance.web.Class.extend(instance.web.EventDispatcherMixin,
});
instance.web.bus = new instance.web.Bus();
-/** OpenERP Translations */
-instance.web.TranslationDataBase = instance.web.Class.extend(/** @lends instance.web.TranslationDataBase# */{
- /**
- * @constructs instance.web.TranslationDataBase
- * @extends instance.web.Class
- */
- init: function() {
- this.db = {};
- this.parameters = {"direction": 'ltr',
- "date_format": '%m/%d/%Y',
- "time_format": '%H:%M:%S',
- "grouping": [],
- "decimal_point": ".",
- "thousands_sep": ","};
- },
+instance.web.TranslationDataBase.include({
set_bundle: function(translation_bundle) {
- var self = this;
- this.db = {};
- var modules = _.keys(translation_bundle.modules);
- modules.sort();
- if (_.include(modules, "web")) {
- modules = ["web"].concat(_.without(modules, "web"));
- }
- _.each(modules, function(name) {
- self.add_module_translation(translation_bundle.modules[name]);
- });
+ this._super(translation_bundle);
if (translation_bundle.lang_parameters) {
- this.parameters = translation_bundle.lang_parameters;
- this.parameters.grouping = py.eval(
- this.parameters.grouping);
+ this.parameters.grouping = py.eval(this.parameters.grouping);
}
},
- add_module_translation: function(mod) {
- var self = this;
- _.each(mod.messages, function(message) {
- self.db[message.id] = message.string;
- });
- },
- build_translation_function: function() {
- var self = this;
- var fcnt = function(str) {
- var tmp = self.get(str);
- return tmp === undefined ? str : tmp;
- };
- fcnt.database = this;
- return fcnt;
- },
- get: function(key) {
- if (this.db[key])
- return this.db[key];
- return undefined;
- }
});
/** Custom jQuery plugins */
@@ -511,8 +466,6 @@ $.async_when = function() {
/** Setup default session */
instance.session = new instance.web.Session();
-/** Configure default qweb */
-instance.web._t = new instance.web.TranslationDataBase().build_translation_function();
/**
* Lazy translation function, only performs the translation when actually
* printed (e.g. inserted into a template)
@@ -529,7 +482,6 @@ instance.web._lt = function (s) {
};
instance.web.qweb.debug = instance.session.debug;
_.extend(instance.web.qweb.default_dict, {
- '_t' : instance.web._t,
'__debug__': instance.session.debug,
});
instance.web.qweb.preprocess_node = function() {