diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index e36b46ed51a..def93c16ea4 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -28,6 +28,7 @@ except ImportError: xlwt = None import openerp +from openerp.tools.translate import _ from .. import http from .. import nonliterals @@ -821,7 +822,7 @@ class Database(openerpweb.Controller): except xmlrpclib.Fault, e: if e.faultCode and e.faultCode.split(':')[0] == 'AccessDenied': return {'error': e.faultCode, 'title': 'Drop Database'} - return {'error': 'Could not drop database !', 'title': 'Drop Database'} + return {'error': _('Could not drop database !'), 'title': _('Drop Database')} @openerpweb.httprequest def backup(self, req, backup_db, backup_pwd, token): @@ -839,7 +840,7 @@ class Database(openerpweb.Controller): {'fileToken': int(token)} ) except xmlrpclib.Fault, e: - return simplejson.dumps([[],[{'error': e.faultCode, 'title': 'backup Database'}]]) + return simplejson.dumps([[],[{'error': e.faultCode, 'title': _('Backup Database')}]]) @openerpweb.httprequest def restore(self, req, db_file, restore_pwd, new_db): @@ -860,8 +861,8 @@ class Database(openerpweb.Controller): return req.session.proxy("db").change_admin_password(old_password, new_password) except xmlrpclib.Fault, e: if e.faultCode and e.faultCode.split(':')[0] == 'AccessDenied': - return {'error': e.faultCode, 'title': 'Change Password'} - return {'error': 'Error, password not changed !', 'title': 'Change Password'} + return {'error': e.faultCode, 'title': _('Change Password')} + return {'error': _('Error, password not changed !'), 'title': _('Change Password')} class Session(openerpweb.Controller): _cp_path = "/web/session" @@ -897,16 +898,16 @@ class Session(openerpweb.Controller): old_password, new_password,confirm_password = operator.itemgetter('old_pwd', 'new_password','confirm_pwd')( dict(map(operator.itemgetter('name', 'value'), fields))) if not (old_password.strip() and new_password.strip() and confirm_password.strip()): - return {'error':'You cannot leave any password empty.','title': 'Change Password'} + return {'error':_('You cannot leave any password empty.'),'title': _('Change Password')} if new_password != confirm_password: - return {'error': 'The new password and its confirmation must be identical.','title': 'Change Password'} + return {'error': _('The new password and its confirmation must be identical.'),'title': _('Change Password')} try: if req.session.model('res.users').change_password( old_password, new_password): return {'new_password':new_password} except Exception: - return {'error': 'The old password you provided is incorrect, your password was not changed.', 'title': 'Change Password'} - return {'error': 'Error, password not changed !', 'title': 'Change Password'} + return {'error': _('The old password you provided is incorrect, your password was not changed.'), 'title': _('Change Password')} + return {'error': _('Error, password not changed !'), 'title': _('Change Password')} @openerpweb.jsonrequest def sc_list(self, req): @@ -918,7 +919,7 @@ class Session(openerpweb.Controller): try: return req.session.proxy("db").list_lang() or [] except Exception, e: - return {"error": e, "title": "Languages"} + return {"error": e, "title": _("Languages")} @openerpweb.jsonrequest def modules(self, req): @@ -1450,7 +1451,7 @@ class SearchView(View): if not isinstance(parsed_domain, nonliterals.BaseDomain) else req.session.eval_domain(parsed_domain)) except Exception: - logger.exception("Failed to parse custom filter %s in %s", + logger.exception(_("Failed to parse custom filter %s in %s"), filter['name'], model) filter['disabled'] = True del filter['context'] @@ -1571,7 +1572,7 @@ class Binary(openerpweb.Controller): res = Model.default_get(fields, context) filecontent = base64.b64decode(res.get(field, '')) if not filecontent: - raise ValueError("No content found for field '%s' on '%s:%s'" % + raise ValueError(_("No content found for field '%s' on '%s:%s'") % (field, model, id)) else: filename = '%s_%s' % (model.replace('.', '_'), id) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 940bf800851..91cca8468d1 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -289,7 +289,7 @@ instance.web.CrashManager = instance.web.Class.extend({ }); instance.web.Loading = instance.web.Widget.extend({ - template: 'Loading', + template: _t("Loading"), init: function(parent) { this._super(parent); this.count = 0; @@ -390,11 +390,11 @@ instance.web.DatabaseManager = instance.web.Widget.extend({ self.$el.find("form[name=restore_db_form]").validate({ submitHandler: self.do_restore }); self.$el.find("form[name=change_pwd_form]").validate({ messages: { - old_pwd: "Please enter your previous password", - new_pwd: "Please enter your new password", + old_pwd: _t("Please enter your previous password"), + new_pwd: _t("Please enter your new password"), confirm_pwd: { - required: "Please confirm your new password", - equalTo: "The confirmation does not match the password" + required: _t("Please confirm your new password"), + equalTo: _t("The confirmation does not match the password") } }, submitHandler: self.do_change_password @@ -478,7 +478,7 @@ instance.web.DatabaseManager = instance.web.Widget.extend({ self.display_error(result); return; } - self.do_notify("Duplicating database", "The database has been duplicated."); + self.do_notify(_t("Duplicating database"), _t("The database has been duplicated.")); self.start(); }); }, @@ -488,7 +488,7 @@ instance.web.DatabaseManager = instance.web.Widget.extend({ fields = $form.serializeArray(), $db_list = $form.find('[name=drop_db]'), db = $db_list.val(); - if (!db || !confirm("Do you really want to delete the database: " + db + " ?")) { + if (!db || !confirm(_.str.sprintf(_t("Do you really want to delete the database: %s ?"), db))) { return; } self.rpc("/web/database/drop", {'fields': fields}).done(function(result) { @@ -496,7 +496,7 @@ instance.web.DatabaseManager = instance.web.Widget.extend({ self.display_error(result); return; } - self.do_notify("Dropping database", "The database '" + db + "' has been dropped"); + self.do_notify(_t("Dropping database"), _.str.sprintf(_t("The database %s has been dropped"), db)); self.start(); }); }, @@ -511,7 +511,7 @@ instance.web.DatabaseManager = instance.web.Widget.extend({ error: function(error){ if(error){ self.display_error({ - title: 'Backup Database', + title: _t("Backup Database"), error: 'AccessDenied' }); } @@ -534,13 +534,13 @@ instance.web.DatabaseManager = instance.web.Widget.extend({ if (body.indexOf('403 Forbidden') !== -1) { self.display_error({ - title: 'Access Denied', - error: 'Incorrect super-administrator password' + title: _t("Access Denied"), + error: _t("Incorrect super-administrator password") }); } else { self.display_error({ - title: 'Restore Database', - error: 'Could not restore the database' + title: _t("Restore Database"), + error: _t("Could not restore the database") }); } }, @@ -560,7 +560,7 @@ instance.web.DatabaseManager = instance.web.Widget.extend({ return; } self.unblockUI(); - self.do_notify("Changed Password", "Password has been changed successfully"); + self.do_notify(_t("Changed Password"), _t("Password has been changed successfully")); }); }, do_exit: function () { @@ -642,7 +642,7 @@ instance.web.Login = instance.web.Widget.extend({ } var db = this.$("form [name=db]").val(); if (!db) { - this.do_warn("Login", "No database selected !"); + this.do_warn(_t("Login"), _t("No database selected !")); return false; } var login = this.$("form input[name=login]").val(); @@ -678,7 +678,7 @@ instance.web.Login = instance.web.Widget.extend({ self.trigger('login_successful'); }, function () { self.$(".oe_login_pane").fadeIn("fast", function() { - self.show_error("Invalid username or password"); + self.show_error(_t("Invalid username or password")); }); }); }, @@ -765,7 +765,7 @@ instance.web.ChangePassword = instance.web.Widget.extend({ template: "ChangePassword", start: function() { var self = this; - this.getParent().dialog_title = "Change Password"; + this.getParent().dialog_title = _t("Change Password"); var $button = self.$el.find('.oe_form_button'); $button.appendTo(this.getParent().$buttons); $button.eq(2).click(function(){ diff --git a/addons/web/static/src/js/dates.js b/addons/web/static/src/js/dates.js index 3db48c8412a..1a48463df2c 100644 --- a/addons/web/static/src/js/dates.js +++ b/addons/web/static/src/js/dates.js @@ -1,5 +1,6 @@ openerp.web.dates = function(instance) { +var _t = instance.web._t; /** * Converts a string to a Date javascript object using OpenERP's @@ -18,11 +19,11 @@ instance.web.str_to_datetime = function(str) { var regex = /^(\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d)(?:\.\d+)?$/; var res = regex.exec(str); if ( !res ) { - throw new Error("'" + str + "' is not a valid datetime"); + throw new Error(_.str.sprintf(_t("'%s' is not a valid datetime"), str)); } var obj = Date.parseExact(res[1] + " UTC", 'yyyy-MM-dd HH:mm:ss zzz'); if (! obj) { - throw new Error("'" + str + "' is not a valid datetime"); + throw new Error(_.str.sprintf(_t("'%s' is not a valid datetime"), str)); } return obj; }; @@ -45,11 +46,11 @@ instance.web.str_to_date = function(str) { var regex = /^\d\d\d\d-\d\d-\d\d$/; var res = regex.exec(str); if ( !res ) { - throw new Error("'" + str + "' is not a valid date"); + throw new Error(_.str.sprintf(_t("'%s' is not a valid date"), str)); } var obj = Date.parseExact(str, 'yyyy-MM-dd'); if (! obj) { - throw new Error("'" + str + "' is not a valid date"); + throw new Error(_.str.sprintf(_t("'%s' is not a valid date"), str)); } return obj; }; @@ -72,11 +73,11 @@ instance.web.str_to_time = function(str) { var regex = /^(\d\d:\d\d:\d\d)(?:\.\d+)?$/; var res = regex.exec(str); if ( !res ) { - throw new Error("'" + str + "' is not a valid time"); + throw new Error(_.str.sprintf(_t("'%s' is not a valid time"), str)); } var obj = Date.parseExact("1970-01-01 " + res[1], 'yyyy-MM-dd HH:mm:ss'); if (! obj) { - throw new Error("'" + str + "' is not a valid time"); + throw new Error(_.str.sprintf(_t("'%s' is not a valid time"), str)); } return obj; }; diff --git a/addons/web/static/src/js/formats.js b/addons/web/static/src/js/formats.js index e586b94db6b..9432b02826f 100644 --- a/addons/web/static/src/js/formats.js +++ b/addons/web/static/src/js/formats.js @@ -224,7 +224,7 @@ instance.web.parse_value = function (value, descriptor, value_if_empty) { } while(tmp !== value); tmp = Number(value); if (isNaN(tmp)) - throw new Error(value + " is not a correct integer"); + throw new Error(_.str.sprintf(_t("'%s' is not a correct integer"), value)); return tmp; case 'float': var tmp = Number(value); @@ -239,7 +239,7 @@ instance.web.parse_value = function (value, descriptor, value_if_empty) { var reformatted_value = tmp.replace(instance.web._t.database.parameters.decimal_point, "."); var parsed = Number(reformatted_value); if (isNaN(parsed)) - throw new Error(value + " is not a correct float"); + throw new Error(_.str.sprintf(_t("'%s' is not a correct float"), value)); return parsed; case 'float_time': var factor = 1; @@ -263,7 +263,7 @@ instance.web.parse_value = function (value, descriptor, value_if_empty) { datetime = Date.parse(value); if (datetime !== null) return instance.web.datetime_to_str(datetime); - throw new Error(value + " is not a valid datetime"); + throw new Error(_.str.sprintf(_t("'%s' is not a correct datetime"), value)); case 'date': var date = Date.parseExact(value, date_pattern); if (date !== null) @@ -271,7 +271,7 @@ instance.web.parse_value = function (value, descriptor, value_if_empty) { date = Date.parse(value); if (date !== null) return instance.web.date_to_str(date); - throw new Error(value + " is not a valid date"); + throw new Error(_.str.sprintf(_t("'%s' is not a correct date"), value)); case 'time': var time = Date.parseExact(value, time_pattern); if (time !== null) @@ -279,7 +279,7 @@ instance.web.parse_value = function (value, descriptor, value_if_empty) { time = Date.parse(value); if (time !== null) return instance.web.time_to_str(time); - throw new Error(value + " is not a valid time"); + throw new Error(_.str.sprintf(_t("'%s' is not a correct time"), value)); } return value; }; @@ -294,7 +294,7 @@ instance.web.auto_str_to_date = function(value, type) { try { return instance.web.str_to_time(value); } catch(e) {} - throw new Error("'" + value + "' is not a valid date, datetime nor time"); + throw new Error(_.str.sprintf(_t("'%s' is not a correct date, datetime nor time"), value)); }; instance.web.auto_date_to_str = function(value, type) { @@ -306,7 +306,7 @@ instance.web.auto_date_to_str = function(value, type) { case 'time': return instance.web.time_to_str(value); default: - throw new Error(type + " is not convertible to date, datetime nor time"); + throw new Error(_.str.sprintf(_t("'%s' is not convertible to date, datetime nor time"), type)); } }; diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 927d585a5be..dd9b2be5fb0 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -148,7 +148,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM load_form: function(data) { var self = this; if (!data) { - throw new Error("No data provided."); + throw new Error(_t("No data provided.")); } if (this.arch) { throw "Form view does not support multiple calls to load_form"; @@ -316,12 +316,12 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM var self = this, set_values = []; if (!record) { this.set({ 'title' : undefined }); - this.do_warn("Form", "The record could not be found in the database.", true); + this.do_warn(_t("Form"), _t("The record could not be found in the database."), true); return $.Deferred().reject(); } this.datarecord = record; this._actualize_mode(); - this.set({ 'title' : record.id ? record.display_name : "New" }); + this.set({ 'title' : record.id ? record.display_name : _t("New") }); _(this.fields).each(function (field, f) { field._dirty_flag = false; @@ -431,7 +431,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM var onchange = _.str.trim(on_change); var call = onchange.match(/^\s?(.*?)\((.*?)\)\s?$/); if (!call) { - throw new Error("Wrong on change format: " + onchange); + throw new Error(_.str.sprintf( _t("Wrong on change format: %s"), onchange )); } var method = call[1]; @@ -872,7 +872,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM }).value(); warnings.unshift(''); - this.do_warn("The following fields are invalid :", warnings.join('')); + this.do_warn(_t("The following fields are invalid:", warnings.join('')); }, /** * Reload the form after saving @@ -1241,11 +1241,11 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt _.each(this.fields_to_init, function($elem) { var name = $elem.attr("name"); if (!self.fvg.fields[name]) { - throw new Error("Field '" + name + "' specified in view could not be found."); + throw new Error(_.str.sprintf(_t("Field '%s' specified in view could not be found."), name)); } var obj = self.fields_registry.get_any([$elem.attr('widget'), self.fvg.fields[name].type]); if (!obj) { - throw new Error("Widget type '"+ $elem.attr('widget') + "' is not implemented"); + throw new Error(_.str.sprintf(_t("Widget type '%s' is not implemented"), $elem.attr('widget'))); } var w = new (obj)(self.view, instance.web.xml_to_json($elem[0])); var $label = self.labels[$elem.attr("name")]; @@ -2319,7 +2319,7 @@ instance.web.form.FieldEmail = instance.web.form.FieldChar.extend({ }, on_button_clicked: function() { if (!this.get('value') || !this.is_syntax_valid()) { - this.do_warn("E-mail error", "Can't send email to invalid e-mail address"); + this.do_warn(_t("E-mail error"), _t("Can't send email to invalid e-mail address")); } else { location.href = 'mailto:' + this.get('value'); } @@ -2348,7 +2348,7 @@ instance.web.form.FieldUrl = instance.web.form.FieldChar.extend({ }, on_button_clicked: function() { if (!this.get('value')) { - this.do_warn("Resource error", "This resource is empty"); + this.do_warn(_t("Resource error"), _t("This resource is empty")); } else { var url = $.trim(this.get('value')); if(/^www\./i.test(url)) @@ -3385,7 +3385,7 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ var views = []; _.each(modes, function(mode) { if (! _.include(["list", "tree", "graph", "kanban"], mode)) { - throw new Error(_.str.sprintf("View type '%s' is not supported in One2Many.", mode)); + throw new Error(_.str.sprintf(_t("View type '%s' is not supported in One2Many."), mode)); } var view = { view_id: false, @@ -4840,7 +4840,7 @@ instance.web.form.FieldBinary = instance.web.form.AbstractField.extend(instance. }, on_file_uploaded: function(size, name, content_type, file_base64) { if (size === false) { - this.do_warn("File Upload", "There was a problem while uploading your file"); + this.do_warn(_t("File Upload"), _t("There was a problem while uploading your file")); // TODO: use openerp web crashmanager console.warn("Error while uploading file : ", name); } else { @@ -5009,7 +5009,7 @@ instance.web.form.FieldMany2ManyBinaryMultiFiles = instance.web.form.AbstractFie this.field_manager = field_manager; this.node = node; if(this.field.type != "many2many" || this.field.relation != 'ir.attachment') { - throw "The type of the field '"+this.field.string+"' must be a many2many field with a relation to 'ir.attachment' model."; + throw _.str.sprintf(_t("The type of the field '%s' must be a many2many field with a relation to 'ir.attachment' model."), this.field.string); } this.ds_file = new instance.web.DataSetSearch(this, 'ir.attachment'); this.fileupload_id = _.uniqueId('oe_fileupload_temp'); diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 13c41d48599..5008d1765a6 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -389,7 +389,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi if (range_stop > total) { range_stop = total; } - spager = _.str.sprintf('%d-%d of %d', range_start, range_stop, total); + spager = _.str.sprintf(_t("%d-%d of %d"), range_start, range_stop, total); } this.$pager.find('.oe_list_pager_state').text(spager); @@ -887,8 +887,8 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web. var $row; if (attribute === 'id') { if (old_value) { - throw new Error("Setting 'id' attribute on existing record " - + JSON.stringify(record.attributes)); + throw new Error(_.str.sprintf( _t("Setting 'id' attribute on existing record %s"), + JSON.stringify(record.attributes) )); } if (!_.contains(self.dataset.ids, value)) { // add record to dataset if not already in (added by @@ -956,7 +956,7 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web. if (row_id) { e.stopPropagation(); if (!self.dataset.select_id(row_id)) { - throw new Error("Could not find id in dataset"); + throw new Error(_t("Could not find id in dataset")); } self.row_clicked(e); } @@ -1016,7 +1016,7 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web. var command = value[0]; // 1. an array of m2m commands (usually (6, false, ids)) if (command[0] !== 6) { - throw new Error(_t("Unknown m2m command ") + command[0]); + throw new Error(_.str.sprintf( _t("Unknown m2m command %s"), command[0])); } ids = command[2]; } else { @@ -1324,7 +1324,7 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we } // group_label is html-clean (through format or explicit // escaping if format failed), can inject straight into HTML - $group_column.html(_.str.sprintf("%s (%d)", + $group_column.html(_.str.sprintf(_t("%s (%d)"), group_label, group.length)); if (group.length && group.openable) { @@ -1743,7 +1743,7 @@ var Record = instance.web.Class.extend(/** @lends Record# */{ } else if (val instanceof Array) { output[k] = val[0]; } else { - throw new Error("Can't convert value " + val + " to context"); + throw new Error(_.str.sprintf(_t("Can't convert value %s to context"), val)); } } return output; diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index 7fe6a8ec42b..e3f35e2068c 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -3,7 +3,9 @@ * @namespace */ openerp.web.list_editable = function (instance) { - // editability status of list rows + var _t = instance.web._t; + + // editability status of list rows instance.web.ListView.prototype.defaults.editable = null; // TODO: not sure second @lends on existing item is correct, to check @@ -775,7 +777,7 @@ openerp.web.list_editable = function (instance) { cancel: function (force) { if (!(force || this.form.can_be_discarded())) { return $.Deferred().reject({ - message: "The form's data can not be discarded"}).promise(); + message: _t("The form's data can not be discarded")}).promise(); } var record = this.record; this.record = null; diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index ddedcdd2ff6..600a0b065c1 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -786,7 +786,7 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({ break; case 'tests': this.do_action({ - name: "JS Tests", + name: _t("JS Tests"), target: 'new', type : 'ir.actions.act_url', url: '/web/tests?mod=*' @@ -814,7 +814,7 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({ break; case 'translate': this.do_action({ - name: "Technical Translation", + name: _t("Technical Translation"), res_model : 'ir.translation', domain : [['type', '!=', 'object'], '|', ['name', '=', this.dataset.model], ['name', 'ilike', this.dataset.model + ',']], views: [[false, 'list'], [false, 'form']], @@ -1395,7 +1395,7 @@ instance.web.json_node_to_xml = function(node, human_readable, indent) { return sindent + node; } else if (typeof(node.tag) !== 'string' || !node.children instanceof Array || !node.attrs instanceof Object) { throw new Error( - _.str.sprintf("Node [%s] is not a JSONified XML node", + _.str.sprintf(_t("Node [%s] is not a JSONified XML node"), JSON.stringify(node))); } for (var attr in node.attrs) { @@ -1429,7 +1429,7 @@ instance.web.xml_to_str = function(node) { } else if (window.ActiveXObject) { return node.xml; } else { - throw new Error("Could not serialize XML"); + throw new Error(_t("Could not serialize XML")); } }; instance.web.str_to_xml = function(s) { @@ -1437,7 +1437,7 @@ instance.web.str_to_xml = function(s) { var dp = new DOMParser(); var r = dp.parseFromString(s, "text/xml"); if (r.body && r.body.firstChild && r.body.firstChild.nodeName == 'parsererror') { - throw new Error("Could not parse string to xml"); + throw new Error(_t("Could not parse string to xml")); } return r; } @@ -1445,7 +1445,7 @@ instance.web.str_to_xml = function(s) { try { xDoc = new ActiveXObject("MSXML2.DOMDocument"); } catch (e) { - throw new Error("Could not find a DOM Parser: " + e.message); + throw new Error(_.str.sprintf( _t("Could not find a DOM Parser: %s"), e.message)); } xDoc.async = false; xDoc.preserveWhiteSpace = true; diff --git a/addons/web_calendar/static/src/js/calendar.js b/addons/web_calendar/static/src/js/calendar.js index 5fd9b6677a0..46d25e749a2 100644 --- a/addons/web_calendar/static/src/js/calendar.js +++ b/addons/web_calendar/static/src/js/calendar.js @@ -88,7 +88,7 @@ instance.web_calendar.CalendarView = instance.web.View.extend({ this.fields = this.fields_view.fields; if (!this.date_start) { - throw new Error("Calendar view has not defined 'date_start' attribute."); + throw new Error(_t("Calendar view has not defined 'date_start' attribute.")); } //* Calendar Fields * @@ -96,7 +96,7 @@ instance.web_calendar.CalendarView = instance.web.View.extend({ if (this.date_delay) { if (this.fields[this.date_delay].type != 'float') { - throw new Error("Calendar view has a 'date_delay' type != float"); + throw new Error(_t("Calendar view has a 'date_delay' type != float")); } this.calendar_fields.date_delay = {'name': this.date_delay, 'kind': this.fields[this.date_delay].type}; } diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index 4e9157e1d75..c93d7d333e4 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -409,7 +409,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ new_group.do_save_sequences(); }).fail(function(error, evt) { evt.preventDefault(); - alert("An error has occured while moving the record to this group."); + alert(_t("An error has occured while moving the record to this group.")); self.do_reload(); // TODO: use draggable + sortable in order to cancel the dragging when the rcp fails }); } diff --git a/addons/web_view_editor/static/src/js/view_editor.js b/addons/web_view_editor/static/src/js/view_editor.js index a844c0f3be8..6b70914f332 100644 --- a/addons/web_view_editor/static/src/js/view_editor.js +++ b/addons/web_view_editor/static/src/js/view_editor.js @@ -161,7 +161,7 @@ instance.web_view_editor.ViewEditor = instance.web.Widget.extend({ } }); msg += ""; - this.do_warn("The following fields are invalid :", msg); + this.do_warn(_t("The following fields are invalid :"), msg); }, add_node_name : function(node) { if(node.tagName.toLowerCase() == "button" || node.tagName.toLowerCase() == "field"){ @@ -260,7 +260,7 @@ instance.web_view_editor.ViewEditor = instance.web.Widget.extend({ "arch": view_arch_list}); }); } else { - self.do_warn("Please select view in list :"); + self.do_warn(_t("Please select view in list :")); } }); }, @@ -387,10 +387,10 @@ instance.web_view_editor.ViewEditor = instance.web.Widget.extend({ self.inherited_view(selected_row); } }else{ - alert("Can't Update View"); + alert(_t("Can't Update View")); } }else{ - alert("Select an element"); + alert(_t("Select an element")); } }}, {text: _t("Preview"), click: function() { @@ -983,7 +983,7 @@ instance.web_view_editor.ViewEditor = instance.web.Widget.extend({ } else { table_selector.append('' + node.string + '' + type_widget.render() ); if (node.name == "field_value") { - table_selector.append(' '); + table_selector.append(' '); } } type_widget.start();