Skip to content
Snippets Groups Projects
Commit e97ec328 authored by Julien Carion (juca)'s avatar Julien Carion (juca)
Browse files

[IMP] web: easier translation for many2one


This commit gathers the different parts of the content from the many2one
confirmation dialog into a single _t in order to facilitate the foreign
translations of the content

closes odoo/odoo#135294

Signed-off-by: default avatarAaron Bohy (aab) <aab@odoo.com>
parent b64f9bfe
Branches
Tags
No related merge requests found
......@@ -6,18 +6,28 @@ import { Dialog } from "@web/core/dialog/dialog";
import { _lt } from "@web/core/l10n/translation";
import { registry } from "@web/core/registry";
import { useChildRef, useOwnedDialogs, useService } from "@web/core/utils/hooks";
import { sprintf } from "@web/core/utils/strings";
import { escape, sprintf } from "@web/core/utils/strings";
import { Many2XAutocomplete, useOpenMany2XRecord } from "@web/views/fields/relational_utils";
import * as BarcodeScanner from "@web/webclient/barcode/barcode_scanner";
import { standardFieldProps } from "../standard_field_props";
import { Component, onWillUpdateProps, useState } from "@odoo/owl";
import { Component, onWillUpdateProps, useState, markup } from "@odoo/owl";
class CreateConfirmationDialog extends Component {
get title() {
return sprintf(this.env._t("New: %s"), this.props.name);
}
get dialogContent() {
return markup(
sprintf(
this.env._t("Create <strong>%s</strong> as a new %s?"),
escape(this.props.value),
escape(this.props.name)
)
);
}
async onCreate() {
await this.props.create();
this.props.close();
......
......@@ -4,7 +4,7 @@
<t t-name="web.Many2OneField.CreateConfirmationDialog" owl="1">
<Dialog title="title" size="'md'">
<div>
Create <strong t-esc="props.value"/> as a new <t t-esc="props.name"/>?
<t t-out="dialogContent"/>
</div>
<t t-set-slot="footer">
<button class="btn btn-primary" t-on-click="onCreate">Create</button>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment