Skip to content

Provide a way to make attribute values translatable in a declarative way

Background

We're still using quite a primitive way to assign translatable strings to elements by requiring them to have their first class name start with "i18n_". This is not only difficult to parse but can easily cause issues when using multiple classes for the same element. Furthermore, this doesn't allow us to declaratively assign strings to user-facing attributes such as "alt" and "title".

The intention of this is ticket is to provide a solution for use-cases which the current implementation doesn't cover until we replace it with a more integrated solution. Other suggestions are more than welcome.

What to change

  • Deprecate class="i18n_NAME" syntax.
  • Introduce data-i18n="NAME" syntax for inner text and data-i18n-{alt,title,...}="NAME" for texts for the respective attributes.

Suggested changes

  • Deprecate class="i18n_NAME" syntax.
  • Introduce data-i18n-based syntax:
    • Suggestion A: Use data-i18n="NAME" for inner text and data-i18n-{alt,title}="NAME" for texts for the respective attributes.
    • Suggestion B: Use data-i18n="NAME ATTR1=NAME1 ATTR2=NAME2" to define all texts within the same attribute.
Edited by Thomas Greiner
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information