views:

103

answers:

1

I want to retrieve the system language of a Macintosh in ISO-639-2 format (that is, in three character format).

Currently, I'm trying to use [NSUserdefault objectforkey:@"Applelanguages"]. This returns the Language code in 2 character format.

Whatever API I end up using, it should support MacOS X versions from 10.3.9 forward.

+1  A: 

The relevant sections of the document are Internationalization Guide, another section of the same guide, and CFLocale reference. Unfortunately I don't think there's a standard API provided which convert 639-1 to 639-2. As explained there, OS X uses a mixture of both, and the canonical form used by the OS can be obtained by CFLocaleCreateCanonicalLanguageIdentifierFromString. But this is not what you want, unfortunately.

I would suggest you to process the table given here into an NSDictionary yourself.

Yuji