localization works in preview but not in simulator or device

I work with 3 languages, on each of m storyboards Xcode 8 created my storyboardName.strings (language) files and i changed all the strings to the correct languages inside the double quote. I also have my localizable.strings files created for when i programatically need to change labels / alert messages.


Everything done programatically works fine on the simulator / device


The stroryboard don't translate on the simulator / device but work when i do the preview side by side and chaneg the language

Replies

It’s hard to say what’s going on here without a lot more details. Let me walk you through a concrete example, at which point you should be able to a) walk through that example to make sure it’s working for you, and b) compare that process to the process you’re using in your real app.

Here’s what I did:

  1. I’m using Xcode 8.3.2 on macOS 10.12.4 with English as my primary language.

  2. I created a new app from the iOS > Single View Application template.

  3. In

    Main.storyboard
    , I added a button Varnish Waffles.
  4. In the project editor, I added a localisation for German.

  5. In the project navigation, I selected Main.strings (German) and changed Varnish Waffles to Lack Waffeln.

  6. I ran the app in the simulator; the button was displayed as Varnish Waffles.

  7. I stopped the app.

  8. I edited the scheme and, in the Options tab, change Application Language to German.

  9. I ran the app again; the button was displayed as Lack Waffeln.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Hello. We are experiencing this as well. The translations are working fine on the preview (assistant editor) but they are not on the simulator or device. It's a project that began pre-storyboard. However, XIB translations work correctly on the main project. We are experiencing this only on our own internal dynamic framework. We currently use Xcode 9.2 are have iOS9 as deployment target. We have already try everything we can think of, including your steps (except we can't just create a new app). Any recommendations?

Ignoring the nibs for the moment, do string translations work in your framework? That is, if you have a

.strings
file and localise that, does the framework code get the localised string?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Yes, strings traslations work with .strings / NSLocalizedStringTable. Actually, I need to correct my self. Both nibs and strings translations work technically. The issue is that for the framework it uses the same translations regardless of what language/region I set on the scheme. It seems that it selects whichever is last alphabetically in the directory. I added several languages to test it, and it would always show whichever wast last. Initially I thought it would select whichever was added last, but I tested adding Ukraine before adding French, and still showed Ukraine. The same behavior happens with string (.strings) translations. I checked the IPA and all files are in there. Again, however, when using the preview (with assistant editor) it pulls from the corresponding .string file as I change the language.

It seems that it selects whichever is last alphabetically in the directory.

Well that’s weird. I’ve never seen anything like that before.

At this point I’m going to recommend that you open a DTS tech support incident so that our internationalisation expert can take an in-depth look at your setup.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"