[IMP] *: unify sprintf and gettext
Improve gettext to directly handle value injection within translations, removing the need for sprintf. closes odoo/odoo#123932 Related: odoo/enterprise#45370 Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
import PortalChatter from '@portal/js/portal_chatter';
|
||||
import { sprintf } from '@web/core/utils/strings';
|
||||
|
||||
/**
|
||||
* PortalChatter
|
||||
@@ -19,7 +18,7 @@ PortalChatter.include({
|
||||
_reloadChatterContent: async function (data) {
|
||||
await this._super(...arguments);
|
||||
if (this.options.res_model === "slide.channel") {
|
||||
$('#review-tab').text(sprintf(_t('Reviews (%s)'), data.rating_count));
|
||||
$('#review-tab').text(_t('Reviews (%s)', data.rating_count));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { uniqueId } from '@web/core/utils/functions';
|
||||
import { sprintf } from '@web/core/utils/strings';
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
import Dialog from '@web/legacy/js/core/dialog';
|
||||
import publicWidget from '@web/legacy/js/public/public_widget';
|
||||
@@ -121,7 +120,7 @@ var TagCourseDialog = Dialog.extend({
|
||||
id: uniqueId("tag_"),
|
||||
create: true,
|
||||
tag: term,
|
||||
text: sprintf(_t("Create new %s '%s'"), tag, term),
|
||||
text: _t("Create new %s '%s'", tag, term),
|
||||
};
|
||||
} else {
|
||||
return undefined;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { uniqueId } from '@web/core/utils/functions';
|
||||
import { sprintf } from '@web/core/utils/strings';
|
||||
import {_t, qweb as QWeb} from "@web/legacy/js/services/core";
|
||||
import Dialog from '@web/legacy/js/core/dialog';
|
||||
import publicWidget from '@web/legacy/js/public/public_widget';
|
||||
@@ -312,7 +311,7 @@ var SlideUploadDialog = Dialog.extend({
|
||||
id: uniqueId("tag_"),
|
||||
create: true,
|
||||
tag: term,
|
||||
text: sprintf(_t("Create new %s '%s'"), tag, term),
|
||||
text: _t("Create new %s '%s'", tag, term),
|
||||
};
|
||||
} else {
|
||||
return undefined;
|
||||
@@ -661,23 +660,23 @@ var SlideUploadDialog = Dialog.extend({
|
||||
this.set('state', '_import');
|
||||
if (this.modulesToInstallStatus.installing) {
|
||||
this.$('#o_wslides_install_module_text')
|
||||
.text(sprintf(_t('Already installing "%s".'), this.modulesToInstallStatus.name));
|
||||
.text(_t('Already installing "%s".', this.modulesToInstallStatus.name));
|
||||
} else if (this.modulesToInstallStatus.failed) {
|
||||
this.$('#o_wslides_install_module_text')
|
||||
.text(sprintf(_t('Failed to install "%s".'), this.modulesToInstallStatus.name));
|
||||
.text(_t('Failed to install "%s".', this.modulesToInstallStatus.name));
|
||||
}
|
||||
} else {
|
||||
this.modulesToInstallStatus = Object.assign({}, this.modulesToInstall.find( function (item) { return item.id === moduleId; }));
|
||||
this.set('state', '_import');
|
||||
this.$('#o_wslides_install_module_text')
|
||||
.text(sprintf(_t('Do you want to install the "%s" app?'), this.modulesToInstallStatus.name));
|
||||
.text(_t('Do you want to install the "%s" app?', this.modulesToInstallStatus.name));
|
||||
}
|
||||
},
|
||||
|
||||
_onClickInstallModuleConfirm: function () {
|
||||
var self = this;
|
||||
var $el = this.$('#o_wslides_install_module_text');
|
||||
$el.text(sprintf(_t('Installing "%s".'), this.modulesToInstallStatus.name));
|
||||
$el.text(_t('Installing "%s".', this.modulesToInstallStatus.name));
|
||||
this.modulesToInstallStatus.installing = true;
|
||||
this._resetModalButton();
|
||||
this._rpc({
|
||||
@@ -692,7 +691,7 @@ var SlideUploadDialog = Dialog.extend({
|
||||
}
|
||||
window.location.href = redirectUrl;
|
||||
}, function () {
|
||||
$el.text(sprintf(_t('Failed to install "%s".'), self.modulesToInstallStatus.name));
|
||||
$el.text(_t('Failed to install "%s".', self.modulesToInstallStatus.name));
|
||||
self.modulesToInstallStatus.installing = false;
|
||||
self.modulesToInstallStatus.failed = true;
|
||||
self._resetModalButton();
|
||||
|
||||
Reference in New Issue
Block a user