iOS Localization Help
Hello all,
I'm in the process of localizing my app and I have a question that has thus far eluded my Google-fu. I have two .xib files and two .storyboard files, as well as a strings file. I do understand all of the general concepts - I was in charge of the localization of a large Windows MFC project for a decade at my last job. So, inside my app I've used NSLocalizedString, etc.
I’ve followed Apple’s documentation and my .xib and .storyboard files are set up with the base .xib and then the various .strings files (i.e.: FolderView.xib, FolderView.strings (Japanese), FolderView.strings (Hebrew), etc.) I’ve done the import of the files and I can see my translations in both the Assistant Editor preview as well as by launching my app using a language-specific scheme. So far, so good.
However, there’s some language-specific layout changes that I’d like to make. When I click on one of my interface builder files (.xib, .storyboard), in the File Inspector I see that under the Localization section, there’s two choices for each language - ‘Localizable Strings’ or ‘Interface Builder Storyboard’. It seems like I’d want to just set those to ‘Interface Builder …’ instead of ‘Localizable Strings’, as then I could make layout changes. When I click to change it, Xcode asks me if I’d like to convert my file. After replying in the affirmative, it changes it over but it seems like my translations are left behind. Furthermore, once I’ve done that, I can’t see the language in the Assistant Editor preview anymore. And when I go to test it, it’s back in English. So even though the conversion dialog implies that it’s going to apply my language strings to this new Interface Builder file, it doesn’t happen.
In fact, I just did a test where I manually changed something on my LaunchScreen.storyboard (Japanese), and the changes aren’t showing up when I run the app. So it appears that it’s not even using the language-specific storyboard.
So, the question: How do I make language-specific layout changes? What does the Localization type in the File Inspector do, if not what I’m trying to use it for?
Posted Mar 8, 2017, 4:13 PM UTC
So here is what I did (no accounting for taste). I didn't like the dozens of strings files that ended up getting created when I localized the xib files, plus I ended up moving elements in one version, but that didn't move them in other languages...so I tossed all of that. It broke me.
Here is what I did:
Note: if you have lots of developers, having one file with all your strings might not be the right approach, is it can cause merge conflicts. Adjust the premise as needed.