I am getting started learning iOS Stringsdict files and found some existing code on a project which used the following syntax:
<key>zero</key>
<string>You no message.</string>
As per the CLDR, zero
is an invalid plural in English and we expect to use explicit plural rules (=0
when using ICU MessageFormat)
I tried to find how to use explicit plural rules in iOS Stringsdict files and could not find any way to achieve this. Can someone confirm if this is supported or not?
Example of solutions (I cannot test them but maybe someone can?)
<key>0</key>
<string>You no message.</string>
Or
<key>=0</key>
<string>You no message.</string>
Extra reference on explicit plural rules part of the CLDR implementation of ICU MessageFormat:
https://formatjs.io/guides/message-syntax/#plural-format
=value This is used to match a specific value regardless of the plural categories of the current locale.
one
andother
. From my perspective, Stringsdict file is just Apple's custom implementation is ICU MessageFormat in terms of plural rules. In MessageFormat, there is a way to explicitly overwrite the categories with hard numbers to increase fluency (example in the question). See another example here: formatjs.io/guides/message-syntax/#plural-format. I could not find if it also supports explicit plural rules like the official syntax or if it just supports the rules defined in the CLDR. – Crissyzero
exactly what you're describing (i.e. "The format string to use for the number 0")? How is this different than "This is used to match a specific value regardless of the plural categories of the current locale" when the specific value is zero? When you say you can't test this, can you describe what behavior you would expect if the test were to pass vs fail? – Melissiamelita