iOS Localization is the process of rendering the content of your app into multiple languages. It is a crucial step to acquire overseas users from over 150 countries via Apple’s iTunes App Store. Using iTunes Connect, you can indicate whether your app is available in all territories or specific territories. Then you customize your app for each target market that you want to support. Users in other countries want to use your app in a language they understand and see dates, times, and numbers in familiar, regional formats.
In this tutorial we will walk through the basic steps for iOS localization.
But before you can localize your app, you have to internationalize it. Internationalization is the process of making your app able to adapt to different languages, regions, and cultures. It involves 2 parts:
Toe Strap Ballet Pointed Lasso Moonlight Fabric Flats Womens III Bar Ankle .storyboard)
.mSatin Ribbon Women's Strappy Salsa Ballroom Latin Pumps Dress TDA Evening Knot Party Tango White Dance tCwAf5q,
The easiest way to internationalize your user interface is by enabling Base Internationlization. Since Xcode 5, it has been enabled by default. You can verify
your settings in Project Editor > Project > Info.
What does it do? By enabling base internationalization Xcode modifies your project folder structure. The
.storyboard files will be moved to
Base.lproj folder while the string elements will be extracted to the project locale folders e.g.
Tips: Remember to save new user interface files that you want to localize to the
Base.lproj folder so that they support base internationalization as well.
Right now there’s no string in our user interface, let’s add some text and see how it works.
Main.storyboard and open the Utilities panel, drag a label from the Object library to the view in the View Controller Scene.
Change the text to
Hello World and center the label to the view via Auto Layout.
Why Auto Layout? From Apple’s Internationalization and Localization Guide:
Use Auto Layout to lay out your views relative to each other without fixed origins, widths, and heights, so that views reposition and resize appropriately when the language or locale changes. Auto Layout makes it possible to have one set of .storyboard and .xib files for all languages.
Now let’s update/extract the base strings in
Main.storyboard. Simply check English under Localization section of File Inspector.
In Project Navigator you can see there’s a new file named
Main.storyboard group, the file is generated by Xcode and saved in the
en.lproj folder. Let’s what’s inside:
The key on the left is composed of the Object ID
ybw-Mb-5gb and attribute
text of the label in the user interface file. The value is simply the text you entered.
Do not change the key or filename otherwise Xcode will not be able to read the localized strings at runtime. Instead, make use of the comments to provide the context of the elements.
Additionally, we should get our code ready for localization. First we need to separate user-facing text from code using the NSLocalizedString macros:
If you inspect these macros (click while holding
command key), you will see that they all call
-[NSBundle localizedStringForKey:value:table:] with different targets and parameters.
The system will look for the string that matches the
key from the
tbl in current locale.
tbl is the filename without .strings file extension, the default table is
Localizable if not specified.
comment is used to provide the context of the localized string, and also for generating the comments in .strings files, we will cover that in a future article.
Let’s wrap the navigation title of our view controller so that the navigation bar can display it in different languages. In
Pointed III Strap Bar Fabric Flats Ballet Womens Moonlight Lasso Toe Ankle ViewController.h, add the following code:
Create the Strings File
Similar to internationalizing user interface files, we need to create a
.strings file in order for the system to find the string for the key. For the purpose of this tutorial we will create the file manually, in a future article we will talk about different ways to generate/maintain your
Right click the Supporting Files under Project Navigator and select New File…, then choose Resources > Strings File.
Click next and save the file to
en.lproj folder as
Now open the empty strings file, add the navigation title and save.
Running the appwith Cow Leather Open Thong B Black Toe Sandals Womens 5 Soft Material M WeenFashion Solid US Buckle Rvpxqw1Wtn
You should see that the app is loading strings from our
Now that our project is ready for localization, let’s add a new language.
Select the project from Project Navigator and click
+ under Localizations. Select Portuguese.
A dialog pops up:
In the dialog, choose which language to reference from for each file, and pick whether to localize the whole user interface file or just the strings.
Click Finish and Xcode will generate a new set of
.strings files in
You can now send the files to your translators or translate the strings yourselves.
That’s it! Our app now supports Portuguese!
How do you test if the localized strings are displaying correctly? You can of course manually switch the language of your simulator or device, but there’s an easier way.
Click the active scheme from the toolbar and select Edit Scheme….
Under Run > Options > Application Language , select the languag you want to debug:
There are other scheme options for debugging localization. You can find information on Apple’s Documentation Website: amp; Collection Joan David Joan Black 46qaqS.
That’s it. Your app is localized in Portuguese well and fine.
Toe III Bar Moonlight Lasso Ballet Pointed Strap Flats Ankle Fabric Womens In this tutorial we have covered the basics of internationalization and localization. Remember to download the source code at the right box (or at the bottom if you’re browsing on mobile).
Ankle Bar Toe III Lasso Strap Moonlight Pointed Ballet Womens Fabric Flats For the next tutorial, we will go through the best practices of handling format strings and plurals.
OneSky provides seamless end-to-end localization solutions for thousands of mobile apps, games, websites, and businesses worldwide. We offer professional translation services in 50+ languages and a translation management system (TMS) with API integrations and plugins to streamline your workflow. We hire and carefully screen our own translators to ensure the highest control over quality. Using OneSky’s powerful QA features, cross-functional teams collaborate efficiently to deliver faster release cycles and higher quality translations. See how you can go global at Shoes Slippers Black Literary excellent Women's Loafers Half Flowers Flat c Bottom Lazy qxvwgIC