Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 961
gabrielstuff Avatar asked Feb 24 '11 19:02

gabrielstuff


People also ask

How do you change the language of an app iOS?

Change The App Language in iPhone or iPad AppsTap on the Settings app on the Home screen. Scroll down, select the app you wish to change its language. Select Language under Preferred Language. Choose the language you want to use.

How do I change the button click language in Swift?

Click on the + button under the localizations section. You will see the following list of applications. Select the language you want to add into your app. After selecting the language, following popup will be appeared.

What languages can an iPhone run?

There Are Two Main Languages That Power iOS: Objective-C and Swift. You can use other languages to code iOS apps, but they may require significant workarounds that require more effort than needed.


1 Answers

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 :)

like image 140
Swissdude Avatar answered Oct 12 '22 18:10

Swissdude