willdurand / BazingaJsTranslationBundle

A pretty nice way to expose your Symfony translation messages to your client applications.
MIT License
572 stars 178 forks source link

New form of french pluralization #334

Open nkampa opened 2 years ago

nkampa commented 2 years ago

Reference: https://unicode-org.github.io/cldr-staging/charts/38/supplemental/language_plural_rules.html#rules

We’re making the change to accommodate the “new” plural form for French. The form itself isn’t new to the language, it just hasn’t been used on the Internet until recently. The Unicode Consortium (the organization which sets standards for software internationalization) made the change in the rules and recommends supporting this added plural form.

<source>{0} 0 days|{1} 1 day|]1,Inf] %1$s% days</source>
<target state="final">%1$s% jour| %1$s% de jours| %1$s% jours</target>

The second form de is only for numbers above 1000000.

It does not appear to be supported in the latest versions of this library.

For the javascript library it looks like if we were to add return number % 1000000 === 0 ? 1 : (number < 2 ? 0 : 2); to the French switch case https://github.com/willdurand/BazingaJsTranslationBundle/blob/d23f7ff6f1992adf80f859bfd39869682fb2c63b/Resources/js/translator.js#L552 it is handled correctly.

Are there plans to bring these rule changes into this library?