Open marijnvdwerf opened 2 years ago
Found out that (simplified) trans_choice(":count messages", 2) throws an error, while Laravel itself is fine with it. Did a bit of digging, and found that there's various cases where I18n.js behaves differently from the framework.
trans_choice(":count messages", 2)
Testcases: https://jsbin.com/ruzaceyawo/edit?js,output Laravel Framework testcase: https://github.com/laravel/framework/blob/9.x/tests/Translation/TranslationMessageSelectorTest.php
Another (seperate) issue is the "default pluralisation" rules are based on the en locale. Others can have more entries, and different rules.
en
E.g.
public function getPluralIndex($locale, $number) // ... case 'uk': return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); // ... }
Hi, thanks for the report!
Yes I see. I'm not sure I could fix this quickly.
Are you planning to make a PR? We could start with one language and then we could extend it.
What do you think?
Thanks!
Found out that (simplified)
trans_choice(":count messages", 2)
throws an error, while Laravel itself is fine with it. Did a bit of digging, and found that there's various cases where I18n.js behaves differently from the framework.Testcases: https://jsbin.com/ruzaceyawo/edit?js,output Laravel Framework testcase: https://github.com/laravel/framework/blob/9.x/tests/Translation/TranslationMessageSelectorTest.php
Another (seperate) issue is the "default pluralisation" rules are based on the
en
locale. Others can have more entries, and different rules.E.g.