Modification of localized storyboard - convert to base storybord - ios

My problem is that I have storyboard which support multiple languages (6). Since app was created before iOS6 I have 6 versions of storyboard.
Now UI has been redesign a bit (mostly order of views has been changed) and I did changes only in English version.
Now how to propagate those changes to other languages with minimum effort?
I've noticed that since iOS6 and XCode 4.5 I can get rid of multiple storyboards and just provide translated strings for other languages.
I've found this answer and this tutorial, but this refers only to new projects nothing about how to do this for old big projects.

Ok I've got it!
Enable "Use Base internationalization" for you project (just like in this answer). XCode will ask to select base language (probably you will select English).
Select root storyboard (the root version which contains versions for all languges) in project navigator.
Then in "view/Utilities/File inspector":
For each language change option from "Interface Builder Cocoa Touch Storyboard" to "Localizable Strings":
XCode will ask to confirm conversion.
Before test UNINSTALL APPLICATION FROM DEVICE. Simple run from XCode will not remove old storyboard files from device and you can experience some strange problems (since I did some changes in UI I've experienced some unhandled exceptions).
Verify that everything works and everything is translated properly. Add missing translation if necessary.
This procedure did work for me, with this big hiccup described in step NR 4.

Related

How to change localisation from storyboard to strings file

TLDR: Xcode generated storyboards for each language, however I want the "old"(?) *.strings files. How?
I am currently in the process of localising my storyboards. After I enabled everything, Xcode generated another storyboard alongside the original (english) one for me to localise. I was surprised, I expected a Localizable.strings file, like the apple documentation still states as of April 3, 2021:
For storyboard and XIB interfaces, select the user interface files (files with a .storyboard or .xib filename extension). Xcode adds a strings file to the localization folder that contains the text to translate, as well as comments that describe the user interface components. For example, if you add German to an iOS app that uses storyboards, LaunchScreen.storyboard becomes a group containing a LaunchScreen.storyboard (Base) and LaunchScreen.strings (German) file.
I searched around the internet, in apple developer forums, watched both WWDC18 and 19 talks about localisation in Xcode, but did not find a single mention of translated storyboards.
After the initial translation, which works great due to the simplicity of just filling everything in, it gets frustrating however, since every layout change needs to be repeated for every language. This can't be intended, there must be a better way, right? Sadly, I didn't find anything. Even a hint to a piece of documentation regarding these storyboard copies would be greatly appreciated. Thanks!
There are some screenshots of the possibility to convert these two formats via a dropdown, like the third picture in this post. However for me, there is no dropdown next to the language item when I click the storyboard, neither on the group, nor individual base or localised ones:
Is this a bug or am I missing something here? I am using macOS Big Sur 11.2.3 with Xcode 12.4 (12D4e).
Turns out, you need to use the Base Localization feature, the dropdown then appears and you can convert existing storyboards to *.strings files.

Annoying XCode Source Kit bug with multiple targets

I'm struggling with this problem for nearly half a year now with multiple XCode versions and Macs.
I can't reproduce bug steps exactly but the things go off when project has multiple targets like for Mac and iOS.
First of all XCode declines to take #if os into account and always highlight syntax only in one type of sections. E.g. if I have os(iOS) and os(OSX) somewhere it will chose only one and highlight only them.
Same goes for autocompletion. Things just not working in that type of projects.
I really dont know what to do since developmenet process turns into struggling. I dont want to split my project into multiple one, I'm happy with multi-target setup.
Is there a way to fix that?
Almost a year late.
Anyway I faced the same situation where a multi target OSX/iOS application in Xcode did not take into account the #if TARGET_OS_IPHONE conditional and failed to autocomplete method names from framework only showing the iOS variant.
Found a solution, based on this blog entry : you have to clearly state the Framework search path on each target in Build settings
Edit: This line was present in the iOS target settings. I copy/pasted it to the MacOS target in Xcode where it was automatically adjusted to the right path.
Edit 2: Loosely related but if you run in trouble with interface builder picking wrong classe files see this answer I just posted in another old thread.

Xcode 6: iOS doesn't use storyboard localizations

since I upgraded my Xcode project to Xcode 6, my storyboard localizations don't work.
I have:
A base localization as storyboard file (which is basically English)
Four string files: English, German, French and Japanese
Until Xcode 5 those worked without any problems.
But since Xcode 6 I have the following situation:
The application only uses the labels used in the base file when running on a device/simulator
BUT my Localizable.strings file, which I have in different languages for all non-storyboard related localizations, works perfect. (So in the end I have a mixture of languages while running on a device)
Since Xcode 6 there is the possibility to see the localizations as a preview screen in the assistant editor. Everything works there.
So: the only thing that doesn't work is the localization of the storyboard while running
Does anyone else have the same problem and is there a solution?
Update: With Xcode 6.1 GM the localization on the actual device is correct now but the simulator is English only, even if I choose another language in the simulator.
I am experiencing the samen problem. I have been struggling for hours getting my localized storyboard to work in Xcode 6.0, until I read your question. Then I tried the second GM of Xcode 6.1. There, my UILabels were localized properly on the device (not in the simulator). However, my UITextView did not get localized, which took me another 30 minutes to figure out.
Hopefully, this will be fixed soon.
I thought I had the same problem as I couldn't see any of my translated texts appearing in the simulator. I tried using a dummy new project and it worked which made me not so sure about what the problem was.
Then I decided to use a dedicated editor for the translation. After exporting, translating the files via the editor and importing them, I could see the correct texts in the iOS simulator. So I guess that it was the way I edited them manually which caused the issue.
FYI, the tool I used is https://poeditor.com
I've been experiencing the same issue. The solution is: you need to clean (shift-cmd-k) a project first, then you build and run it.
Try to switch localization files to “interface builder storyboard” instead of “localizable strings”. For some reason in my project Storyboard.storyboard works, but Storyboard.strings doesn’t. Probably xcode bug.

Interface Builder cannot find .xib - Xcode 5.0.2

I recently became interested in mobile app development and want to take my coding experience from elec. engring to the iphone. Im having trouble though. I am trying to compile my first app onto my phone (got it to run perfectly on the iOS simulator last night). However, upon compiling i get the following error:"Interface Builder XIB Compiler Error: Interface Builder could not open the document "xxx.xib" because it does not exist"
I've tried going into my target and setting Main Interface to xxx.xib and I still get the same error on both iPhone and iOS simulation. I've tried setting my interface to Xcode 4.6 and messing with the builds and views, still have the same issue. I built it from scratch - same issue.
All help appreciated. I know the default is building with story board, but I am following a book I am happy with and I want to go through it with the .xib because thats what the book uses. Thanks -
Select your project (blue icon) in the project navigator then choose:
Build Phases > Copy Bundle Resources
Make sure your xib file is on the list. You can add it by clicking the plus (+) icon on the lower left.
UPDATE:
Consider opening a new project as a sanity check. Change the background color and verify that it runs in the simulator. If it does then this will point to a project settings issue rather than an installation problem.
You may also want to look at the following walkthrough by Apple. Hopefully following the steps will help illustrate anything you might be missing.
Apple also has a latest tutorial that I recommend you walkthrough. After completing please let me know if you are continuing to have this problem. The number of potential problems is greater than simply walking through the 15 min tutorial.

iOS - Storyboard - localization - After modifying storyboard, how to sync to other language storyboard?

I know how to turn on storyboard's localization. The problem is I don't know how to sync all localizaion storyboards, after main (English) storyboard is modified.
Is there any shortcut to sync them? Do I have to do all those modifies again and again in over TEN language storyboards?
My condition is: I have a project with over ten localizations. After I released it on AppStore, we have new user requirements.Then, we start program next version app. After I completed tons of improving and creating on stroyboard, I feel desperate to facing other language storyboards.
If you are using iOS version >= 6 (and Xcode >=4.5), you can use a single storyboard for multiple languages, i.e., do base localization + the usual string localization. Doing so, you have only to care about the localized strings in string files.
For a guide, see e.g. here.
If you're targeting iOS 6.0, you can use Base.lproj like Matthias mentioned.
If you're targeting a release prior to 6.0, you can use ibtool's localization merging features. They works for NIBs, XIBs and Storyboards. You can invoke them like this:
ibtool path-to/development.storyboard --local-
ize-incremental --previous-file path-to/development-storyboard-localization-was-based-on.storyboard --incremental-file path-to/previous-localized-storyboard.storyboard--write path-to/updated-localized-storyboard.storyboard
What that does is open development.storyboard, copies it, and the compares all localizable properties between path-to/development.storyboard and path-to/development-storyboard-localization-was-based-on.storyboard, if those properties are the same, the counterpart value from path-to/previous-localized-storyboard.storyboard is copied forward to path-to/updated-localized-storyboard.storyboard, otherwise the current development value is left in place.

Resources