Chapter 14. Localization

If an application will be used in more than one part of the world, its resources should be customized, or localized, for the language, country, or cultural region. Cocoa provides a group of conventions and services, known as an internationalization architecture , that are flexible enough to enable multiple localizations of character strings, icons, user interfaces, and even context help packaged into your application. The localized resources appropriate to the user’s preferences are dynamically loaded as needed.

The aim of Cocoa’s localization architecture is to enable multilingual applications to be created without generating any new Objective-C code for each supported locale. Even if you don’t have an immediate need for multilingual support in your application, it is always a good idea to keep the localization abilities of a Cocoa application in mind, so you can enable it when the need arises. With proper design, your application’s source code won’t have to be touched if and when it does need to be localized—minimizing the risk of introducing problems by modifying the code.

In this chapter, we’ll take a look at how Cocoa’s localization system works, how it depends on the user’s language preferences, and how to structure your application’s nib files and use of strings to take advantage of it.

Mac OS X Language Preferences

To see how Mac OS X supports different languages, try the following process:

  1. Open the TextEdit application (/Applications/TextEdit ...

Get Learning Cocoa with Objective-C, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.