• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSLocalizedString and plural forms
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSLocalizedString and plural forms


  • Subject: NSLocalizedString and plural forms
  • From: Andrey Subbotin <email@hidden>
  • Date: Fri, 19 Oct 2007 01:46:46 +0400

Hello all,

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:

- 1 fail skopirovalsya.
- 2 faila skopirovalis'.
- 5 failov skopirovalos'.

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

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSLocalizedString and plural forms
      • From: Ricky Sharp <email@hidden>
  • Prev by Date: predicate with NSDates
  • Next by Date: Re: NSLocalizedString and plural forms
  • Previous by thread: Re: predicate with NSDates
  • Next by thread: Re: NSLocalizedString and plural forms
  • Index(es):
    • Date
    • Thread