I am trying to localize my app. I noticed that if I add a language every localized file become doubled. In this way it's impossible to maintain code or storyboard so I learnt that I need Base internationalization.
The problem is that I don't know where to configure the base internationalization in the Project-> Info. Unlike describe in the link, The setting is not available in xcode 5.0.1.
Does anyone know how to find the setting to configure base internationalization?
Related
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.
I am trying to add the GPUImage framework/library according to this:
github.com/BradLarson/GPUImage
and I am stuck at the point of setting the Header Search Path. I tried setting a path but when I tried importing#import "GPUImage.h" I got an error saying it is not found. Maybe I put in the wrong path? I'm confused about what I should do because I have never used this before (very new to programming). Any help would be greatly appreciated.
First, if you're developing using Xcode 6, you might look at using the new framework support present in iOS 8 (and back to iOS 7, near as I can tell). The project has a true iOS framework that eliminates the need for setting paths to headers, like static libraries require. See the "Adding this as a framework (module) to your Mac or iOS project" section of the instructions for how to use this.
If you're targeting an older version of iOS and/or using an older version of Xcode, you'll need to set the Header Search Paths value in your build settings to be the path to where you installed GPUImage from where your application resides. For example, the sample applications in the examples/iOS directory use a path of
../../../framework
The .. elements in that tell it to step one directory back from the location of your application project. Since the examples reside in GPUImage/examples/iOS/[project], the above relative path leads to GPUImage/framework. If you placed your project and GPUImage in the same encompassing directory, you might use
../GPUImage/framework
instead.
In that path setting, make sure you set the option on the right to "recursive" as well.
Use the sample applications as templates, and compare how they are set up to your application to find areas where you might have deviated from the listed setup instructions. About the hardest part of those instructions is getting the relative path right.
I suggest you use cocoapods. It handles gracefully library dependencies and GPUImage is present there.
cocoapods.org
It is also fairly easy to install and use
Its been a couple of years since I worked on IOS, but now that I've created one with the latest Xcode 5.1 I see that there is a "Global" localization. I've always assumed that if the user has a localization that it is not supported by the app, that it will revert to the Localization native development region property in the info.plist.
Has this changed ? and what does the global do exactly ?
Global localization? Do you mean perhaps "Base localization"?
The question is really too broad to answer in the SO format. In short, however: base localization (coupled with auto layout) allows you to you use your reference language (usually your native language) in your storyboards and xibs. When you add a localization to your app, Xcode generates a strings file for all the text that is contained in each UI file.
Good starting point to read up on the new localization guidelines: Apple Developer Internationalization guide
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.
I was wondering if somebody could explain in the details how I can localize an iOS app using only 1 storyboard. I know how to localize by creating several storyboards(one storyboard for each used language), however I'd like to find out another solution.
Thanks.
The tutorial on raywenderlich.com uses two forms of localization together. The reason is he also checks the storyboard when turning on localisation in image 3:
.
So then what?
NSLocalizedString is very useful, any text set programatically can (and should) be localised using this method. Ray's tutorial is still very useful.
However, it's not very desirable to create a clone of the storyboard(s) to do translation, it's just not very maintainable in the long run.
And what about storyboards?
The magic happens using the Base Localization feature. Base localization uses the generated objectId's to 'map' different languages to the storyboard.
Do note that this feature is only available using SDK 6.0 and above. Running the app on a lower iOS version will not cause any errors, it'll simply won't work.
Go to your project, and select Base Localization, then add any other language.
Open your storyboard file and check the new language as well. Note the icon is not a storyboard icon, but a simple text file icon. That's a good thing; it won't copy the whole storyboard this time :).
Note how there is now another file 'under' the storyboard. Xcode automatically generates a file for every language you select.
You can se Localization feature for this. You need to add the Localizable.strings file for each supported language and use it for locaization.
You need to use : NSLocalizedString() for fetcing data corresponding to each key.
Check this tutorial for details.