Skip to content

Plural Support Missing 'Few' Case for Some Languages Like Arabic | Default Behavior of ignorePluralRules #729

@MAlazhariy

Description

@MAlazhariy

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: const MyApp(),
  );
);

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions