Re: Currently used locale
Re: Currently used locale
- Subject: Re: Currently used locale
- From: Douglas Davidson <email@hidden>
- Date: Mon, 31 Oct 2005 10:48:26 -0800
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:
This email sent to email@hidden