Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
382 views
in Technique[技术] by (71.8m points)

iphone - Changing language on the fly, in running iOS, programmatically

I've been stackling and googling for hours. And I'm kind of desperate now. I would like to change the language of my application inside the app not only with the default language.

From what I've tried I stuck like everybody with the reboot step. Meaning, apples forces you to restart the app manually. Meaning you have to quit the app and then starting it up again.

Well, after googling, I was trying to setup an alarm and then forcing later the app to exit with

exit(0);

My bad, apple seems not to like this and prevent developer from using it... I guess I'm not pointing in the right direction.

Finally, despite all the problem, I could meet I would like to discuss about that.

Any hints?


EDIT, infos from APPLE

In general, you should not change the iOS system language (via use of the AppleLanguages pref key) from within your application. This goes against the basic iOS user model for switching languages in the Settings app, and also uses a preference key that is not documented, meaning that at some point in the future, the key name could change, which would break your application.

If you want to switch languages in your application, you can do so via manually loading resource files in your bundle. You can use NSBundle:pathForResource:ofType:inDirectory:forLocalization: for this purpose, but keep in mind that your application would be responsible for all loading of localized data.

Regarding the exit(0) question, Apple DTS cannot comment on the app approval process. You should contact [email protected] to get an answer for this question.

Well, I have to choose so far.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This is a fairly old question, but I was just struggling with the same problem and found this solution:

http://aggressive-mediocrity.blogspot.com/2010/03/custom-localization-system-for-your.html

Which does exactly what you need (and might be helpful for others who with the same problem :)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...