Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[i18n] Do not use concatenation in localizable UI strings #38060

Closed
ilyaspiridonov opened this issue Apr 11, 2022 · 0 comments · Fixed by #38122
Closed

[i18n] Do not use concatenation in localizable UI strings #38060

ilyaspiridonov opened this issue Apr 11, 2022 · 0 comments · Fixed by #38122

Comments

@ilyaspiridonov
Copy link
Contributor

ilyaspiridonov commented Apr 11, 2022

Update the reviews section to use this design pattern:
Screen Shot 2022-04-08 at 8 32 04 AM

This removes the complexity of pluralization and localization of the "reviews" string.

Context:
(Creating based on discussions here and here)

  1. In some languages translators may want/need to change the word order when translating UI labels, and when a text string is concatenated from 2 or more strings, this sometimes makes it impossible.

  2. Concatenation should also be avoided when dealing with variables (e.g. concatenating variable+text). Example:

86 reviews

In this case, if the string is generated as a result of the 'variable'+'text' concatenation, and only the text part is sent for translation, translators will not be able to change the word order (which is often required in some languages).
Instead, it is advisable to use the variable as part of the string, which will then be sent to translation as a whole:

"string": "$reviews_count$ reviews"

Ideally, concatenation should always be avoided in localization, as reversed word order is quite common in many languages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants