MetaMask / metamask-extension

:globe_with_meridians: :electric_plug: The MetaMask browser extension enables browsing Ethereum blockchain enabled websites
https://metamask.io
Other
12.08k stars 4.94k forks source link

Translation named substitutions #25906

Open Gudahtt opened 4 months ago

Gudahtt commented 4 months ago

What is this about?

Our localized messages use numeric substitutions (e.g. in the message Click $1 to see more, the $1 is a substitution). These have a few problems:

We should update our translation substitution system to use named, clearly delimited substations. We can use any alphanumeric string for the substitution name, and we can use ${ } as a delimiter. For example, in Click ${seeMoreLink} to see more, the substitution would be called seeMoreLink.

This would also prevent errors caused by a lack of spaces after the substitution, because the `${} delimiter is totally unambiguous about where the substitution name ends.

This also makes our translations more similar to mobile (they use named substitutions as well, though without the curly bracket delimiters).

Scenario

No response

Design

No response

Technical Details

We could consider adding support for named parameters alongside positional parameters, so that we can gradually introduce them.

Threat Modeling Framework

No response

Acceptance Criteria

Stakeholder review needed before the work gets merged

References

No response

i18nlaurel commented 4 months ago

Thanks for calling this out @Gudahtt! The linguists are often confused about this convention, especially because in some languages nouns are gendered and it's difficult for them to accurately translate for these numeric placeholders.