Localize Your iOS App

Whether you build and publish your own applications or build applications for clients, there is probably going to come a time when you will need to localize the application.  Localizing the application allows you to give the users a better experience and a better experience is always a great thing when you have money on the line.  Localizing your apps for iOS is fairly straightforward.  Let’s take a look.

There are essentially two different ways of localizing content in iOS.  The first is to localize just the static text for labels, text boxes, buttons, or anywhere that the text is referenced.  To do this we first need to create a file for all of the text to live.  By default, iOS looks for a file called Localizable.strings.  So let’s create that file:

localized

This file will house all the static text that gets referenced.  The format for the keys is

1
“key” = “the text”;

So for each reference to static text, create a key and text.  To reference that text in the code, simply use:

1
NSLocalizedString(@"key", nil);

Now we are ready to create a version for a different language.  To do this, the easiest way is to click on the Project > Project > Info > Localizations.  Click the plus sign to add another language.  Select only the Localizable.strings file.  This will create another version of the Localizable.strings file for the language you selected.

Add Language

Now it is just a matter of going through and changing the text for each key to match the language that you just added.  Easy right?  Now lets go over localizing files like images or even views or code.  This is actually pretty easy now that we have already selected a new language.  Simply click on the file you want to localize, then click “Make localized…” under the main tab > Localization.  Then you can specify the languages you want to localize it to.  If this is an image or something you can’t edit in Xcode, you can go to the location for the file in the finder to update what the image should be for each language.  You will see that each language has a separate folder for each language with their respective versions of the files.

If you would like to see your app run in a different region in a simulator, simply go into Settings.app and choose General > International > Language > The Language you want.

There you have it.  Localizing an iOS app isn’t all that difficult and the benefits can definitely pay off.  Feel free to let me know if you have any questions or comments.

This entry was posted in Mobile, Technology and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>