Skip to content
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

Plural improvements for Czech language. #42

Closed
marcglasberg opened this issue Jun 4, 2020 · 1 comment
Closed

Plural improvements for Czech language. #42

marcglasberg opened this issue Jun 4, 2020 · 1 comment

Comments

@marcglasberg
Copy link
Owner

Hello Marcelo,

First of all, thank you for making i18n_extension plugin - it has helped me a lot in my latest project and I will surely use it again in my next Flutter project - it is so easy to set up and use and the code boilerplate is indeed very minimal.

Let me suggest a simple addition to your code (although I have a Github account, I have never used a pull request to contribute to code and I do not want to break things).

For plurals you use:
/// Plural modifier for zero elements.
String zero(String text) => modifier("0", text);

/// Plural modifier for 1 element.
String one(String text) => modifier("1", text);

/// Plural modifier for 2 elements.
String two(String text) => modifier("2", text);

However, in Czech (my language) we use special word form also for amounts 3 and 4 (I am not sure if this applies to other languages as well). For amounts 5 and higher the form stays the same. Simply adding these two modifiers fixed this for me:

/// Plural modifier for 3 elements.
String three(String text) => modifier("3", text);

/// Plural modifier for 4 elements.
String four(String text) => modifier("4", text);
Example:

1 beer 1 pivo

2 beers 2 piva

3 beers 3 piva

4 beers 4 piva

5 beers 5 piv

6 beers 6 piv

7 ... 7 ...

The 'times' modifier can stay as is as most people would not care about 3 and 4 times as we Czechs do.

/// Plural modifier for any number of elements, except 0, 1 and 2.
String times(int numberOfTimes, String text) {
assert(numberOfTimes != null && (numberOfTimes < 0 || numberOfTimes > 2));
return modifier(numberOfTimes, text);
}

Please consider adding this to your code and thanks again for your excellent work.

Tomáš Jeřábek
Consultant/Developer

@marcglasberg
Copy link
Owner Author

Fixed for version 1.4.0:

  • For Czech language: twoThreeFour plural modifier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant