Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Currently used locale




On Oct 29, 2005, at 1:51 AM, Stefan Fisk wrote:

I'm writing an external script with locale support that needs to use the same locale as the application that is calling it, because the output of the script will be used in the interface. My only problem is that I can't find any good way to get the applications currently used locale. The closest I get is [[NSBundle mainBundle] preferredLocalizations], but since that returns an array i don't know which one to choose.


The reason why this returns an array is that in some cases NSBundle will take localized resources from more than one localization. For example, if the user prefers en_US and the bundle contains both en_US and en, then NSBundle will take localized resources preferentially from en_US but will fall back to en if necessary. In that case the returned array would be (en_US, en). If you want the single most preferred localization, use the first element of this array.


Douglas Davidson

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Currently used locale (From: Stefan Fisk <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.