这是indexloc提供的服务,不要输入任何密码
Skip to content

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

@ilyaspiridonov

Description

@ilyaspiridonov

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.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions