-
Notifications
You must be signed in to change notification settings - Fork 214
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
BREAKING: Removing i18next-icu #799
Conversation
Size Change: -353 kB (-11%) 👏 Total Size: 2.83 MB
ℹ️ View Unchanged
|
Hey Vineet, could you clear up the PR description and the title some more? |
@vasharma05 I've re-written the description. Please feel free to change it, though. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
<Trans i18nKey="emptyStateText" values={{ displayText: displayText }}> | ||
There are no {displayText} to display | ||
</Trans> | ||
{t("emptyStateText", "There are no {{displayText}} to display", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a general rule, I'd probably actually favour the <Trans />
component where its used like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, the {{displayText}}
was getting changed to {{ displayText }}
by prettier, hence I made the change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes perfect sense!
Sorry @ibacher, I think I overrided your description with mine, you submitted before me and I didn't see that as I was also writing at the same time and my submission became the final submission (GH description race condition 🤣 ) @denniskigen please feel free to ask any doubts. |
I am creating PRs in another repos as well, we'll merge them altogether. |
Requirements
For changes to apps
If applicable
Summary
This PR remove the
i18next-icu
to be used in the i18next initialization because it is supported till i18next'sv19
. Hence the pluralization translations weren't working in the application.Basically
i18next-icu
was helping us to use{
in the variables instead of{{
. The{{
interpolation is what i18next's default configuration.(@jayasanka-sack I finally got the answer to why we were using
{
instead of{{
)Detailed Explaination
i18next-icu
uses the Intl Message Format. If we look into the i18next-icu's description here, it says:For pluralization, i18next uses the Intl.PluralRules, which is a browser API. As said above, the i18next-icu overrides the i18next plural API with the Intl message formatter's rules and you can have a look at the Intl message formatter's plural support here, which is very different than the
Intl.PluralRules
.So what was happening is that the translations for keys
key_one
orkey_other
wasn't working fort('key', {count: 2})
, because the it wasn't finding the exact key, and as mentioned above, the ICU message formatter is different than the Intl.PluralRules, hence the no proper working for i18next pluralization.Screenshots
None
Related Issue
None
Other