• 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
preferredLocalizationsFromArray: strange behaviour
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

preferredLocalizationsFromArray: strange behaviour


  • Subject: preferredLocalizationsFromArray: strange behaviour
  • From: ANE <email@hidden>
  • Date: Sun, 28 Feb 2010 15:56:16 +0100

Hi!

Let's suppose I would like to know the current preferred language. I'm using the following code:

	NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
	NSArray *languages = [defaults objectForKey:@"AppleLanguages"];
	NSLog(@"Languages: %@", languages);
	NSLog(@"Preferred Loc: %@", [NSBundle preferredLocalizationsFromArray:languages]);

or
	NSLog(@"Pref. Lang.: %@", [NSLocale preferredLanguages]);
	NSLog(@"Preferred Loc: %@", [NSBundle preferredLocalizationsFromArray:[NSLocale preferredLanguages]]);
or
	NSLog(@"myBundle Loc: %@", [myBundle localizations]);
	NSLog(@"Preferred Loc (myBundle): %@", [NSBundle preferredLocalizationsFromArray:[myBundle localizations]]);


Output:

Languages: (
    de,
    en,
    fr,
    nl,
    da,
    ru
)
Preferred Loc: (
    en
)

Pref. Lang.: (
    de,
    en,
    fr,
    nl,
    da,
    ru
)

Preferred Loc: (
    en
)

myBundle Loc: (
    de,
    English,
    German
)

Preferred Loc (myBundle): (
    English
)




IMHO that's wrong. The preferred localization/language should be "de" in any case.

Any ideas?


Thanks!


--
ANE


_______________________________________________

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

  • Prev by Date: Re: Carbon is C++?
  • Next by Date: Re: Carbon is C++?
  • Previous by thread: CoreAnimation context error
  • Next by thread: Using CFMutableDictionaryRef
  • Index(es):
    • Date
    • Thread