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
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);
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:
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
The text was updated successfully, but these errors were encountered: