Make plurals fallback to those of locale fallback
See original GitHub issueIs your feature request related to a problem? Please describe. TLDR; Make plurals fallback to those of locale fallback.
We are migrating to Lingui for our preact web application.
We choosed @lingui/detect-locale
to detect the browser locale with fromNavigator
. But, we only have full support for english (en
) , spanish (es
) and portuguese (pt
). In any other case, we would like to fallback to en
locale, and use plurals rules for that locale too.
At .linguirc we set up the following, in order to accomplish this:
{
...,
"fallbackLocales": {
default: "en"
}
}
Now, when we a user with japanese (ja
) locale use the app, we get this error message in the console:
Plurals for locale ja aren't loaded. Use i18n.loadLocaleData method to load plurals for specific locale. Using other plural rule as a fallback.
And effectively “other plural” rule is always used.
Describe proposed solution This issue is related to https://github.com/lingui/js-lingui/issues/798. But that one was considered closed by falling back to the other plural rule always. I think it would be better, and more intuitive to fallback both locale and plural rules to the default fallback locale.
Additional context Other non so user-friendly experience with fallback locales that we have:
- If the user’s browser is en-US for instance, by default fallback to its CLDR parent locale
en
, but again the plurals rules do not fallback toen
plural rules.
Describe alternatives you’ve considered We ended up trimming the “country” specification from the browser locale before locale activation to avoid plural rules errors regarding CLDR parent locales. But of course this is not what we want to do with our i18n.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:5
Top GitHub Comments
…
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.