[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 <IT-Ideas@users.noreply.github.com>
Co-authored-by: xavierbol <xbo@odoo.com>
This commit is contained in:
bbh-odoo
2021-06-23 05:02:47 +00:00
committed by Barad Mahendra
co-authored by xavierbol
parent bc5e219c76
commit 842845bf46
3 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -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.")
@@ -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();
+5 -3
View File
@@ -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*<!DOCTYPE", re.IGNORECASE | re.MULTILINE | re.UNICODE)
node_pattern = re.compile(r"<[^>]*>(.*)</[^<]*>", re.DOTALL | re.MULTILINE | re.UNICODE)