Xcode Localization is driving me nuts! Not loading Storyboard
Asked Answered
T

6

22

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?

Tibetoburman answered 8/10, 2012 at 13:18 Comment(4)
Which localizations do you see in your project info? You always have a default localization so maybe your default (initially) localization was not English. You can check for the default one on your info property list.Interval
Hi Fabio, thanks for answering. If a start from my backup I see Base and English, with 0 files localized. If I select the MainStoryBoard -> Localization -> Make localized I see one file in English. But after that, whatever I change in the Storyboard doesn't affect what I see in the simulator or device. I can even delete it from xcode, Run, and it's still there on the simulator+device.Amethyst
And of course your simulator is in English right? Have you cleaned your project (shift+cmd+K) after adding the localization?Interval
Ok I just figured it out ... more or less ... I removed the references to my Storyboard, renamed the file, renamed the Main Story Board Base file in the infos .plist -> Added the renamed Storyboard file to the project and voilà, localizations are working again. 2 days trying everything. Thanks for your help Fábio!Amethyst
A
15

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".

Aberrant answered 9/10, 2012 at 4:27 Comment(1)
I had this problem, though with a device that had data I wasn't wanting to recover after deleting the app. Building and installing an ad-hoc version of the app seems to use the same installation process as the App Store - so these pesky compiled storyboards can get cleared out, without deleting the app. In my case no combination of cleaning and rebuilding got rid of the old story board on device (and it was defaulting to it and ignoring the new one), so the only option left was to either delete the app, or install the app independently of Xcode. Adhoc installation let me get around this.Hirokohiroshi
F
10

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.

Fontanez answered 30/6, 2016 at 14:42 Comment(1)
this does not happens because Xcode will throw a compilation error.Mcfarlane
P
1

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.

Periscope answered 8/10, 2012 at 13:30 Comment(1)
I don't see a strings file. I only see multiple versions of my storyboard.Amethyst
B
1

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.

English localization unchecked

Bivens answered 27/8, 2015 at 20:28 Comment(0)
H
0

enter image description here 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.

Halliard answered 29/1, 2020 at 6:19 Comment(0)
S
0

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...

Straley answered 3/11, 2021 at 0:7 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Ormand

© 2022 - 2024 — McMap. All rights reserved.