Smartling / ios-i18n

The ios-i18n library provides seamless integration of plurals into iOS 6 apps.
http://www.smartling.com
Apache License 2.0
205 stars 41 forks source link

special plural message for zero in English #10

Closed timle8n1 closed 10 years ago

timle8n1 commented 10 years ago

http://cldr.unicode.org/index/cldr-spec/plural-rules

States The minimal pairs are those that are required for correct grammar. So because 0 and 1 don't have to form a minimal pair (it is ok—even though often not optimal—to say "0 people") , 0 doesn't establish a separate category. However, implementations are encouraged to provide the ability to have special plural messages for 0 in particular, so that more natural language can be used:

None of your friends are online. rather than You have 0 friends online.

Is this possible with the Smartling library and if so how?

paiv commented 10 years ago

Hi @timle8n1 , This is not supported with the library. This is kind of "optional" rule, that should trigger if corresponding translation is present. For iOS 7 and up see Localized Property List File https://developer.apple.com/library/ios/releasenotes/Foundation/RN-Foundation/ which supports this feature.

chelya commented 10 years ago

@timle8n1

We follow strict cldr. English only has two plural forms (one, other): http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html

timle8n1 commented 10 years ago

Yes English should only have two plural forms but the CLDR themselves encourage the ability to do this. Otherwise I have to write code that reads

if (count ==0) { //specific zero message } else { //normal message with plural support } but that breaks when a language has zero in the grammar.

http://cldr.unicode.org/index/cldr-spec/plural-rules "The minimal pairs are those that are required for correct grammar. So because 0 and 1 don't have to form a minimal pair (it is ok—even though often not optimal—to say "0 people") , 0 doesn't establish a separate category. However, implementations are encouraged to provide the ability to have special plural messages for 0 in particular, so that more natural language can be used: None of your friends are online. rather than You have 0 friends online."

chelya commented 10 years ago

@timle8n1 - you are right - this is not ideal. On one hand this is not a requirement from purely linguistics standpoint, on the other hand it is a matter of consistency and convenience when developing applications.

We do have an ongoing discussion of this at Smartling and we are likely to implement it, we just need to figure out where it falls into on our roadmap.