10

I have a Storyboard in Xcode 5.1 with a base Localization of English, and a second Localization in French.

When I'm using the Xcode Storyboard editor the strings are shown in English, as expected. Is there any way to make Xcode display the Storyboard in my other localization (French)?

I don't want to change Mac OSX's language, I'm hoping there's an option in Xcode somewhere.

EDIT: I have this in my resources folder one storyboard and one strings folder

If I double-click Main.storyboard then the storyboard opens showing English (base language), as expected.

Is there a way to view Main.storyboard, but showing the text displayed in Main.strings?

EDIT: I've since discovered (thanks to this tutorial) that there's a 'preview' option in Xcode. To get this, open the storyboard, click the 'assistant' editor, click the 'assistant editor menu button' (immediately to the right of the > arrow at the top left of the assistant window) and select Preview. This shows how the ViewController will look in landscape/portrait 568/480 high modes. Very handy, but still shows everything in English.

If only this'd let me select a localization, it'd be a great way to check the text layout works in different languages..

xcode preview feature

Ben Clayton
  • 80,996
  • 26
  • 120
  • 129
  • http://forums.macrumors.com/showthread.php?t=1467446 – Vizllx Apr 24 '14 at 07:17
  • @Vizlix, thanks for the link but I can't see the solution in there. – Ben Clayton Apr 24 '14 at 15:20
  • If you're willing to be able to preview it at runtime without having to change your device's language, try this: http://stackoverflow.com/a/8596458/1153630 - you can then just toggle the checkbox when you want to test it with another language – Max Chuquimia Apr 26 '14 at 00:12

3 Answers3

3

I believe that Xcode is not prepared to show localized storyboards in Interface Builder when using string files. However, it allows for you to convert formats quite easily. Select your storyboard file and in the utilities panel, select the language you want to preview:

Utilities Panel

Change the "Localizable Strings" to "Interface Build Cocoa Touch Storyboard":

Selection

You should now be able to select the French storyboard file and preview it within IB.

Once you are done, you can convert the file back to "Localizable Strings" reversing this procedure, or using your source code version control system. Then you can update the base file with any necessary adjustments, and verify it is to your liking using this method again.

Jorge
  • 2,530
  • 1
  • 19
  • 28
  • For me this option does not present, there is just whitespace right of the language name, so I'm stuck with the storyboard. Any idea why? – bjrne Apr 03 '21 at 12:29
2

Xcode 6 now includes a feature to do this.

From What's New in Xcode - New Features in Xcode 6:

Preview in Interface Builder. While designing in Interface Builder, the preview assistant can show how the interface appears in other languages. You can see how your interface responds to longer or shorter languages.

Hurrah!

Pang
  • 9,564
  • 146
  • 81
  • 122
Ben Clayton
  • 80,996
  • 26
  • 120
  • 129
0

Just click on you storyboard file and you can devellope it to show your Localization storyboard. In Your case if you use the localization "base" option, you must see 3 storyboard file (one for "base localization", one for english and one for french). Sorry for my english but i hope that help you.

  • Hi thanks for the response. I have one storyboard file (Main.storyboard) in 'base localization' and fr.lproj/Main.strings. I'm looking for a way for Xcode to display fr.lprog/Main.strings while I'm editing Main.storyboard – Ben Clayton Apr 10 '14 at 13:14
  • if i understand, i think the easier way to use localization in xcode its to select your french localization just under the storyboard (when you develop it ) and in the right panel and select your french localization and in this one, you can choose between "french string" or transform it into french storyboard. im sorry if it isn't what you want. – IndiaNasirJones Apr 10 '14 at 19:34
  • Thanks but I don't quite follow. I've added a screenshot to the question which may help. – Ben Clayton Apr 10 '14 at 19:43