Basic localization + Storyboard + .strings & # 8594; lack of localization

Xcode 4.6, target iOS 6, iOS 6.1 SDK

I started with a storyboard that worked well for my application; the lines it contains are in English. I wanted to add French localization. I have done this:

  • Added basic localization, which is moved MainStoryboard.storyboard from en.lproj to Base.lproj.
  • Added French localization, which cloned InfoPlist.strings (English) and MainStoryboard.storyboard (Base) in fr.lproj.
  • Changed several lines (segment headers in UISegmentedControl) in French MainStoryboard.storyboard.
  • In the simulator, set the language to French.
  • Edit the application from Xcode.

Result : it worked; my changed lines appeared in a running application.

But I want to be all fantasy. I want to do french localization using a .strings file. (This is not just a matter of fantasy, French localization will be handed over to non-technical translators who cannot be expected to master the Builder interface.) So:

  • Selected the base MainStoryboard.storyboard in the Xcode navigator project.
  • In the file inspector, under the "Localization" section, the French localization has changed from "Interface Builder Cocoa Touch Storyboard" to "Localized Strings".
  • An Xcode warning has been received that the French storyboard will be dropped in favor of the .strings file that appears in the assistant editor.
  • Made the same two changes; there is no question that they are mistaken strings because they are all commented out as IBUISegmentedControl ... segmentTitles; and the label text does not appear elsewhere in the .strings file.
  • Removed the existing (working) copy of the application from the simulator.
  • Cancel the application.

Result . The view uses basic (originally English) localization instead of loading French lines.

The conversion to Autolayout did not affect. Removing the application from the simulator did not affect. Removing the Derived Products catalog did not affect. Stack overflow suggested using ibtool to create a .strings file instead of Xcode; the two generated files are identical.

This is unsatisfactory. As I said, I cannot turn a .storyboard file into a non-technical translator. How can I get iOS to accept the localization of the storyboard from a .strings file?

+7
source share
4 answers

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

1) Localizable.string file in it.lproj

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

3) add Localizable.string in the build phases-> Bundle Copy Resource The last step is not required in iOS 5.1.

I decided thanks to Cocoanetics answer in [question]: Internationalization base and several storyboards do not work correctly

+4
source

Select the "English localization" checkbox using the "Localize strings" option:

Localization settings

Clear the build folder (โŒฅโ‡งโŒ˜K) and rebuild.

+5
source

To add an answer to claymation about doing a clean build, it will also help remove the app from iOS Simulator.

This may be due to what John Hess answers .

+1
source

I had to convert the string file into a storyboard, and then return to the string file to make it work. Funny. Apple can learn something from Microsoft about creating more reliable developer tools.

+1
source

All Articles