From cc541f9935b944ba4d27c3901aecf3fc7d49ef43 Mon Sep 17 00:00:00 2001 From: "Louis Wicket (wil)" Date: Tue, 16 Apr 2024 15:32:51 +0200 Subject: [PATCH] [FIX] tools: properly export all translated attributes Prior to this commit, some attributes such as "data-tooltip" were not exported in /static/src/ templates, while "label" was only exported in them. This commit adjusts the code to use the same list of translated attributes everywhere, fixing the problem and making it less likely to happen again. Task-3872895 closes odoo/odoo#162250 X-original-commit: 6c272a432cea29fa98d9f2a3e4f454214099f3e6 Signed-off-by: Louis Wicket (wil) --- odoo/tools/translate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/odoo/tools/translate.py b/odoo/tools/translate.py index eea2ce0f5bd..bb7cdb42727 100644 --- a/odoo/tools/translate.py +++ b/odoo/tools/translate.py @@ -157,7 +157,7 @@ TRANSLATED_ELEMENTS = { TRANSLATED_ATTRS = dict.fromkeys({ 'string', 'add-label', 'help', 'sum', 'avg', 'confirm', 'placeholder', 'alt', 'title', 'aria-label', 'aria-keyshortcuts', 'aria-placeholder', 'aria-roledescription', 'aria-valuetext', - 'value_label', 'data-tooltip', 'data-editor-message', + 'value_label', 'data-tooltip', 'data-editor-message', 'label', }, lambda e: True) def translate_attrib_value(node): @@ -944,7 +944,7 @@ def _extract_translatable_qweb_terms(element, callback): # https://www.w3schools.com/html/html5_syntax.asp # https://github.com/odoo/owl/blob/master/doc/reference/component.md#composition if not el.tag[0].isupper() and 't-component' not in el.attrib and 't-set-slot' not in el.attrib: - for att in ('title', 'alt', 'label', 'placeholder', 'aria-label'): + for att in TRANSLATED_ATTRS: if att in el.attrib: _push(callback, el.attrib[att], el.sourceline) _extract_translatable_qweb_terms(el, callback)