Join the Stack Overflow Community
Stack Overflow is a community of 6.5 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

Xcode 6 Beta 4 using Swift.

I use localization in my project and I have experience in localization from Xcode 5.

Localization in program code using NSLocalizedString() works fine. Localization of Info.plist strings work fine, too.

When it comes to localize the strings from Interface Builder it only works in Interface Builder preview but not in simulator and not on my device (iPhone 5S).

Am I missing something or can anyone confirm this as a bug in in Xcode 6 Beta 4?

share|improve this question
    
have you tried upgrading to beta 5, could be a problem with the simulator. – Fred Aug 12 '14 at 18:59

It seems like the problem is with the size classes.

If "Use Size Classes" checkbox is enabled for storyboard, the Xcode actually generates 3 versions of it ("<Name>.storyboard", "<Name>~ipad.storyboard" and "<Name>~iphone.storyboard").

So iOS just tries to load .strings file which name matches the name of active storyboard (<Name>~iphone.strings in case app is running on the iPhone). And being not able to find that file, it falls back to Base localization.

There are a couple of ways to work around this bug:

  1. The most obvious one. Just disable size classes for the storyboard.
  2. If you need size classes, you can add localized <Name>~iphone.strings and <Name>~ipad.strings files to the project manualy and copy your translations over.
share|improve this answer
up vote 4 down vote accepted

Apple release notes of XCode 6 GM covers this :

Localization: A storyboard or XIB will not localize correctly if all of the following three conditions are true: The storyboard or XIB uses size classes. The base localization and the build target are set to Universal. The build targets iOS 7.0.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.