Skip to content

Commit

Permalink
[FIX] tools: properly export all translated attributes
Browse files Browse the repository at this point in the history
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#162250

X-original-commit: 6c272a4
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
  • Loading branch information
oomsveta committed Apr 18, 2024
1 parent 3118782 commit cc541f9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions odoo/tools/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def encode(s):
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):
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit cc541f9

Please sign in to comment.