summaryrefslogtreecommitdiff
path: root/addons/web/static
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2016-06-27 12:03:45 +0200
committerMartin Trigaux <mat@odoo.com>2016-06-27 12:05:36 +0200
commit5abcbf0eb2a8618106752e46f9e0db2d42580f49 (patch)
treef804e4539d8ab70ad95d2898b99461607be04dbc /addons/web/static
parent0fa052cc1ee1803b355388fd3e531ea70dbc9e59 (diff)
[FIX] js: translations and string substitutions
_('foo '+bar) does not work as `bar` is a variable with undefinied content during translation export (and variable content during evaluation) so a match will not be found. Also trailing spaces are stripped during synchronisation with transifex. The proper syntax would be _.str.sprintf(_t("foo %s"), bar) but to avoid breaking existing translations (need to reexport .pot) use the syntax _("foo ") + " " + bar that is more stable friendly. The 'No value found for the field...' string is not possible to be fixed without breaking the translations should be split at least twice. Write it the propre way directly.
Diffstat (limited to 'addons/web/static')
-rw-r--r--addons/web/static/src/js/framework/pyeval.js2
-rw-r--r--addons/web/static/src/js/views/form_relational_widgets.js3
2 files changed, 3 insertions, 2 deletions
diff --git a/addons/web/static/src/js/framework/pyeval.js b/addons/web/static/src/js/framework/pyeval.js
index 2b553d37e0f..d0708bdf356 100644
--- a/addons/web/static/src/js/framework/pyeval.js
+++ b/addons/web/static/src/js/framework/pyeval.js
@@ -958,7 +958,7 @@ function eval_arg (arg) {
case 'context': case 'compound_context':
return pyeval('contexts', [arg]);
default:
- throw new Error(_t("Unknown nonliteral type " + arg.__ref));
+ throw new Error(_t("Unknown nonliteral type ") + ' ' + arg.__ref);
}
}
diff --git a/addons/web/static/src/js/views/form_relational_widgets.js b/addons/web/static/src/js/views/form_relational_widgets.js
index f1c6e0b36b1..beba85ac512 100644
--- a/addons/web/static/src/js/views/form_relational_widgets.js
+++ b/addons/web/static/src/js/views/form_relational_widgets.js
@@ -325,7 +325,8 @@ var FieldMany2One = common.AbstractField.extend(common.CompletionFieldMixin, com
var dataset = new data.DataSetStatic(this, this.field.relation, self.build_context());
var def = this.alive(dataset.name_get([self.get("value")])).done(function(data) {
if (!data[0]) {
- self.do_warn(_t("Render"), _t("No value found for the field "+self.field.string+" for value "+self.get("value")));
+ self.do_warn(_t("Render"),
+ _.str.sprintf(_t("No value found for the field %s for value %s"), self.field.string, self.get("value")));
return;
}
self.display_value["" + self.get("value")] = data[0][1];