• 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
Re: natural languages
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: natural languages
      • From: Douglas Davidson <email@hidden>
References: 
 >natural languages (From: Devon E Bowen <email@hidden>)

  • Prev by Date: Re: NSSavePanel and setting extensions...
  • Next by Date: Re: NSSavePanel and setting extensions...
  • Previous by thread: Re: natural languages
  • Next by thread: Re: natural languages
  • Index(es):
    • Date
    • Thread