diff --git a/addons/web/static/src/js/data_import.js b/addons/web/static/src/js/data_import.js index 355c6c1b493..d5e789ce3e7 100644 --- a/addons/web/static/src/js/data_import.js +++ b/addons/web/static/src/js/data_import.js @@ -70,8 +70,8 @@ openerp.web.DataImport = openerp.web.Dialog.extend({ height: 'auto', position: 'top', buttons: [ - {text: "Close", click: function() { self.stop(); }}, - {text: "Import File", click: function() { self.do_import(); }, 'class': 'oe-dialog-import-button'} + {text: _t("Close"), click: function() { self.stop(); }}, + {text: _t("Import File"), click: function() { self.do_import(); }, 'class': 'oe-dialog-import-button'} ], close: function(event, ui) { self.stop(); diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 7ae3afc704b..c5a2b896da3 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -1,5 +1,6 @@ openerp.web.search = function(openerp) { -var QWeb = openerp.web.qweb; +var QWeb = openerp.web.qweb, + _t = openerp.web._t; openerp.web.SearchView = openerp.web.Widget.extend(/** @lends openerp.web.SearchView# */{ template: "EmptyComponent", @@ -211,12 +212,12 @@ openerp.web.SearchView = openerp.web.Widget.extend(/** @lends openerp.web.Search var $dial = $(dial_html); $dial.dialog({ modal: true, - title: "Filter Entry", - buttons: { - Cancel: function() { + title: _t("Filter Entry"), + buttons: [ + {text: _t("Cancel"), click: function() { $(this).dialog("close"); - }, - OK: function() { + }}, + {text: _t("OK"), click: function() { $(this).dialog("close"); var name = $(this).find("input").val(); self.rpc('/web/searchview/save_filter', { @@ -227,8 +228,8 @@ openerp.web.SearchView = openerp.web.Widget.extend(/** @lends openerp.web.Search }).then(function() { self.reload_managed_filters(); }); - } - } + }} + ] }); } else { // manage_filters select.val("_filters"); @@ -337,7 +338,7 @@ openerp.web.SearchView = openerp.web.Widget.extend(/** @lends openerp.web.Search * @param {Array} errors a never-empty array of error objects */ on_invalid: function (errors) { - this.do_notify("Invalid Search", "triggered from search view"); + this.do_notify(_t("Invalid Search"), _t("triggered from search view")); }, do_clear: function () { this.$element.find('.filter_label, .filter_icon').removeClass('enabled'); @@ -349,7 +350,7 @@ openerp.web.SearchView = openerp.web.Widget.extend(/** @lends openerp.web.Search this.$element.find('table:last').hide(); $('.searchview_extended_groups_list').empty(); - setTimeout(this.on_clear); + setTimeout(this.on_clear, 0); }, /** * Triggered when the search view gets cleared @@ -418,8 +419,10 @@ openerp.web.search.Invalid = openerp.web.Class.extend( /** @lends openerp.web.se this.message = message; }, toString: function () { - return ('Incorrect value for field ' + this.field + - ': [' + this.value + '] is ' + this.message); + return _.sprintf( + _t("Incorrect value for field %(fieldname)s: [%(value)s] is %(message)s"), + {fieldname: this.field, value: this.value, message: this.message} + ); } }); openerp.web.search.Widget = openerp.web.Widget.extend( /** @lends openerp.web.search.Widget# */{ @@ -738,7 +741,7 @@ openerp.web.search.NumberField = openerp.web.search.Field.extend(/** @lends open * @extends openerp.web.search.NumberField */ openerp.web.search.IntegerField = openerp.web.search.NumberField.extend(/** @lends openerp.web.search.IntegerField# */{ - error_message: "not a valid integer", + error_message: _t("not a valid integer"), parse: function (value) { try { return openerp.web.parse_value(value, {'widget': 'integer'}); @@ -752,7 +755,7 @@ openerp.web.search.IntegerField = openerp.web.search.NumberField.extend(/** @len * @extends openerp.web.search.NumberField */ openerp.web.search.FloatField = openerp.web.search.NumberField.extend(/** @lends openerp.web.search.FloatField# */{ - error_message: "not a valid number", + error_message: _t("not a valid number"), parse: function (value) { try { return openerp.web.parse_value(value, {'widget': 'float'}); @@ -1168,14 +1171,14 @@ openerp.web.search.ExtendedSearchProposition.Char = openerp.web.search.ExtendedS template: 'SearchView.extended_search.proposition.char', identifier_prefix: 'extended-search-proposition-char', operators: [ - {value: "ilike", text: "contains"}, - {value: "not ilike", text: "doesn't contain"}, - {value: "=", text: "is equal to"}, - {value: "!=", text: "is not equal to"}, - {value: ">", text: "greater than"}, - {value: "<", text: "less than"}, - {value: ">=", text: "greater or equal than"}, - {value: "<=", text: "less or equal than"} + {value: "ilike", text: _t("contains")}, + {value: "not ilike", text: _t("doesn't contain")}, + {value: "=", text: _t("is equal to")}, + {value: "!=", text: _t("is not equal to")}, + {value: ">", text: _t("greater than")}, + {value: "<", text: _t("less than")}, + {value: ">=", text: _t("greater or equal than")}, + {value: "<=", text: _t("less or equal than")} ], get_value: function() { return this.$element.val(); @@ -1185,12 +1188,12 @@ openerp.web.search.ExtendedSearchProposition.DateTime = openerp.web.search.Exten template: 'SearchView.extended_search.proposition.empty', identifier_prefix: 'extended-search-proposition-datetime', operators: [ - {value: "=", text: "is equal to"}, - {value: "!=", text: "is not equal to"}, - {value: ">", text: "greater than"}, - {value: "<", text: "less than"}, - {value: ">=", text: "greater or equal than"}, - {value: "<=", text: "less or equal than"} + {value: "=", text: _t("is equal to")}, + {value: "!=", text: _t("is not equal to")}, + {value: ">", text: _t("greater than")}, + {value: "<", text: _t("less than")}, + {value: ">=", text: _t("greater or equal than")}, + {value: "<=", text: _t("less or equal than")} ], get_value: function() { return this.datewidget.get_value(); @@ -1205,12 +1208,12 @@ openerp.web.search.ExtendedSearchProposition.Date = openerp.web.search.ExtendedS template: 'SearchView.extended_search.proposition.empty', identifier_prefix: 'extended-search-proposition-date', operators: [ - {value: "=", text: "is equal to"}, - {value: "!=", text: "is not equal to"}, - {value: ">", text: "greater than"}, - {value: "<", text: "less than"}, - {value: ">=", text: "greater or equal than"}, - {value: "<=", text: "less or equal than"} + {value: "=", text: _t("is equal to")}, + {value: "!=", text: _t("is not equal to")}, + {value: ">", text: _t("greater than")}, + {value: "<", text: _t("less than")}, + {value: ">=", text: _t("greater or equal than")}, + {value: "<=", text: _t("less or equal than")} ], get_value: function() { return this.datewidget.get_value(); @@ -1225,12 +1228,12 @@ openerp.web.search.ExtendedSearchProposition.Integer = openerp.web.search.Extend template: 'SearchView.extended_search.proposition.integer', identifier_prefix: 'extended-search-proposition-integer', operators: [ - {value: "=", text: "is equal to"}, - {value: "!=", text: "is not equal to"}, - {value: ">", text: "greater than"}, - {value: "<", text: "less than"}, - {value: ">=", text: "greater or equal than"}, - {value: "<=", text: "less or equal than"} + {value: "=", text: _t("is equal to")}, + {value: "!=", text: _t("is not equal to")}, + {value: ">", text: _t("greater than")}, + {value: "<", text: _t("less than")}, + {value: ">=", text: _t("greater or equal than")}, + {value: "<=", text: _t("less or equal than")} ], get_value: function() { try { @@ -1241,18 +1244,18 @@ openerp.web.search.ExtendedSearchProposition.Integer = openerp.web.search.Extend } }); openerp.web.search.ExtendedSearchProposition.Id = openerp.web.search.ExtendedSearchProposition.Integer.extend({ - operators: [{value: "=", text: "is"}] + operators: [{value: "=", text: _t("is")}] }); openerp.web.search.ExtendedSearchProposition.Float = openerp.web.search.ExtendedSearchProposition.Field.extend({ template: 'SearchView.extended_search.proposition.float', identifier_prefix: 'extended-search-proposition-float', operators: [ - {value: "=", text: "is equal to"}, - {value: "!=", text: "is not equal to"}, - {value: ">", text: "greater than"}, - {value: "<", text: "less than"}, - {value: ">=", text: "greater or equal than"}, - {value: "<=", text: "less or equal than"} + {value: "=", text: _t("is equal to")}, + {value: "!=", text: _t("is not equal to")}, + {value: ">", text: _t("greater than")}, + {value: "<", text: _t("less than")}, + {value: ">=", text: _t("greater or equal than")}, + {value: "<=", text: _t("less or equal than")} ], get_value: function() { try { @@ -1266,8 +1269,8 @@ openerp.web.search.ExtendedSearchProposition.Selection = openerp.web.search.Exte template: 'SearchView.extended_search.proposition.selection', identifier_prefix: 'extended-search-proposition-selection', operators: [ - {value: "=", text: "is"}, - {value: "!=", text: "is not"} + {value: "=", text: _t("is")}, + {value: "!=", text: _t("is not")} ], set_field: function(field) { this.field = field; @@ -1280,8 +1283,8 @@ openerp.web.search.ExtendedSearchProposition.Boolean = openerp.web.search.Extend template: 'SearchView.extended_search.proposition.boolean', identifier_prefix: 'extended-search-proposition-boolean', operators: [ - {value: "=", text: "is true"}, - {value: "!=", text: "is false"} + {value: "=", text: _t("is true")}, + {value: "!=", text: _t("is false")} ], get_value: function() { return true;