• 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: Douglas Davidson <email@hidden>
  • Date: Thu, 24 Apr 2003 14:22:05 -0700

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.

It is abstracted away, since for one thing the localization parameters are not necessarily in this format. Here is one possible way to do this:

Construct a list of all the codes that you expect to be able to send (en, fr, de, etc.) as an NSArray *myArray.

Call [NSBundle preferredLocalizationsFromArray: myArray forPreferences:nil], and take the first element of the result. This will be the user's most preferred localization. Add it to your list. Remove it from myArray, then repeat the process to get the user's second most preferred localization. Repeat some fixed number of times.

If some of your codes are region-specific then you would need to put them in the form used by NSBundle (e.g. de_CH) in myArray, but in the form used by xml-rpc (probably de-ch) in your list. In that case you would need to decide whether to add both de-ch and de to your list--this gets a bit complicated.

Douglas Davidson
_______________________________________________
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.

References: 
 >Re: natural languages (From: Andreas Schempp <email@hidden>)

  • Prev by Date: Message.framework and user preferences
  • Next by Date: Global Access Controls ?
  • Previous by thread: Re: natural languages
  • Next by thread: Re: natural languages
  • Index(es):
    • Date
    • Thread