Restricting available localizations
Supposing I have two different languages for Localizable.strings
and a single target. There's any way to tell the application to always ignore one of them even if the user has that language selected in his regional settings?
i.e.
- I have
Localizable.strings 开发者_高级运维(English)
andLocalizable.strings (French)
- The user has setup his iPhone language as French
How can I tell the application to ignore the French language even if the resources exists?
There's other way around other than creating different targets?
You can force your app to ignore the user's chosen language even if resources exist for it in your application bundle. You need to put the following line in your application, probably in your main.m file (you want to set the language before anything starts happening with your app).
[[NSUserDefaults standardUserDefaults] setObject: [NSArray arrayWithObjects:@"en", nil] forKey:@"AppleLanguages"];
...replace 'en' for the language of your choice, etc.
精彩评论