preferredLocalizationsFromArray: strange behaviour
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