From 842845bf4684e417c8740ab2a14220767b573469 Mon Sep 17 00:00:00 2001 From: bbh-odoo Date: Thu, 27 May 2021 13:38:27 +0000 Subject: [PATCH] [IMP] project,web: update the translation for some terms It seems some terms are no translatable so purpose of the task is to find those terms ans update to make them translatable. So in this commit, translate the text attribute when the node is field tag and this node contains widget='url' in its attributes. and also make the project name as translatable. closes odoo/odoo#71406 Taskid: 2487710 Signed-off-by: LTU-Odoo Co-authored-by: xavierbol --- addons/project/models/project.py | 2 +- .../legacy/js/views/kanban/kanban_column_quick_create.js | 2 +- odoo/tools/translate.py | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/project/models/project.py b/addons/project/models/project.py index 4c4d38eaee5..24ab24461da 100644 --- a/addons/project/models/project.py +++ b/addons/project/models/project.py @@ -167,7 +167,7 @@ class Project(models.Model): def _get_default_favorite_user_ids(self): return [(6, 0, [self.env.uid])] - name = fields.Char("Name", index=True, required=True, tracking=True) + name = fields.Char("Name", index=True, required=True, tracking=True, translate=True) description = fields.Html() active = fields.Boolean(default=True, help="If the active field is set to False, it will allow you to hide the project without removing it.") diff --git a/addons/web/static/src/legacy/js/views/kanban/kanban_column_quick_create.js b/addons/web/static/src/legacy/js/views/kanban/kanban_column_quick_create.js index 928f80ab60f..e9262d146b0 100644 --- a/addons/web/static/src/legacy/js/views/kanban/kanban_column_quick_create.js +++ b/addons/web/static/src/legacy/js/views/kanban/kanban_column_quick_create.js @@ -201,7 +201,7 @@ var ColumnQuickCreate = Widget.extend({ text: _t('Close'), }], size: "large", - title: "Kanban Examples", + title: _t("Kanban Examples"), }).open(); dialog.on('closed', this, function () { self.$input.focus(); diff --git a/odoo/tools/translate.py b/odoo/tools/translate.py index fe019442d11..18b90fd38bc 100644 --- a/odoo/tools/translate.py +++ b/odoo/tools/translate.py @@ -151,9 +151,11 @@ TRANSLATED_ATTRS = dict.fromkeys({ 'aria-keyshortcuts', 'aria-placeholder', 'aria-roledescription', 'aria-valuetext', 'value_label', }, lambda e: True) -TRANSLATED_ATTRS['value'] = lambda e: (e.tag == 'input' and e.attrib.get('type', 'text') == 'text') and 'datetimepicker-input' not in e.attrib['class'].split(' ') - -TRANSLATED_ATTRS.update({f't-attf-{attr}': cond for attr, cond in TRANSLATED_ATTRS.items()}) +TRANSLATED_ATTRS.update( + value=lambda e: (e.tag == 'input' and e.attrib.get('type', 'text') == 'text') and 'datetimepicker-input' not in e.attrib['class'].split(' '), + text=lambda e: (e.tag == 'field' and e.attrib.get('widget', '') == 'url'), + **{f't-attf-{attr}': cond for attr, cond in TRANSLATED_ATTRS.items()}, +) avoid_pattern = re.compile(r"\s*]*>(.*)", re.DOTALL | re.MULTILINE | re.UNICODE)