You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’ve encountered an issue with the plural functionality in easy_localization, which no longer supports the 'few' case for certain languages, including Arabic. This is critical because Arabic uses the 'few' case for numbers less than or equal to 10, while numbers from 11 and above use a different form (usually considered 'other').
After tracing the issue in the library, I found that the variable ignorePluralRules is set to a default value of true, which causes the library to ignore the pluralization rules for the language being used.
As a result, it defaults to the _pluralCaseFallback function, which only handles the following cases: ZERO, ONE, TWO, OTHER.
This means the pluralization rules won’t be applied unless the ignorePluralRules variable is explicitly set to false during package initialization. You can do this as follows:
runApp(
EasyLocalization(
supportedLocales: [Locale('en'), Locale('ar')],
path:'assets/translations',
fallbackLocale:Locale('en'),
ignorePluralRules:false, // Should be set to FALSE to apply the language’s plural rules
child:constMyApp(),
);
);
Unfortunately, this is not mentioned in the project’s README, and it has never been pointed out in the documentation.
I believe it makes more sense for the default value of ignorePluralRules to be set to false so that the language’s plural rules are not ignored by default. If users want to change this behavior, they can manually set it to true.
Required:
Set the default value of ignorePluralRules to false instead of true.
(Recommended) Add a note about this change in the README file.
Thanks!
The text was updated successfully, but these errors were encountered:
MAlazhariy
changed the title
Plural Support Missing 'Few' Case for some languages like Arabic
Plural Support Missing 'Few' Case for Some Languages Like Arabic | Default Behavior of ignorePluralRules
Nov 25, 2024
I’ve realized that most popular languages, such as English, don’t require the few and many plural cases, as they may rely on one and other.
Therefore, I kept the existing implementation unchanged in my PR #730.
In addition, I’ve added unit tests covering pluralization scenarios for three languages, including Arabic, to ensure proper behavior. I’ve also updated the README documentation to highlight the details regarding plural rules configuration.
I’ve encountered an issue with the
plural
functionality ineasy_localization
, which no longer supports the'few'
case for certain languages, including Arabic. This is critical because Arabic uses the'few'
case for numbers less than or equal to 10, while numbers from 11 and above use a different form (usually considered'other'
).After tracing the issue in the library, I found that the variable
ignorePluralRules
is set to a default value oftrue
, which causes the library to ignore the pluralization rules for the language being used.As a result, it defaults to the
_pluralCaseFallback
function, which only handles the following cases:ZERO, ONE, TWO, OTHER
.This means the pluralization rules won’t be applied unless the
ignorePluralRules
variable is explicitly set tofalse
during package initialization. You can do this as follows:Unfortunately, this is not mentioned in the project’s README, and it has never been pointed out in the documentation.
I believe it makes more sense for the default value of
ignorePluralRules
to be set tofalse
so that the language’s plural rules are not ignored by default. If users want to change this behavior, they can manually set it totrue
.Required:
ignorePluralRules
tofalse
instead oftrue
.Thanks!
The text was updated successfully, but these errors were encountered: