[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) <wil@odoo.com>
This commit is contained in:
Louis Wicket (wil)
2024-04-18 15:05:29 +00:00
parent 3118782cd8
commit cc541f9935
+2 -2
View File
@@ -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)