[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.
This commit is contained in:
@@ -1503,7 +1503,7 @@ msgstr ""
|
||||
#. openerp-web
|
||||
#: code:addons/web/static/src/js/views/form_relational_widgets.js:328
|
||||
#, python-format
|
||||
msgid "No value found for the field for value "
|
||||
msgid "No value found for the field %s for value %s"
|
||||
msgstr ""
|
||||
|
||||
#. module: web
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user