Re: natural languages
Re: natural languages
- Subject: Re: natural languages
- From: Dave Thorup <email@hidden>
- Date: Thu, 24 Apr 2003 15:54:51 -0600
On 4/24/03 9:48 AM, "Devon E Bowen" <email@hidden> wrote:
>
I need to get access to the list of the user's preferred languages. I
>
call an xml-rpc service and want to pass along the language list in
>
case the server needs to return an error message. Then it can know what
>
language to use for this message. So, for example, I might send "en,
>
de, fr". Is there any way I can ask the Cocoa app for this information?
>
Everything I know about the internationalization classes seems to
>
imply that this info is abstracted away and not available to me directly.
>
Any pointers would be appreciated.
You can get this list as an NSArray from the NSGlobalDomain in User
Defaults:
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
NSDictionary* globalDomain;
NSArray* languages;
globalDomain = [defaults persistentDomainForName:@"NSGlobalDomain"];
languages = [globalDomain objectForKey:@"AppleLanguages"];
You may also be able to do just this (though I haven't tested it):
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
NSArray* languages;
languages = [defaults arrayForKey:@"AppleLanguages"];
'languages' will contain an array of the user's preferred languages in order
of preference.
I hope this helps!
____________________________________
Dave Thorup
Software Engineer
email@hidden
voice: 801-805-9422
www.corda.com
Interactive data driven graphics.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.