Reputation: 221
It's been 2 days this issue is driving me nuts.
I'm trying to localize my iOS app but for the life of me I can't get it to work. It works easy enough when I try on a blank project but not on my current project.
I've added the languages in the Localizations using "+", I've localized the storyboard but when I check on simulator or device I still see the english version. And in fact it's not even the English one because if I change the Maintsoryboard (english) I don't see the changes in the device ... I still see the initial texts.
I've tried reseting the simulator, deleted the app, etc. No luck.
I've reverted to a backup tried adding everything again. No luck.
Can someone please help? I know it's not much to go on, but I don't know what to explain to help you help me. So please let me know if I'm missing some info.
FYI, when I look into the app's folder in Developer, I initially don't have a en.lproj when it seems I should have one by default?
Upvotes: 22
Views: 10355
Reputation: 1
this is true - AyAz, thanks! It should be noted, XCode will not always fail to compile if some issues in the strings file (esp for localized Storyboard). you can quickly check the syntax-coloring on the file in xcode or run a strings linter on the strings files to ensure no typos -- in my case it was failing due to a double-quote symbol, which is used in the target localized language as part of their normal alphabet. XCode continued on without warnings/errors, but the screen kept showing English...
Upvotes: 0
Reputation: 2057
What I faced is only typo error like
"zu0-GQ-ymP.text" = "Meeting End Time;
just make sure and check each strings in Main.strings must be like below
"zu0-GQ-ymP.text" = "Meeting End Time";
Hint : if it is typo error it will not work in particular localization.
Upvotes: 0
Reputation: 5354
Be absolutely sure you don't have typos in Main.strings file, e.g. double quotes and semicolons. If you have any typos, device simply ignores localized strings and applies base internationalization.
Upvotes: 10
Reputation: 34992
Try selecting all of the various .strings
, .xib
, and .storyboard
files that are being localized.
In the File Inspector, make sure that all of the needed localizations are checked for each file.
After adding localization, English
was unchecked on several files. Some views were thus localizing into unintended languages. Checking English
fixed the problem.
Upvotes: 1
Reputation: 14247
It looks like you already figured this out, but I think what probably happened is that originally you had "MainStoryboard.storyboard" as an unlocalized resource. This means that when you build your app, you get a "MainStoryboard.storyboardc" as an unlocalized resource. When you change your storyboard to be localized, you get a "Base.lproj/MainStoryboard.storyboardc" in your bundle resources.
There are several copies of your app when you're building in Xcode. There's the copy on your device or in the simulator, and there's also a copy in your derived data folder in Xcode. When you do an incremental build of your application, the copy in the derived data folder in Xcode is a merge of your new content and your old content. So, when you modify a resource in Xcode, and rebuild, you get the newest resource. However when you rename or delete resources, the old copy is still left in the build directory until you perform a clean operation.
This means that your build product probably had both "MainStoryboard.storyboardc" and "Base.lproj/MainStoryboard.storyboardc". When NSBundle loads resources, it prefers unlocalized content, and would load the old "MainStoryboard.storyboardc".
Upvotes: 15
Reputation: 19641
Blind shot: check that the strings file is UTF-16 (little endian if I remember correctly) and it doesn't have syntax errors (missing ; or quote). Also run a project clean before building after changes in strings files.
Upvotes: 1