Jump to content

Formatting plural on Shapado and Open Street Map

I have found some documentation on using plural on CLDR. There it says that "There are two extra values that can be used with count attributes: 0 and 1. These are used for the explicit values, and may or may not be the same as the forms for "zero" and "one"." That appears to be potentially very useful. So in Bosnian Bs for example, could you have {{PLURAL|0=text|1=text|one=text|few=text|many=text|text}}? The category 'one' in Bosnian includes 1, 21, 31, 41, 51, 61... If so, then the problem outlined in this thread appears to me to go away.

In English messages I note that the examples above include the category 'zero' even though English doesn't have a category 'zero'. Shouldn't the messages have '0' instead of 'zero'?

Lloffiwr (talk)16:52, 3 March 2012

> Shouldn't the messages have '0' instead of 'zero'?

No.

Siebrand17:22, 3 March 2012

> You should always use all n forms if your language has n forms. No more, no less.

If an English message uses 'zero' do all languages have to use 'zero', regardless of whether 'zero' is defined for their language or not?

Lloffiwr (talk)17:01, 10 March 2012

I really don't know. I have no knowledge of the inner workings of rails i18n.

Siebrand23:16, 10 March 2012
 

All languages support a key of 'zero' which is handled outside of the language specific pluralizers as seen here:

https://github.com/svenfuchs/i18n/blob/master/lib/i18n/backend/pluralization.rb#L34

So if the value is 0 and a key of "zero" exists then it is used, otherwise the language specific pluralizer is called.

TomH (talk)22:49, 19 March 2012

And so, if an English message uses 'zero', do all the translations have to use 'zero', even if they don't actually need it?

Lloffiwr (talk)22:53, 19 March 2012

Not at all - if there is no "zero" key for a given language then that languages normal pluralization rules are used to select a key.

TomH (talk)00:27, 20 March 2012

Thanks for setting me straight.

Lloffiwr (talk)08:22, 20 March 2012