summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/search.js
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2011-11-14 11:12:21 +0100
committerXavier Morel <xmo@openerp.com>2011-11-14 11:12:21 +0100
commitd2a0f9bcbafb16366d945cb992e4172d2991b4d4 (patch)
treec7942848212d0842b08e05c5ed9de0ab697889ab /addons/web/static/src/js/search.js
parent86ecdd5e90df2a8acbcf3dac0bf11a44b107d85b (diff)
[IMP] mark a bunch of strings as translatable in searchview JS
bzr revid: xmo@openerp.com-20111114101221-905mu3id02o3n2li
Diffstat (limited to 'addons/web/static/src/js/search.js')
-rw-r--r--addons/web/static/src/js/search.js105
1 files changed, 54 insertions, 51 deletions
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;