Jesway / flutter_translate

Flutter Translate is a fully featured localization / internationalization (i18n) library for Flutter.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for more plural formats

SredzinskiPatryk opened this issue · comments

In many languages you have different forms of words depending on number of items.

Currently flutter_translate does only support:
"0"
"1"
"else"

can you please add other forms of plurals: "many", "few" etc?

for example:
in English you'd say:
0 departments, 1 department, 2+ departments

but in Polish you'd say:
0 działów, 1 dział, 2-4 działy, 5 działów, 11 działów, 12 działów, 13 działów, 22 działy

So you have different versions for 2-4, 22-24, 32-34, 42-44 and so on (yeah weird)
But such cases are in many other languages as well

Native flutter supports all these: https://api.flutter.dev/flutter/intl/Intl/plural.html

https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_and_Plurals

@SredzinskiPatryk I forked flutter_translate and flutter_translate_gen and modified plurals to work like native Intl. Actually I used native Intl inside.
@bratan Yo, man. Your translate tool is really great! Please take a look at my forks to take my changes to your repos. I really don't want to support my forks )))

https://github.com/vladimirandroid/flutter_translate_gen
https://github.com/vladimirandroid/flutter_translate

@SredzinskiPatryk to make my forks work you can use git dependencies:
https://flutter.dev/docs/development/packages-and-plugins/using-packages#dependencies-on-unpublished-packages

BUT!!! It is better to copy all the code to your project and use path dependencies. I'm not sure that I let my forks live )

@vladimirandroid could you please make PR for this?

@bratan if #79 PR is acceptable I can also check @vladimirandroid changes for flutter_translate_gen plugin. Thanks.