It is my understanding that iOS uses ICU under the hood. I'd like to access the functionality of ICU's MessageFormat for strings involving numbers and plurals, for example,
There {0,choice,0#are no files|1#is one file|1<are {0,number,integer} files}.
Does iOS expose this capability? If so how do I use it? I thought I might be able to write
[NSString stringWithFormat: "There {0,choice,0#are no files|1#is one file|1<are {0,number,integer} files}.", n];
or
[NSString stringWithFormat: "There {0,plural, =0{are no files}=1{is one file}other{are %ld files}}.", n];
But these formats (ICU4J and ICU, respectively) do not work.
iOS, like OS X, does include /usr/lib/libicucore.dylib. However, it's not a supported public API on either OS. See this old message for an explanation of how to use it on OS X, and what are the potential issues.
On iOS, I guess there is the additional issue that Apple might reject your application for using unsupported APIs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With