开发者

iPhone - Force localization of Default.png

开发者 https://www.devze.com 2023-01-15 18:02 出处:网络
I know how to force localization with this code [[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@\"fr\", nil]

I know how to force localization with this code

[[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"fr", nil] 
forKey:@"AppleLanguages"];

And I know how to localize Default.png (different bundles English.lproj, French.lproj...). Now imagine the phone language is English, but the user set the application language to be French. How can I force the app to use the Default开发者_运维知识库.png in French.lproj?

I tried to put the code above in main() even before UIApplicationMain(), but it doesn't work.


As crazy as it may sound, i think the "Apple way" to do this is not have a language setting inside your App at all. Actually you shouldn't have any settings in your App at all. You should create a settings bundle that will show upp in the Settings app. I know that very few apps do this as not all users are aware that there are App-specific settings in the Settings App, but this is the "right" way around.

However, I do not think this will fix your Default.png issue. To load the correct Default.png, your app should strictly adhere to the system language setting ie. you should have no language settings at all.

0

精彩评论

暂无评论...
验证码 换一张
取 消