Making localized XIB work with Xcode6 beta4


#1

Has anyone had success getting the Spanish XIB file to work, either on device or simulator, under Xcode 6 / Swift?
I get a DetailViewController.strings file under DetailViewController.xib. And the (new?) localized preview actually works great - in the assistant editor I can select Spanish and the view is rendered correctly in Xcode. But when loading either into simulator or device, the localized strings don’t get loaded - Name/Serial/Value are always in English.

I did all the magic recommended in the book - delete app from simulator or device, restart Xcode, Product/Clean, option-Product-CleanBuild, even went into Terminal and did an xcodebuild clean. Still no joy.

In fact I even tried changing the Scheme to force Spanish language. That forced the system strings (like Edit) to be in Spanish regardless of system settings, but still did not affect loading of the xib strings.

Anyone got any hints?

[Update] Partial answer to my own question. The right side panel shows Base, English, and Spanish with Base & Spanish selected; and for each it then offers two dropdown options, either Localizable Strings or Interface Builder Cocoa Touch XIB. The behavior above, with localization not working, is consistent with Localized Strings setting. Switching to Cocoa Touch XIB setting causes Xcode to make a duplicate of the XIB with the Spanish strings – and this does in fact get displayed on the device. Obviously less maintainable though with the XIB now forked.

Still wondering if there’s a bug in the Localized Strings functionality as used with XIB, or if I’m doing something wrong.


#2

I agree this is frustrating, I am using Xcode 6.1 and book is all about Xcode 5, so you spend a whole lot of time working work arounds, Book should target future product version, localisation as per book does not work.


#3

Localization has at last worked, the problem is with the IOS Simulator 8.1 and Xcode 6.1
There is a work around, use the following settings to test your app in simulator.

Workaround:
In Xcode Go to Product , Schemes - > “edit schemes” >> “Run” (side bar) >> “Options” tab >> "Application Language"
Select the language you wish to run the app on the simulator.


#4

Also guys in Xcode 6.1 you don’t have to set the “Base Internationalisation” for the project as described in the book, it is set for the project by default, also you can add the base for the xib(BNRDetailViewController.xib) through the “File inspector” localise button.