At 12:02 -0700 21/04/10, cocoa-dev-requ...@lists.apple.com wrote: >From: Gregory Weston <gwes...@mac.com> >Date: Wed, 21 Apr 2010 09:59:48 -0400 >Message-ID: <a977463a-b8f0-4b24-9284-03012bee3...@mac.com> > >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. >... > >- (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]; >}
I can't double-check this right now, but I solved a similar problem this way: NSArray* inChoices = [[NSBundle mainBundle] localizations]; // probably that's what you're passing in? NSArray* theBestOnes = [NSBundle preferredLocalizationsFromArray:inChoices forPreferences:[NSLocale preferredLanguages]]; HTH, -- Rainer Brockerhoff <rai...@brockerhoff.net> Belo Horizonte, Brazil "In the affairs of others even fools are wise In their own business even sages err." Weblog: http://www.brockerhoff.net/bb/viewtopic.php _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com