If you talk to a man in a language he understands, that goes to his head. If you talk to him in his language, that goes to his heart.
Nelson Mandela
This chapter focuses on the International settings available on an iOS device, be it an iPhone, iPad, or iPod Touch. I’ll give an overview of the settings and their functionality and answer these questions: What changes? What do I need to keep in mind when developing my app? What do the customers expect to change? How do I know I’m seeing the correct format displayed? This chapter closes with covering the Region Format settings.
Chapter topics include the following:
What languages are available
What calendars are supported and their background
Examples of regional formatting, including
Currency
Date and Time formats
Decimal and thousands separators
Sorting
Quotation marks
All three iOS devices support exactly the same International settings:
Language
Voice Control
Keyboards
Region Format
Calendar
You can find these settings in the Settings app by tapping General, International, as shown in Figure 1.1.
Which languages does iOS support right out of the box? What can you start coding for today? As of iOS 7, iOS supports 37 languages. You’ll find this list on your device by going to the Settings app, General, and then tapping Language, as shown in Figure 1.2. Table 1.1 also lists the supported languages for iOS.
The table is sorted by the English translation of the language name. This is strictly for readability because the actual order on your device will vary. Vary how? When you choose a language to set as the System default language, that selection moves to the top of the list. When a different language is tapped, that currently selected language is moved to the top, and the previously chosen language is moved to the second place. The order is dynamic, but Table 1.1 is static for easier reference.
What jumps out at you first? For me, it is the region’s language listed in its native dialect, resulting in the French language actually being listed as “Français.” This is reasonable, because native speakers will want their language listed in the vernacular with which they are familiar.
Tapping the desired language sets it for your entire system, affecting all installed and running applications. Take note that when you do change the System language setting, this terminates all running applications. At this point, any app developed to support that selected language would display its strings and icons represented in that language.
Figure 1.3 displays Apple’s Pages app for the iPhone with the System language set to Japanese. Note how all information in the app is displayed in the Japanese language. Think of the reaction of the customers, how much more engaged they feel having this application more accessible to them. This is the goodwill you want to generate, both to have a person enjoy your app and to hopefully generate some free advertising.
Voice control is the setting option for iOS’s voice recognition feature Siri. It is a requirement for voice recognition software to, well, understand your voice. Because that voice can be in a different “tongue,” this setting allows customers to use the Voice Control command in their native language. Two separate sections are available, the first set of options being for Siri and the second for the Voice Dial Only feature.
With a selection made from the Siri section, when speaking in one of the listed languages, a customer can perform commands such as to open apps, do a web search, set up reminders, get directions, and many more. Selecting a language in this section will remove any selections in the Voice Dial Only section and enable the Siri feature.
The following list includes the languages supported by the Siri feature for iOS 7:
Chinese (Cantonese—Hong Kong)
Chinese (Mandarin—China)
Chinese (Mandarin—Taiwan)
English (Australia)
English (Canada)
English (United Kingdom)
English (United States)
French (Canada)
French (France)
French (Switzerland)
German (Germany)
German (Switzerland)
Italian (Italy)
Italian (Switzerland)
Japanese
Korean
Spanish (Mexico)
Spanish (Spain)
Spanish (United States)
The Voice Dial Only section allows customers to dial people listed in the address book by speaking the contact’s name using one of listed languages. Selecting a language in this section will disable the Siri feature.
The following list includes the languages supported by the Voice Dial Only feature for iOS 7:
Chinese (Cantonese—Hong Kong)
Chinese (Mandarin—China)
Chinese (Mandarin—Taiwan)
Danish
Dutch
English (Australia)
English (Canada)
English (United Kingdom)
English (United States)
Finnish
French (Canada)
French (France)
German
Italian
Japanese
Korean
Norwegian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Russian
Spanish (Mexico)
Spanish (Spain)
Swedish
Note
It’s funny that these list entries specify which spoken language is going to be used, but they’re not listed in the locale’s dialect. Now, if you change the System language, these Voice Control list entries reflect the selected language. But if you change the System language to Español, would you really want to change the voice control language to “Chino (Cantonés—Hong Kong)?” I’m curious as to why Apple is not consistent, having all language choices listed in their local dialect, as it does for the Language setting.
The Keyboards setting allows you to choose what soft keyboard to add and have available in any application. The keyboard layout, that is, the location of the keys, matches the layout for physical keyboards for a given language. Figure 1.4 shows the Keyboards setting. Figure 1.5 shows the support settings for both software and hardware keyboard layouts for a German keyboard. The hardware layout would be for a Bluetooth keyboard or for a desktop keyboard when working with the simulator.
This setting allows you to specify which keyboards to add, as opposed to simply listing every keyboard the iOS supports. One of the reasons for this is that you can switch keyboards while you are in applications. If you hold down the “globe” key (a standard key on every keyboard; see Figure 1.6), all the keyboards you’ve added will be displayed. Tapping the globe key will switch keyboards throughout the list.
Having the keyboard for the chosen language makes sense; this gives your customers the key layout they are used to with their physical keyboard. What might be a bit confusing is why the option or ability to switch to other added keyboards is offered. If your language is set to English (U.S.), why would you want the ability to switch to a Spanish keyboard? There are two important reasons for this:
The autocorrect dictionary is connected to the active keyboard. In the example I’ve given, working with an English (U.S.) system, when I switch the keyboard to Spanish, as I type I get Spanish autocorrect suggestions. This option gives a user easy access to a gamut of characters within the same document.
Keyboards’ main functionality is inputting characters. We are able to insert pictograph characters such as Chinese, Korean, and Japanese characters with a QWERTY/Latin type of keyboard because the keyboard is an IME—input method editor—that will convert phonetically entered characters to candidate characters. For example, when you’re working with the Japanese keyboard to enter the word sushi, keying in su gives the character , and then keying in shi suggests the character . On the topic of inserting individual characters, one of the available keyboards to add is the Emoji keyboard, allowing easy access to those characters.
iOS 7 supports three calendars, whose settings options are shown in Figure 1.7:
Gregorian
Japanese
Buddhist
Let’s break down each of these calendars to better understand them in general and to better understand how our customers use them, as well as the calendars’ cultural significance. This section is assigned to be an overview and give you a quick understanding of the three listed calendar types. Manipulating dates, that is, pulling the month or the day from a given date and modifying the date format, is covered in later chapters with code examples.
The Gregorian calendar was introduced in 1582 (Gregorian date) by Pope Gregory XIII, hence the name “Gregorian.” This was a reform to the previous Julian calendar. For U.S. developers and most of the Western world, the calendar we are used to is the Gregorian calendar. It is the most widely used civil calendar, and you will often hear it referred to as the Western or Christian calendar. It is an unofficial global standard, accepted by both the United Nations and the Universal Postal Union. It consists of 12 months of varying numbers of days.
Traditionally, the Japanese calendar has been based on eras relating to who the reigning emperor was. Often, this imperial date format is required for official government applications and documentation. The format of imperial dates is the name of the era, followed by year, month, and then date. Given a Gregorian date example in the Japanese format, such as “2013-01-13,” this date would be represented in a Japanese imperial style as “.” Japanese western style would represent this date as “.” The year 2013 was the 25th year of Heisei (), which began in 1989 as Year 1.
The Buddhist calendar is based on the birth of Buddha, which is accepted to have occurred in 543 B.C. The Buddhist calendar differs from the Gregorian calendar only in the year. To convert a Buddhist year, you simply add 543 to the Gregorian year. Given a date of “June 5, 2014,” the Buddhist equivalent would be “June 5, 2557.” A quick list of countries that use the Buddhist calendar would include mainland Southeast Asian countries Sri Lanka, Laos, Myanmar, and Thailand.
Previous sections focused on the languages that iOS supports. For region formats, iOS supports nearly 250 regions. It would be impractical, not a judicious use of the reader’s time, and quite a bit of overlap to discuss each individual region format setting in detail. Because many region settings can be captured in the same categories as the language, I will break down the regions based on countries that use the iOS supported languages. This will not be an exhaustive examination of region formats but will give adequate coverage. For example, I’ve pulled out the country “Brazil” from the “Portuguese (Brazil)” language entry and then listed Brazil’s currency symbol, decimal separator, and so on.
Region formatting affects the following:
Date format
Time format
Telephone format
List separator
Decimal separator
Thousands separator
Changing the region format will affect how your application displays the data to the user. This formatting is completely taken care of by our use of the NSLocale
, NSNumberFormatter
, and NSDateFormatter
Objective-C classes. By taking advantage of these classes, you do not need to worry about making these format changes via hard-coded strings within your code. You do need to verify that your app is displaying the correct formats, and this section provides the examples for you to do just that. Each item from the preceding bulleted list is broken into an individual section that gives details about the item.
Figure 1.8 shows a quick snapshot of the entire Region Format list that is found under Settings.
Here are some specifics to call out about Figure 1.9:
The date format is in Japanese imperial. That comes from the calendar being set to Japanese.
The time format is in 24-hour format.
The telephone number format is specific to the Japan region.
The formatting of dates and their representation are not consistent across the globe. Although each date displays the day, month, and year, the order of these date items and the separators used vary greatly. The case of the text can be different as well. Table 1.2 continues our trend of displaying countries. The entry next to each country is a generic sample of the default long date format. For example, the full date format for the United States is “Wednesday, September 22, 2004,” which is noted in Table 1.2 as “Day of week, Month day, year.” Note that if the default entry is lowercase, that entry is displayed lowercase.
Table 1.3 list samples of date styles, shown in long and short formats. These examples are based on English (U.S.) region settings. The biggest thing to note here is to correctly handle short names for the name of the month and the day of the week.
With short date styles, know that different separators can be used. There are no hard-and-fast rules for these; date components can separated by dashes or hyphens (–), forward slashes (/), or spaces. Keep this in mind when verifying your application so that it meets your customers’ expectations.
Time format support is going to be in one of two styles: AM/PM or 24 Hour. The “clock” terms a.m. and p.m. are seldom used and often unknown outside of English-speaking countries. Note that “a.m.” is an abbreviation for the Latin ante meridiem (before midday) and “p.m.” an abbreviation for post meridiem (after midday). The more prevalent time format is the 24-hour or “military” format. This term comes from the convention that both the day and the clock have 24 hours. The clock hours are indicated by the number of hours that have passed since midnight—0 to 23. The international standard ISO 8601 uses the 24-hour format. One of its strengths is that it eliminates ambiguity when used to record the time (“Did he mean 3 a.m. or 3 p.m.?”).
As shown in Table 1.4, of the 35 countries this chapter focuses on, only 7 of them do not use the 24-hour clock as their default time format.
As shown in Table 1.5, telephone formats vary for the countries and use different separators such as periods and hyphens. The formats also vary by different groups: two, three, four, five, and six digits per group and a different number of total digits used. Country codes for telephone numbers can be from one to three digits. Be flexible when designing your code to support inputting and storing of phone numbers.
To keep things interesting, many countries use their own monitory representations. Currency can be broken down into two separate categories: currency symbol and currency code.
The currency symbol is what we’re all most familiar with: $, £, €, ¥. Looks at bit like a comic-strip panel with one of the characters cursing, doesn’t it? Currency symbols are graphical symbols used as shorthand for a currency’s name. The other category is currency code, which is composed of a country’s Internet country code and a third character that denotes the currency unit. Table 1.6 lists countries with their currency symbols as well as their corresponding currency codes. Be mindful of both when displaying them in your UI. We dig into currency codes and their ISO goodness in later chapters.
Sorting is organizing data in an ordered way. Ordering examples include alphabetic or numeric, either descending (Z to A, larger to smaller) or ascending (A to Z, smaller to larger). The current language setting influences the sort order of specific characters. Languages vary regarding which types of comparisons to use to determine sort order and constitute a fundamental element for sorting. You need to be mindful of this when you have an ordered list of data that you want to present in either a table view or a picker view, for example. People naturally gravitate to an alphabetically sorted list and will immediately notice something out of that order. Before you populate a list control, it’s best to sort that array and take advantage of the localizedCaseInsensitiveCompare
method, which we’ll go into in greater detail in future chapters. Some specific examples of unique comparisons include these:
The Swedish language treats an umlaut a, ä, as an individual letter, sorting it after z in the alphabet. German, however, sorts it as an ae or like other accented forms of a, thus following the letter a.
In Slovak, the digraph ch sorts as if it were a separate letter after h.
In Swedish, the characters Å, A, and B are alphabetically sorted as A, B, and Å. Doing a sort of the same characters under the English language, the resulting sort would be A, Å, and B.
Of the 34 countries we’re focusing on, 97% of them use the metric system (see Table 1.7). Note that this table is organized differently than other tables, with two measurement categories—metric and U.S.—and the countries that use that system.
A specific symbol is used to separate a group of digits, separating the integer portion (nonfraction) of a number from its fractional portion. The example “3.1428” has the integer portion “3” separated from its fractional portion “1428” by a period. This symbol is referred to as a “decimal mark.” Traditionally, this symbol is either a period or a comma, with approximately 60% of the world’s population using the period.
Very similar in functionality to the decimal mark, in that it is used to separate groups of numbers, is the thousands separator. This symbol is used to group thousands (1, 10, 100). The choice of the decimal mark affects what symbol is used for the thousands separators. Typically, if a comma is used for the decimal mark, then either a space or, in rare cases, a period is used as the thousands separator.
Table 1.8 lists the country and the character it uses for each type of separator. Both the decimal mark and the thousands separator referenced here are specific to working with Arabic numerals.
In a section that includes a discussion about quotation marks, I am fighting the temptation to “quote everything.” Quotation marks, or quotes, can vary depending on the language and the country referenced. They are punctuation marks used in pairs used to set apart a quotation, a phrase, or direct speech. The pairs consist of an opening and a closing quotation mark. You might also hear them referred to as inverted commas, double quotes, or speech marks.
The country names and the quotation marks they most commonly use are found in Table 1.9.
Wrapping up this region format section are two subsections that are important and have a smaller audience: vertical text and list separators.
Chinese, Japanese, and Korean are examples of East Asian scripts that can be written vertically as well as horizontally. These languages have this option because they consist of mainly disconnected syllabic units, each of these units occupying a square block of space.
Although iOS does not have direct support for vertical text layout, you’ll want to keep this in mind if asked by your customers, “Hey, where’s my vertical text support?”
List separator characters are not that common among region formats. For the most part, either a space or a comma is used as a list separator. For France, Saudi Arabia, and Spain, the semicolon (;) is used as the list separator. Its general use is as a separator for distinguishing between arguments. It’s also used as a delimiter when generating text files of data. With the System set to French, an iOS application that supports parsing delimited files will expect the default delimiter to be a semicolon as opposed to a comma.
This chapter introduced you to the International settings of the Settings app. It showed the various formats and samples for more than 30 countries. My hope is that the next time you look at a date, measurement, or telephone number, you’ll think of at least three other countries and their formats!
Now that you have a better idea of what goes into internationalizing that app of yours, we’ll go into more specifics and more code base topics. We’ll be putting these topics into action and seeing what you need to control and what you’ll get for free from the System.