Chapter 15. Internationalization
Internationalization (abbreviated by i18n for 18 characters separating the "i" and the "n"), Globalization (g11n), or Localization (l10n) are terms used to describe equipping software with the ability to adapt to different regions, languages, and customs without modifying the binary code.
Building adaptable software is a major undertaking. It involves having localized text for every supported language, culture-sensitive images and colors, appropriate date and currency formats, and much more.
Once the business decision for globalizing the software has been made and the supported languages and regions have been chosen, developers can use the i18n support built into the iPhone SDK to provide localized behavior of the software.
At the heart of localization in the iPhone SDK is the NSLocale
class. An NSLocale
instance is an object that encapsulates parameters for language, country, currency, dates, etc. A locale can be identified by a string consisting of the language and the region. For example, US English is represented by en_US
, while Arabic Saudi Arabia is represented by ar_SA
.
You use the NSLocale
class and create instances (using, for example, a locale identifier) from it to accomplish various tasks. For example, to obtain an array of the available locales on your system, use the following:
[NSLocale availableLocaleIdentifiers];
The above statement returns an NSArray
instance of locale identifiers (NSString
objects) whose content is similar to the following: ...
Get iPhone SDK 3 Programming: Advanced Mobile Development for Apple iPhone and iPod touch 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.