如何强制ios应用程序使用特定的本地化?

如何强制ios应用程序使用特定的本地化?

问题描述:

我有一个具有两个本地化(希伯来语和英语)的应用程序,并且我被要求取消英语本地化,因此无论您的设备使用哪种语言,该应用程序都是相同的(但保留本地化以供将来使用)

i have an app that have two localizations (hebrew and english), and i've been asked to cancel the english localization so that whatever your device's language, the app will be the same (but save the localization for future use).

本地化通过Localizable.strings和Xib本地化(它们的全部).

the localization is via Localizable.strings and also Xib localization (allot of them).

有没有一种方法可以告诉应用始终使用特定的本地化语言而忽略设备语言?

is there a way to tell the app to always use a certain localization and ignore the device language?

谢谢!

在这种情况下,只需在启动时尽早设置默认键AppleLanguages即可覆盖IOS设置

in that case just set the defaults key AppleLanguages EARLY at startup to override IOS settings

(早期=使用xib/storyboard或NSLocalizedString之前)

(EARLY = before a xib/storyboard or NSLocalizedString is used)

NSString *langCultureCode = @"he";
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:@[langCultureCode] forKey:@"AppleLanguages"];
[defaults synchronize];