How to preview Storyboard in Xcode using Non-Base localisation - ios

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
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..

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:
Change the "Localizable Strings" to "Interface Build Cocoa Touch Storyboard":
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.

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!

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.

Related

Is there a "simplified" view of code in the Assistant Code Editor in Xcode?

I am working my way through the Apple iBooks title "App Development with Swift." On page 86, it says to open the Assistant Editor to make a connection to an interface element. In the accompanying image, the editor shows a nice, neat, compact snippet of code, about a dozen lines long.
However, when I open the editor in my follow-along project, the same UIViewController file shows me about 600 lines of code. The steps I'm taking to get here are Open Xcode, select New Single-view iOS Project, select Main.storyboard, select the ViewController object in the outline, and open the assistant editor.
Is there a setting somewhere to show a simplified version of the code? Or has the code for the ViewController changed that much since the book was released? Or did they maybe just create a super-simple version of the editor for the images in the book?
I'd like to be able to follow along with what they're doing in the book, but at this point I'm stuck.
Click on 'Automatic' above the source editor and select the view controller.

How to localize images in iOS if they are set up in a storyboard?

I know how to localize storyboard elements like label, buttons etc. However, I faced a problem where I need to localize the images that were setup in a storyboard in the attribute inspector for the Image View.
Is there a way to localize those without setting those images up in the code, in the viewDidLoad method and calling setImage:[UIImage imageNamed: NSLocalizedString(...)]; ?
Any kind of help is highly appreciated!
I guess I figured it out...maybe not the ideal way of doing it but works for me...
Open image folder in your Project Navigator (panel).
When you click one of the images, on the right (Inspector panel) you'll see the button "Localize".
Clicking on that button gives you a pop-up asking if you want it to be the base (in my case I say yes).
So now in the inspector there're check boxes: Base, language 1, language 2 etc (language n - is the languages you added to your project in the localization settings).
So now if you put a check mark into one of the language check boxes, your image file will have a drop down arrow showing that it has some content inside. If you click that, you'll see how it expands showing the localized files with the name of the language in the () brackets.
However, at this point those files are all the same as the base. So now you need to substitute the base files with the localized ones.
If you right click on the file that needs to be localized, say myImage.png(German), open it in Finder, and replace that file with the right one. Important! The name of the file should stay the same!
I'll post the screenshots later, so it's all clear how to do it.
Using Xcode 9.2
you can achieve it easily like the following
1- From Assets
2- Then you will need to change the Direction option AND CHOOSE BOTH
xcode will allow you to add 3 more image for other language resource
3- add your needed image and use it in story board or from code as well

Single language ios app

I have a project in Xcode 5.0 and I want to support only a specific language different from english, for intance, pt. When the project is created, it has "Use base internationalization" checked. A tried adding my language and removing english, then when I run the app on a device of that language (pt), everything is ok, the controls of a image picker, for instance, are localized. But, if the device's language is english or a different one (for instance fr), the controls are shown in english. How can I force the app to show all controls in my language (pt)?
Maybe it is noob question, but when I uncheck "Use base internationalization" I lose the storyboard, and when I try to check again it asks for files but no options are shown. How can I change the reference language of base internationalization?

No plus or minus button in Xcode localization settings

I need to translate an iOS-Application within two days, but my XCode versions (4.4 and 4.5 Developer Preview) both don't give me the option to add another language. I only get the option to click "Make localized.." but I can only choose english and after choosing it, there are no plus and minus buttons in the utility inspector in Xcode - with no file or project i tried.
Am I missing something here?
Edit:
This is how it looks like:
It moved to the starting in Xcode 4.4 .
I just meet with this problem and I was using xcode 4.5 preview 3. Couldn't believe apple have made this kind of mistakes and not fixed it even when its at preview 3. Therefore I believe they just have changed the way localisation work so I poke around the UI until I finally found it.
They have shifted it. You first have to add the language you want to the project first. Then after it will appear as a check box item in the UI you show. To add the language you need to click go to Project -> Info then click "+" to add new localizations.
Hopes that helps.
The buttons scroll out of view when the "+" is used to extend the list. Use the mouse to grab the bar right below the list of localizations and drag it down to make more room, and the buttons will be visible again. Then you can click on the "+" to see a menu of additional localizations.
It seems Xcode 4.5 DP3 completely miss the +/- buttons in the localization pane.
I tried Nyon solution to add an additional language (actually before seeing this post).
Doing so, I can add a language into the project but I cannot use that new language to localize my files.
But thanks to him, I know now that it is the issue with Xcode DP3.
So, what did was very simple: I use the old Xcode 4.3 to localize my file (with + button in the localization pane).
Then, I have two versions of the files (one for each language, nicely organized into appropriate lproj).
Then I switch back to Xcode 4.5 DP3.
Now, both languages (en and the new one) appear in the localization pane.
And this time, for all my files!
That is, you have to add a language only once in Xcode 4.3, afterwards, the new language will appear in your language list as it should be.
You can add languages in Xcode 4.5 like above.
I think the answer is not complete!... If you start a project for a non English, Japanese, French or German language (in xCode 4.6), then you will be a bit lost on how to localize your resources.
If you just go and try to add a new language as stated by kamesh above, you'll find you can't if you didn't FIRST localized at least one of your resources in the default provided languages by xcode.
So, localize at least one of your resources needed to be localized, and then, add the language you need to add as kamesh, then the next modal presented by xcode will let you add any resources to that new language. (not very intuitive and definitely not documented by apple.)

Xcode 4 why do I see XML when clicking on MainStoryBoard.storyboard: seems like a bug

In an Xcode project, I see XML when clicking on MainStoryBoard.storyboard instead of the graphical design, why and how to restore the right view ?
Update: I think it's a bug of XCode 4.2 because on another project, when I click on version editor I have XML but when I click on standard editor it shows visual design.
Is there a way to fix this and not to force me to recreate my visual design by hand once again ?
To fix the issue, right-click MainStoryboard.storyboard, then choose "Open as >" and then "Interface Builder - iOS Storyboard".
Make sure you are not using the source control editor, which shows you the changes for a given file. You can change this in the Toolbar at the top right.
Check this link in the section "Editor"
This worked for me using xcode 6
I've run into this issue, but it was a bit different. I had a merge issue with Git on my storyboard, so I had to manually edit the XML to resolve the conflict. After this, there was no 'Interface Builder-iOS Storyboard' option available in the "Open as" menu so I couldn't change it back to the visual editor. To fix this I simply restarted XCode and everything went back to normal.
After using SeanK's solution (restart XCode) I still manually needed to right-click the storyboard and choose Open as > Interface Builder - iOS Storyboard.
If you have more than just one storyboard go back and forth - click different one, go back to the one you want to display as an iOS storyboard. It's not XML any longer.
Change the extension like this "your_storyboard.storyboard" then right-click MainStoryboard.storyboard, then choose "Open as >" and then "Interface Builder - iOS Storyboard".

Resources