Base localization + Storyboard + .strings -> no localization

Xcode 4.6, target iOS 6, SDK iOS 6.1

I started with a storyboard that worked well for my app; the strings it contains are in English. I wanted to add a French localization. I did this:

  • Added a base localization, which transferred MainStoryboard.storyboard from en.lproj to Base.lproj.
  • Added a French localization, which cloned InfoPlist.strings (English) and MainStoryboard.storyboard (Base) into fr.lproj.
  • Changed a couple of strings (titles of segments in a UISegmentedControl) in the French MainStoryboard.storyboard.
  • In the Simulator, set the language to French.
  • Ran the app from Xcode.

Result: This worked; my changed strings showed up in the running application.

But I want to be all fancy. I want to do the French localization using a .strings file. (It's not just a matter of being fancy; the French localization will be turned over to nontechnical translators, who can't be expected to master Interface Builder.) So:

  • Selected the base MainStoryboard.storyboard in the Xcode Project navigator.
  • In the File inspector, under Localization, changed the French localization from "Interface Builder Cocoa Touch Storyboard" to "Localizable Strings."
  • Accepted Xcode's warning that the French storyboard will be discarded in favor of a .strings file, which appears in the Assistant editor.
  • Made the same two edits; there's no question of their being the wrong strings, because they're all commented as IBUISegmentedControl...segmentTitles; and the label text doesn't appear anywhere else in the .strings file.
  • Deleted the existing (working) copy of the app from the simulator.
  • Ran the app.

Result: The view uses the base (originally English) localization, instead of loading the French strings.

Converting to Autolayout had no effect. Deleting the app from the simulator had no effect. Deleting the Derived Products directory had no effect. A Stack Overflow suggested using ibtool to generate the .strings file instead of Xcode; the two generated files are identical.

This isn't satisfactory. As I said, I can't turn a .storyboard file over to a nontechnical translator. How can I get iOS to accept the storyboard localizations from a .strings file?

Answers


I hope you have already solved. I had the same problem (with translation in Italian) and I solved it this way:

1) File Localizable.string in it.lproj

2) use NSLocalizedString (@ "TEST", @ "comment") method where it needs

3) add Localizable.string in Build Phases-> Copy Bundle Resource The last step is not neccesary in iOS 5.1.

I solved thanks to the response of Cocoanetics in [question]:Base internationalization and multiple storyboard not working right


Enable the English localization checkbox, using the Localization Strings setting:

Clean your build folder (⌥⇧⌘K) and rebuild.


To add onto claymation's answer about doing a clean build, it also helps to delete the app from the iOS Simulator.

It may be related to what John Hess's answer describes.


Had to convert my strings file into a storyboard then back into a strings file to get this to work. Ridiculous. Apple could learn a thing or two from Microsoft about creating more reliable developer tools.


Need Your Help

Django test runner not finding tests

python django unit-testing

I am new to both Python and Django and I'm learning by creating a diet management site but I've been completely defeated by getting my unit tests to run. All the docs and blogs I've found say that...

XSLT: Sum of the values of a node where a preceding-sibling condition is met

xml xslt

I am attempting to find the sum of the Amount tag where a preceding-sibling condition is met. The data comes from a Sql Data Base and the order of the XML cannot be changed.