Jump to content

iPhone Localization Tips

0
  adfm's Photo
Posted May 24 2010 02:03 PM

If you'd like to sell your iPhone app in non-english speaking countries, you're going to want to localize you app to target specific languages. This excerpt from Craig Hockenberry's iPhone App Development: The Missing Manual will get you going with some localization (l10n) tips.


Most of the effort in localization involves changing words. You say "white;" Italians say "bianco." In localized apps like this one, Cocoa helps you pick the right word with a file called Localizable.strings. This file acts as a small database that maps keys to values. If you look up a string with the key White, it will return the value Bianco on phones that are configured to use Italian. If any other language is selected, "White" is returned.

Note

The default language is defined as English in the Info.plist file.

Actually, it's a lie to say there's one Localizable.strings file—multiple copies exist, one for each language. If you open the Flashlight Pro project in the Finder, you see English.lproj and Italian.lproj in the Resources→Localizations folder. These folders contain the files used in each language.

When NSLocalizedString() is used, you performed the lookup. Here's a example:

NSLocalizedString(@"White", nil)

Italians will be loading files from Italian.lproj, so this line in Localizable.strings will come up as a match:

"White" = "Bianco";

Other users will have loaded the same file from English.lproj, so this will be the match:

"White" = "White";

When you're doing localization, make sure that words don't creep into other parts of your application. A great example is images: If the source text for the graphic is buried in a Photoshop layer, you'll find that your graphic designer isn't a very good translator and that your translator isn't a very good artist. Keep the text separate and your life will be much easier.

Localization logistics

You have two major hurdles when doing localization: finding a native speaker to do the translation and testing the final product. As you look through the Italian words in Localizable.strings, it looks great. There are plenty of accents and cool-looking foreign words. There's just one problem: A native speaker did not do this localization.

Note

Your humble author spent several years living in Italy. This language perfect he has not, but good it is.

Don't use automated tools or get your second cousin's best friend who spent 6 months overseas to do the translation. A native speaker will be able to tell that it's wrong and you'll make a bad impression. For many users, a bad localization is harder to use than the original English.

Once you've done the translation, you encounter the second problem. Unless you're an amazing polyglot, there's no way you can know if the localization is correct. You need to find someone who speaks the language and to get him or her to test it for accuracy.

You should, however, verify that the localization is functionally correct. You want to make sure that all the words have matches during the lookup phase.

The easiest way to do this is by using the Settings application in the Simulator. Tap the settings icon, and then pick the first item in the list (General). In the next menu, tap the third item from the top (International). Then pick the first item in the list (Language) to see a list of all available language settings. (Knowing the relative position of all these buttons is important: You need to know which buttons to push in order to switch back to English!)

While you're changing your language settings, try setting Italian and running the Safety Light application. Seeing the localization in action will give you a better feel for how it all works.

Note

Why go through this hassle? About half of your revenue in iTunes will come from outside the United States. The more you cater to these users, the more you sell. No one ever promised that making money would be easy.

Layout breakage

Sometimes differences in language cause view layouts to change. For example, the button width for "Tap to close" in English is going to be very different than its literal counterpart in German: "Zum Schließen antippen".

One approach your translator could take is to find a similar meaning that's shorter. For example, "Tap to close" could be shortened to the German word for close: "Schließen". The width of both phrases is similar, making the visual design easier without sacrificing comprehension.

Note

Apple uses this technique with some of its system controls. For example, "Entriegeln" is displayed instead of "slide to unlock" when you press the Power button on the device.

Another approach to handling phrases with different lengths is to make views adapt to different sizes. The IFInfoView that drops down from the top of the screen is an example. It adjusts its height based upon the message you want to display. If it encounters a long phrase in German, it just displays multiple lines.

A final technique to aid in localization is to use symbols whenever possible. If you've ever traveled abroad, you know that it's much easier to encounter restroom doors with pictures of men and women rather than signs saying "Damen" and "Herren." Hope you guessed right!

This approach was taken with the settings view. The brightness and flasher speed use icons instead of words. No translation is required and users in all languages can understand the function of the sliders.

AboutView.xib

Despite all your efforts to just translate the words, sometimes localizations require a separate NIB file. For example, if you're doing a help screen for a game, you're going to have a lot of text that flows around images and controls. It's easier to change the layout for a whole screen than it is to adapt the text to a single layout.

The AboutView.xib file is an example. You'll see that the file appears in both the English.lproj and Italian.lproj folders. Cocoa loads the correct NIB based upon the user's language settings. You can change any part of the layout; just make sure that the actions and outlets are maintained. If the connection between a button and its action is broken, you have a bug that only users of that language will encounter.

Wrapping It Up

This iPhone app is looking good. It's now time to start beta testing and getting it ready for sale on iTunes. Your coding phase is about to end, but you still have a lot of work to do!

iPhone App Development: The Missing Manual

Learn more about this topic from iPhone App Development: The Missing Manual.

Ready to create your own iPhone app? This book walks you through the entire iPhone app development process. You'll learn how to download the tools, build the app, successfully navigate Apple's approval process, and then market and maintain the finished product. Written by Mac guru Craig Hockenberry, creator of the wildly popular Twitterific iPhone app, iPhone App Development: The Missing Manual includes illustrated, step-by-step tutorials and real-world examples.

See what you'll learn


Tags:
0 Subscribe


2 Replies

 : May 25 2010 02:07 PM
//Comment
When looking for translators it is not only important to only work with native speakers, but also to with translators working on the Mac and owning an iPhone OS device.. When converting your localizable content to formats like excel, the translator does not really know what he is working on, has no context and cannot check his own work. In addition, when localizing Mac or iPhone OS apps, you need to be familiar with the OSes lingo and specific requirements. Technical background information is also a benefit.

Have you ever explained to a foreigner how to deal with %d (example) and length restrictions? And do you want to explain that to a bunch of translators, each of them asking the same questions?

Have a look on the web and search for translators who have already localized Mac OS applications, or ask in developer groups and mailing lists.

//ADVERTISING ;)

Or just have a look at my profile ;)
0
  Tajmir's Photo
Posted Feb 05 2013 02:30 AM

This is a very useful tool for localizing iPhone apps: poeditor.com. It works efficiently with .strings files, supports collaborative translations, and also has an automatic translation option.