• 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: Determining preferred localizations
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Determining preferred localizations


  • Subject: Re: Determining preferred localizations
  • From: "Gary L. Wade" <email@hidden>
  • Date: Wed, 21 Apr 2010 08:25:39 -0700
  • Thread-topic: Determining preferred localizations

The list you are getting is a set of preferred localizations, so when trying
to get a resource from the first one, if not available, will go on to the
next one and so forth.

You should utilize the localization-aware methods to handle getting
resources rather than trying to manage this yourself.  There's really only
two reasons I've encountered a need for this kind of granularity, the first
where you're forced to use a set of legacy resources that you're unable to
move into the right places, and the second a localization utility.


On 04/21/2010 6:59 AM, "Gregory Weston" <email@hidden> wrote:

> I'm trying to display a localized list of attached displays, and getting
> unexpected results in Carbon and Cocoa when attempting to determine the best
> localization. I did all the obvious-to-me Google searches without finding much
> except a couple of other people over the years having similar issues and no
> real resolution. Sample code and results follow. Hoping someone can point me
> in the right direction.
>
> FWIW, I've tried both "en" and "English" for both the Info.plist development
> region and the localized resources folder in the app.
>
> Thanks for any help.
>
> Greg
>
> - (NSString*)bestLocalization:(NSArray*)inChoices
> {
>   NSUserDefaults* theDefaults = [NSUserDefaults standardUserDefaults];
>   NSArray* theUserSettings = [theDefaults objectForKey:@"AppleLanguages"];
>   NSLog(@"User Settings: %@", theUserSettings);
>
>   NSLog(@"Choices: %@", inChoices);
>
>   NSArray* theBestOnes = [NSBundle preferredLocalizationsFromArray:inChoices];
>   NSLog(@"Chose: %@", theBestOnes);
>
>   return [theBestOnes objectAtIndex:0];
> }
>
> Mac mini (Early 2009) 10.6.3 with Dell 2007WFP:
>
> User Settings: (English)
> Choices: ("en_US")
> Chose: ("en_US")
>
> MacBook Core 2 Duo 10.6.3:
>
> User Settings: (en, fr, ja, de, es, it, nl, sv, nb, da, fi, pt, "zh-Hans",
> "zh-Hant", ko, ru, pl, "pt-PT")
> Choices: ("nl_NL", "da_DK", "pl_PL", "en_US", "nb_NO", "fr_FR", "pt_BR",
> "pt_PT", "zh_CN", "es_ES", "ja_JP", "ru_RU", "sv_SE", "zh_TW", "de_DE",
> "fi_FI", "it_IT", "ko_KR")
> Chose: ("zh_CN")
>
> MacBook Pro 10.5.8 plus Apple Cinema Display:
>
> User Settings: (en, fr, ja, de, es, it, pt, "pt-PT", nl, sv, nb, da, fi, ru,
> pl, "zh-Hans", "zh-Hant", ko)
> Choices: ("it_IT", "en_US", "ko_KR", "fi_FI", "nb_NO", "ru_RU", "zh_CN",
> "nl_NL", "de_DE", "ja_JP", "pl_PL", "es_ES", "fr_FR", "zh_TW", "da_DK",
> "sv_SE", "pt_BR", "pt_PT")
> Chose: ("fr_FR")
> User Settings: (en, fr, ja, de, es, it, pt, "pt-PT", nl, sv, nb, da, fi, ru,
> pl, "zh-Hans", "zh-Hant", ko)
> Choices: ("it_IT", "en_US", "ko_KR", "fi_FI", "nb_NO", "ru_RU", "zh_CN",
> "nl_NL", "de_DE", "ja_JP", "pl_PL", "es_ES", "fr_FR", "zh_TW", "da_DK",
> "sv_SE", "pt_BR", "pt_PT")
> Chose: ("fr_FR")
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
m
>
> This email sent to email@hidden


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Determining preferred localizations (From: Gregory Weston <email@hidden>)

  • Prev by Date: playing QuickTime movies on iPhone/iPad?
  • Next by Date: Re: need help getting Apple sample code to compile
  • Previous by thread: Determining preferred localizations
  • Next by thread: Re: Determining preferred localizations
  • Index(es):
    • Date
    • Thread