Share
Embed
Internationalization of apps
A short talk held at D·Labs about supporting internationalization in applications.
Dal Rupnik
July 01, 2015
Transcript
38 slides
-
Do we really think that most people will understand
our applications in plain English? Should we maybe care for third world markets? WHY? -
INTERNATIONALIZING OUR APPLICATIONS 3 NORTH AM. 0.5 billion English,
Spanish, French, Danish, … SOUTH AM. 0.4 billion Spanish, Portugese, Dutch, English, … AFRICA 1.1 billion Afrikaans, Arabic, Swahili, Malagasy, Tsonga, … ASIA 4.2 billion Chinese, Hindi, Javanese, Vietnamese, … EUROPE 0.7 billion English, German, Italian, French, Spanish, … World Population -
INTERNATIONALIZING OUR APPLICATIONS 4 INTERNATIONALIZATION When we are developing
applications, we must keep in mind that internationalization is not easy. It might cost us a lot of time and resources, if by any case we need to go fixing things in entire application later. -
INTERNATIONALIZING OUR APPLICATIONS 5 Language Which language is user
speaking? Which language does he view content in? In which language does he want to see content? Most expensive to get it right. Locale Language preferences, region settings, calendar type, default currency. Cannot use for: physical location, identifying language. Region Settings Specific date, time, energy, mass, distance, currency formatting settings. On mobile, many things supported out-of-the-box. A couple of terms -
INTERNATIONALIZING OUR APPLICATIONS 6 There are many problems for
international apps. But usually, when outputting text, we can sort these into 4 larger groups. NAMES TIME OTHER UNITS Localization -
DATE & TIME } Lets take a look at date
and time formats. They can be different not only per language, but even per region! -
INTERNATIONALIZING OUR APPLICATIONS 8 The usual “hh:mm a”, but
is that okay? Lets look at few examples of regular time formats. Most common time formatters are usually wrong. Formatting time 17:26 অপরাh ৫:২৬ 午後5:26 5:26 PM م٥:٢٦ 下午5:26 17.26 -
In U.S. English time is written differently from U.K.:
5:26 AM vs 5:26 am. Notice the lowercase letters. 5:26 AM -
INTERNATIONALIZING OUR APPLICATIONS 10 Formatting time 5:26 PM -
5:26 下午 ✘ Something like “hh:mm A”, right? For Chinese this just does not work! -
INTERNATIONALIZING OUR APPLICATIONS 11 Formatting time 5:26 PM -
下午5:26 ✓ Lets fix this “Ahh:mm”. Are there any easier ways, but if statements? -
INTERNATIONALIZING OUR APPLICATIONS 13 Slovenski pravopis - člen 255.
“Neskladenjska raba pike: Med deli številk, da ločijo enote različnih stopenj (npr. ure od minut, tolarje od stotinov, včasih tudi tisočice od nižjih enot) ali kot znamenje množenja.” Does it seem weird? -
INTERNATIONALIZING OUR APPLICATIONS 14 5:26 PM - 17:26 PM
✘ Formatting time -
INTERNATIONALIZING OUR APPLICATIONS 15 5:26 PM - 17.26 ✓
Formatting time -
DATES Things are quite interesting with displaying time. Are
dates any different? -
INTERNATIONALIZING OUR APPLICATIONS 18 June 3rd - 六⽉月 3rd
✘ Formatting dates Translated back from Chinese this means: Six 3rd month -
INTERNATIONALIZING OUR APPLICATIONS 19 June 3rd - 6⽉月3⽇日 ✓
Formatting dates -
INTERNATIONALIZING OUR APPLICATIONS 20 Formatting dates 2014年6⽉月3⽇日 ✓ Now
lets try the other way around. In Chinese: then becomes in U.S. English: 2014June3 ✘ -
INTERNATIONALIZING OUR APPLICATIONS 21 Formatting dates June 3, 2014
✓ But what we actually want to display: -
INTERNATIONALIZING OUR APPLICATIONS So, what can we do? 22
Locale Date Time English (U.S.) Jun 3, 2014 10:14 AM English (U.K.) Jun 3, 2014 10:14 am French (France) juin 3, 2014 10:14 AM Chinese (China) 6⽉月 3, 2014 10:14 上午 Do not use hardcoded format strings (“MMM d, y h:mm a” - in this example). -
INTERNATIONALIZING OUR APPLICATIONS So, what can we do? 23
Locale Date Time English (U.S.) Jun 3, 2014 10:14 AM English (U.K.) 3 Jun 2014 10:14 French (France) 3 juin 2014 10:14 Chinese (China) 2014年6⽉月3⽇日 上午10:14 Use correct date or time style formatters that output correct format based on configured locale. -
DURATION What if we want to display a specific
time interval? The problem becomes even more complex! -
INTERNATIONALIZING OUR APPLICATIONS Duration, wait, what? 25 U.S. English
French Chinese One hour, fifty minutes Une heure et cinquante minutes ⼀一⼩小时五⼗十分钟 1 hour, 50 minutes 1 heure et 50 minutes 1⼩小时50分钟 1:50 1:50 1:50 About 2 hours Environ 2 heures 约2⼩小时 In certain cases, we must display time as a duration, not explicit date and time. -
INTERNATIONALIZING OUR APPLICATIONS Duration, wait, what? 26 U.S. English
French Chinese June 2 - 6, 2014 2-6 juin 2014 2014年6⽉月2⽇日⾄至6⽇日 9:00 AM - 4:30 PM 9:00 - 16:30 上午9:00 - 下午4:30 June 2, 9:00 AM - June 6, 4:30 PM 2 juin 9:00 - 6 juin 16:30 6⽉月2⽇日 上午9:00 - 6⽉月6⽇日 下午4:30 June 3, 9:00 - 10:00 AM 3 juin 9:00 - 10:00 6⽉月3⽇日 上午9:00⾄至10:00 -
NAMES h I bet nobody of you ever thought about
formatting names. We just assume everyone has first and last name. -
INTERNATIONALIZING OUR APPLICATIONS 28 Formatting names print (first_name +
" " + last_name) ✓ This is the code we usually use to print someones name: Which is fine for English: Barack Obama ✓ -
INTERNATIONALIZING OUR APPLICATIONS 29 Formatting names 黛⽟玉林 ✓ Because
in Chinese, there are no spaces… However, does not work for Chinese: 黛⽟玉 林 ✘ -
UNITS g Many applications are working with at least 1
kind of unit. It can be either currency, energy, length, mass, or something else. -
INTERNATIONALIZING OUR APPLICATIONS Energy, length, mass 31 U.S. English
French Chinese 234 Cal 980 kJ 980 千焦 26.2 miles 42,2 kilomètres 42.2公⾥里 128 lb 58 kg 58千克 74°F 23°C 23°C Various quantities are displayed differently in different regions. -
INTERNATIONALIZING OUR APPLICATIONS Currency 32 English French Chinese Chinese
Yuan yuan renminbi chinois ⼈人民币 Pound Sterling livre sterling 英镑 Japanese Yen Yen japonais ⽇日元 Formatting currency needs a special attention, as it depends on both language and locale! -
WHAT ELSE? u Sometimes we miss some things when localizing,
we are not even aware that they are different in another culture. -
INTERNATIONALIZING OUR APPLICATIONS 35 k Right-to-left Text Lunar,
Buddhist Calendar Different Keyboards Languages such as Arabic are written right-to-left. Need to understand the context of this, so all labels are correctly placed on canvas. There are many types of calendar available, not everyone may use the Gregorian calendar. Must ensure all calendars are supported. On mobile devices, languages and locales can have different on-screen keyboards, especially with glyph languages such as Japanese. Does not end here… -
INTERNATIONALIZING OUR APPLICATIONS Region Locale 37 Internationalization must be
thought of in the beginning. 1 2 Formatting properly represents a hard problem for developers. 3 Careful with dates, times, units, names and text alignment. 4 Why can’t we all just speak the same language? :( Formatting Language v k Summary