Xcode Localization is driving me nuts! Not loading Storyboard

后端 未结 5 883
再見小時候
再見小時候 2020-12-25 13:25

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 o

相关标签:
5条回答
  • 2020-12-25 13:31

    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.

    0 讨论(0)
  • 2020-12-25 13:44

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

    0 讨论(0)
  • 2020-12-25 13:51

    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.

    0 讨论(0)
  • 2020-12-25 13:52

    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.

    0 讨论(0)
  • 2020-12-25 13:54

    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.

    0 讨论(0)
提交回复
热议问题