I've been looking eagerly through the Internationalization
Programming Topics at Apple's site and am kind of puzzled. The
problem I try to solve is providing a Russian language localization
for my project and I'm unable to find a way to properly localize
plural forms.
Say, we have the following three cases:
- 1 file has just been copied.
- 2 files have just been copied.
- 5 files have just been copied.
That is, in the English language there're only 2 forms. If all the
languages followed this pattern, then the code to localize it could
look like this:
if (x == 1) {
str = NSLocalizedString(@"%d file has just been copied.", nil);
} else {
str = NSLocalizedString(@"%d files have just been copied.", nil);
}
Then... in Russian there'd be more plural forms. The above three
lines would be:
The cases like this make it impossible to simply use the above two
NSLocalizedString keys to retrieve the proper translation.
The gettext library can handle these things well by providing a way
to specify the number of plural forms in its dictionary files (Please
see the following page where it all is described in greater details:
http://www.gnu.org/software/libc/manual/html_node/Advanced-gettext-
functions.html ). But even if I can use the gettext library in
Objective-C apps, gettext is no way Cocoa.
The question is: How do I properly localize plural forms using the
Cocoa APIs? Is it at all possible?
I'd gladly appreciate any hints, etc. Thanks in advance.
--
Andrey Subbotin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com