IOS Localization after startup - ios

I'm trying to localize an ios app after it was launched.
We should be able to select the desired language on the startup screen.
The app is already localized and available for 13 languages.
The only solution I found is to set the locale and relaunch the app, but we can't really do that, as it's not user friendly, and Apple will probably reject it.
The project contains most of a thousand of xib files, so I can't change all the resources "manually" either.
Is there any solution to reload the UIApplication ? Or an other trick to change the locale on the fly (and allowed by Apple) ?
I found lots of threads which were talking about this, but none very interesting compared to the scale of the project.

I don't think there is a way to do what you want without coming up with a custom solution. I found a solution on StackOverflow here where a user created his own localization solution.

Related

Having a language select option in an app using Swift

I have Googled this for hours but could find no advice for the following problem (using Swift).
I have seen in many apps an option to select the language from inside the app like this:
(source: unity3d.com)
I would like to achieve something similar, but am having trouble implementing it. I have localized my app and have my Localizable.strings files all set up. I'd imagine it has something to do with storing the language selected in NSUserDefaults, but how can I make the app use the appropriate Localizable.strings file once a language has been chosen? Or is that the wrong way to approach it?
How have others successfully implemented this feature in Swift?
I've already faced this issue on one of my project and found one solution :
When the user select a language from a list, post a NSNotification. All your UIViewController subclass must register to this notification and change the labels value according to the new language selected.
You can use the localized strings in order to set the labels, but NSLocalizedString(...) shouldn't be called since it's relying on the device language which is different from the application language.
You can find my implementation of a custom localisator on Github, available both on Swift and objective-C.

How to override current language used inside an app

I've found testing localizations to be a slight pain since I have to go and change the device's language in order for the app to change.
How can I make my app "think" I changed my default language? I could then link that to a button or popover, but the actual changing of the language is the tricky part.
You can test the with any of the supported languages or regions by settings then in the option of the run target.
This fully described in Internationalization and Localization Guide

Localization in iOS with XIB (Interface Builder)

I have searched now quite a bit on Stackoverflow for an answer, but I can't seem to find an adequate one.
So, I am localizing an App with XCode. Everything works fine, I have localized a storyboard and everything. The last part which needs to be localized are the labels and buttons in XIB Files. Here I have the following Problem:
XCode Offers me to create localized Xib Files for every language or to create strings files. Both options are fine with me, but none seems to work. One answer to a similar question stated that this does not work my design. If so, why does XCode give me the option to do it in the first place? And, what is a good and easy solution for this?
And I am using Swift, not sure if that really matters, I just thought I mention it.
There is a known issue with recent versions of Xcode where the simulator would not correctly pass the language information to the app, so it seemed as if localization was not working. If that is your problem, there are two workarounds:
try your app on a device and confirm switching the language brings up your localized strings.
force the language via your build scheme (Product => Scheme => Edit Scheme... => Run => Application Language)

Add custom settings bundle to jailbroken iOS settings.app?

I was looking into making a custom toggle switch option in the iOS settings.app menu to turn a home cooked function on and off. I was wondering if it's possible to do such a thing. If so, how?
Yes, this is possible, but it works a little differently for jailbreak apps, installed in /Applications, than it does for normal App Store apps.
Take a look at this documentation here. I haven't used it in a while, so if there are things that are out of date, post a comment here, and I'll try to update my answer with code, etc., from one of my working jailbreak apps that does this.
Note that if you want the Settings switch to execute your custom code, rather than just storing a preference value, you'll need to use the PreferenceBundle Approach described in the link above.
You'll also need to make sure the phone has PreferenceLoader, by Dustin Howett, installed on it, for this to work. If you're distributing your app to users (via Cydia, or something like that), you can make sure that PreferenceLoader is automatically installed along with your app. To do this, add this line to your app's DEBIAN/control file:
Depends: preferenceloader
PreferenceLoader is free, has been around for a while, and seems pretty stable, so it's not a bad dependency to have at all. Most jailbreak users will likely already have it.

Project has both English.lproj and en.lproj. How to fix it?

It seems that my project has somehow acquired two folders for English resources: /English.lproj and /Classes/en.lproj. Obviously this seems wrong, and although it works when devise is set to English, I suspect that it causes a crashing issue when the device is set for non.English language (app can't find the default resources - My app crashes in other languages. Xibs seem to not be loaded. Why?)
So how does one go about fixing this? Apparently I can't just move the files. XCode misses the old ones, and can't find the new ones.
I found a solution. Basically copy the files, remove references, make new references, delete old files.
Detailed description here:
My app crashes in other languages. Xibs seem to not be loaded. Why?

Resources