The language setting "Español (México)" uses "Spanish" strings instead of "Spanish (Latin America)"

Our iOS project has localized strings for "Spanish" (es.lproj) and "Spanish (Latin America)" (es-419.lproj) built from Xcode.

However, on the iPhone (US, the latest version of iOS 7), the only language options for Spanish are "Español" and "Español (México)", "Latin America." And when you select "Español (México)", it uses the "Spanish" lines from our application, and not the "Spanish (Latin America)" lines, as you would expect.

Further research [[NSBundle mainBundle] preferredLocalizations]returns @[@"es"]. This is even though it [[NSBundle mainBundle] localizations]returns an array containing both "es" and "es-419".

However, it [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"]returns an array containing "es-MX".

And then the following expression:

[NSBundle preferredLocalizationsFromArray:@[@"es-419", @"es"]
                           forPreferences:@[@"es-MX"]]

returns @[@"es"].

Why does Xcode give us “Spanish (Latin America)” localization when not in use, when you actually choose the only Latin American Spanish phone option?

+4
source share
2 answers

iOS 9 10 . , , . ; "es-MX" , "es", NOT "es".

0

Xcode , iOS. , iOS, - , iOS. , , .

0

Source: https://habr.com/ru/post/1539810/


All Articles