IOS: Is there a way to fake a custom language?

I am interested in allowing my users to select the language / locale they are accessing. I figured out how to download the right package, select the correct line files, etc. However, some elements of the system I still do not seem to control. For example, switches.

Can I tell the system that this application should now behave in a specific language, and not in the current system user setting?

+5
source share
1 answer

The worst way is through NSUserDefaults: the locale is determined AppleLocale(language identifier as a string), and the language is determined by the first match in AppleLanguages(array of language identifiers); your application can override these defaults only for your application. To check if your application is overridden, you can use something like [defaults persistentDomainForName:[[NSBundle mainBundle] bundleIdentifier]] objectForKey:@"AppleLocale"]. To remove an override, use -removeObjectForKey:.

Whatever way you do it, you will probably have to restart the application when changing languages; OS X and iOS applications are simply not designed to change the language at runtime (in OS X, only new running applications see a change in language, and on iOS, the system kills all applications to change the language).

, /; , App Store.

+5

All Articles