Upload
gidgreen
View
153
Download
0
Tags:
Embed Size (px)
Citation preview
11 — Localization
From Code to Product gidgreen.com/course
Getting it wrong
From Code to Product Lecture 11 — Localization— Slide 2 gidgreen.com/course
Something we should know?
From Code to Product Lecture 11 — Localization— Slide 3 gidgreen.com/course
Lecture 11
• Countries and languages • Character sets • Unicode • Text localization • Outsourcing translation • Other localization
From Code to Product Lecture 11 — Localization— Slide 4 gidgreen.com/course
Population
From Code to Product Lecture 11 — Localization— Slide 5 gidgreen.com/course
China 1,347 M 19.3%
India 1,210 M 17.3%
USA 313 M 4.5%
Indonesia 238 M 3.4%
Brazil 192 M 2.8%
Pakistan 179 M 2.6%
Nigeria 162 M 2.3%
Russia 143 M 2.0%
Bangladesh 142 M 2.0%
Japan 128 M 1.8%
Mandarin 845 M 12.1%
Spanish 329 M 4.7%
English 328 M 4.7%
Hindi-Urdu 240 M 3.4%
Arabic 221 M 3.2%
Bengali 181 M 2.6%
Portuguese 178 M 2.5%
Russian 144 M 2.1%
Japanese 122 M 1.7%
Punjabi 109 M 1.6%
2011-2012 from Wikipedia
Economic weight (nominal)
From Code to Product Lecture 11 — Localization— Slide 6 gidgreen.com/course
USA $14.4 T 23.7%
Japan $4.9 T 8.1%
China $4.3 T 7.1%
Germany $3.7 T 6.0%
France $2.9 T 4.7%
UK $2.7 T 4.4%
Italy $2.3 T 3.8%
Russia $1.7 T 2.8%
Spain $1.6 T 2.6%
Brazil $1.6 T 2.6%
English $21.3 T 34.9%
Chinese $5.2 T 8.4%
Japanese $4.9 T 8.1%
German $4.4 T 7.2%
Spanish $4.2 T 6.8%
French $4.0 T 6.5%
Italian $2.5 T 4.1%
Russian $2.2 T 3.7%
Portuguese $1.9 T 3.1%
Arabic $1.9 T 3.1%
2008 from globalization-group.com, IMF
Internet users
From Code to Product Lecture 11 — Localization— Slide 7 gidgreen.com/course
China 485 M 36%
USA 245 M 78%
India 100 M 8%
Japan 99 M 78%
Brazil 76 M 37%
Germany 65 M 80%
Russia 60 M 43%
UK 51 M 82%
France 45 M 70%
Nigeria 44 M 28%
English 565 M 43%
Chinese 510 M 37%
Spanish 165 M 39%
Japanese 99 M 78%
Portuguese 83 M 32%
German 75 M 80%
Arabic 65 M 19%
French 60 M 17%
Russian 60 M 43%
Korean 39 M 55%
2011 from internetworldstats.com
Internet penetration
From Code to Product Lecture 11 — Localization— Slide 8 gidgreen.com/course
E-commerce volumes
$135B
$51B
$37B
$36B $28B $28B $19B
$16B
$15B
$13B
$123B
USA
Japan
China
Germany
France
UK
Italy
Canada
Spain
South Korea
Other
From Code to Product Lecture 11 — Localization— Slide 9 gidgreen.com/course
2009 from Everis
Multilingual countries
From Code to Product Lecture 11 — Localization— Slide 10 gidgreen.com/course
English 21M
French 8M
Canada
German
5.0M
French 1.6M
Italian 0.5M
Switzerland
Language variations
• US vs UK English – color | colour – vacation | holiday – Where are you (at)?
• European vs Brazilian Portuguese • French • Spanish
From Code to Product Lecture 11 — Localization— Slide 11 gidgreen.com/course
Language codes (ISO-639-1)
From Code to Product Lecture 11 — Localization— Slide 12 gidgreen.com/course
ar Arabic
fr French
nl Dutch
de German
he Hebrew
it Italian
ja Japanese
pl Polish
ru Russian
es Spanish
zh-CN Chinese (simplified)
zh-TW Chinese (traditional)
en-GB English (UK)
en-US English (US)
pt-BR Portuguese (Brazilian)
pt-PT Portuguese (Portugal)
es-AR Spanish (Argentina)
es-CL Spanish (Chile)
es-MX Spanish (Mexico)
es-ES Spanish (Spain)
Lecture 11
• Countries and languages • Character sets • Unicode • Text localization • Outsourcing translation • Other localization
From Code to Product Lecture 11 — Localization— Slide 13 gidgreen.com/course
Computer representation
From Code to Product Lecture X — SUBJECT— Slide 14 gidgreen.com/course
0 1 0 0 0 0 0 1
0 … 65 … 255 .,/?;:’!%abcdefghijklmnopqrstuvwxyz… A …BCDEFGHIJKMNOPQRSTUVWXYZ0123456789
00 … 41 … FF
US-ASCII
From Code to Product Lecture 11 — Localization— Slide 15 gidgreen.com/course
Image from czyborra.com
ISO-8859-1
From Code to Product Lecture 11 — Localization— Slide 16 gidgreen.com/course
Windows-1252
From Code to Product Lecture 11 — Localization— Slide 17 gidgreen.com/course
ISO-8859-5
From Code to Product Lecture 11 — Localization— Slide 18 gidgreen.com/course
ISO-8859-8
From Code to Product Lecture 11 — Localization— Slide 19 gidgreen.com/course
Problems with character sets
• Extra metadata • Potential for misdisplay • Mutually exclusive • Little space to grow - e.g. € • Ideographic languages – 70,000+ Chinese characters – Multibyte encoding
From Code to Product Lecture 11 — Localization— Slide 20 gidgreen.com/course
Lecture 11
• Countries and languages • Character sets • Unicode • Text localization • Outsourcing translation • Other localization
From Code to Product Lecture 11 — Localization— Slide 21 gidgreen.com/course
The Unicode solution
• One global character set – Over 110,000 characters – Over 100 alphabets
• 1,114,112 code points – 0…255 compatible with ISO-8859-1 – U+0041 = A
• Multiple encodings
From Code to Product Lecture X — SUBJECT— Slide 22 gidgreen.com/course
U+0000 … U+007F
From Code to Product Lecture 11 — Localization— Slide 23 gidgreen.com/course
U+0080 … U+00FF
From Code to Product Lecture 11 — Localization— Slide 24 gidgreen.com/course
U+0400 … U+047F
From Code to Product Lecture 11 — Localization— Slide 25 gidgreen.com/course
U+0590 … U+060F
From Code to Product Lecture X — SUBJECT— Slide 26 gidgreen.com/course
U+4E00 … U+4E7F
From Code to Product Lecture 11 — Localization— Slide 27 gidgreen.com/course
U+2190 … U+220F
From Code to Product Lecture 11 — Localization— Slide 28 gidgreen.com/course
U+2800 … U+267F
From Code to Product Lecture 11 — Localization— Slide 29 gidgreen.com/course
UTF-16 encoding
• 2 or 4 bytes per code point • Simple for U+0000…D7FF and E000…FFFF – “Basic Multilingual Pane”
• Higher code points use 4 bytes • U+FEFF = byte-order mark – No well-followed default
• Windows APIs since Windows 2000 – Also .NET, Android, iOS, Mac OS X
From Code to Product Lecture 11 — Localization— Slide 30 gidgreen.com/course
UTF-8 encoding
• 1 to 6 bytes per code point • 1 byte for U+0000…007F – Perfect compatibility with ASCII
• 2 bytes for U+0080…07FF – etc…
• Byte order mark allowed – But unnecessary, causes problems
• Dominant on web, email
From Code to Product Lecture 11 — Localization— Slide 31 gidgreen.com/course
UTF-8 encoding
From Code to Product Lecture 11 — Localization— Slide 32 gidgreen.com/course
UTF-8 advantages
• Natural compression for English • English works in old tools/APIs – HTML tags unaffected
• No shared values between byte types – Easy to synchronize mid-stream – Easy to search by byte value
• No zero bytes (good for C) • Byte-sorting = codepoint-sorting
From Code to Product Lecture 11 — Localization— Slide 33 gidgreen.com/course
Unicode on the web
From Code to Product Lecture 11 — Localization— Slide 34 gidgreen.com/course
Sour
ce:
goog
lebl
og.b
logs
pot.
com
Lecture 11
• Countries and languages • Character sets • Unicode • Text localization • Outsourcing translation • Other localization
From Code to Product Lecture 11 — Localization— Slide 35 gidgreen.com/course
The original source code
From Code to Product Lecture 11 — Localization— Slide 36 gidgreen.com/course
function Check_Username(username) … if Username_Taken(username)… error="username is taken." … return error end function
And now in Spanish…
function Check_Username(username) … if Username_Taken(username)… error="username se toma." … return error end function
From Code to Product Lecture 11 — Localization— Slide 37 gidgreen.com/course
Internationalized
function Check_Username(username) … if Username_Taken(username)… error=Get_String("un-taken") … return error end function
From Code to Product Lecture 11 — Localization— Slide 38 gidgreen.com/course
Internationalized
function Check_Username(username) … if Username_Taken(username)… error=Translate("username is taken") … return error end function From Code to Product Lecture 11 — Localization— Slide 39 gidgreen.com/course
IDs vs English strings
From Code to Product Lecture 11 — Localization— Slide 40 gidgreen.com/course
IDs English strings
More compact code More explicit code
English can be changed Enforces sync between languages
Less error-prone Easier for third parties
Concatenation is evil
print Translate("You will travel from ") + from_city + Translate(" to ") + to_city
From Code to Product Lecture 11 — Localization— Slide 41 gidgreen.com/course
You will travel from London to Paris
Usted viajará de London a Paris
Sie wird von London nach Paris reisen
Substitutions
From Code to Product Lecture 11 — Localization— Slide 42 gidgreen.com/course
raw=Translate("You will travel from %from% to %to%") raw=replace(raw, "%from%", from_city) print replace(raw, "%to%", to_city)
You will travel from %from% to %to% Usted viajará de %from% a %to% Sie wird von %from% nach %to% reisen
Singular/plural
if (credits is 1) c_string=translate("1 credit")
else c_string=replace(translate("%#% credits",
"%#%", credits) raw=translate("You have %credits% left”) print replace(raw, "%credits%", c_string)
From Code to Product Lecture 11 — Localization— Slide 43 gidgreen.com/course
You have 3 credits left You have 1 credit left
Text in images
From Code to Product Lecture 11 — Localization— Slide 44 gidgreen.com/course
Width in layouts أشكركم على الدفع. 感谢您的付款。 Gracias por su pago.
אנו מודים לך על התשלום. Спасибо за ваш платеж. Thank you for your payment. Vielen Dank für Ihre Bezahlung. Σας ευχαριστούµε για την πληρωµή σας. Nous vous remercions de votre paiement. お支払いしていただきありがとうございます。
From Code to Product Lecture 11 — Localization— Slide 45 gidgreen.com/course
+57%!
LTR / RTL
From Code to Product Lecture 11 — Localization— Slide 46 gidgreen.com/course
Outsourcing translation quotes
From Code to Product Lecture 11 — Localization— Slide 47 gidgreen.com/course
Ibidem-translations.com
• Add 15-50% for specialized areas • Clarify how words are counted • Check for extra costs
Lecture 11
• Countries and languages • Character sets • Unicode • Text localization • Outsourcing translation • Other localization
From Code to Product Lecture 11 — Localization— Slide 48 gidgreen.com/course
Numbers
1,234,567.89 — Japan, UK, USA 1 234 567,89 — France, Central Europe 1.234.567,89 — Germany, Scandinavia 1’234’567.89 — Switzerland 123,4567.89 — China 1’234,567.89 — Mexico 12,34,567.89 — India
From Code to Product Lecture X — SUBJECT— Slide 49 gidgreen.com/course
Date and Times
7/21/2012 21/7/2012 21.7.2012 2012-07-12 7. 21. 2012 7-12-2012
From Code to Product Lecture 11 — Localization— Slide 50 gidgreen.com/course
15:45 3.45 PM 3:45 pm
Time zones
From Code to Product Lecture 11 — Localization— Slide 51 gidgreen.com/course
Map from wikipedia.org
Displaying times online
• Store times independent of zone • Options for display – Ask the user for their time zone – Show an explicit time zone – Use “ago” notation
• Javascript to get from browser
From Code to Product Lecture 11 — Localization— Slide 52 gidgreen.com/course
Currencies
• Biggest traded currencies: $ € ¥ £ – But there are almost 200
• How to display – Number formatting – Symbols: ₪ ₩ ฿ $ – Currency codes: USD EUR JPY GBP CAD AUD
• Also: currency conversion – Live feed, e.g. from ECB
From Code to Product Lecture 11 — Localization— Slide 53 gidgreen.com/course
Names
• Surname can come first – China, Japan, Korea, Hungary
• Multiple surnames – José Santos Tavares Melo Silva
• Middle names/initials • Double-barrelled names – Sarah-Jane Darlington-Whit
• No spaces in CJK
From Code to Product Lecture 11 — Localization— Slide 54 gidgreen.com/course
Names
From Code to Product Lecture 11 — Localization— Slide 55 gidgreen.com/course
Full Name:
What should we call you?
Family name:
Other/given names:
• Or localize based on language • Do you need names at all? – Username or email can be enough
Addresses
From Code to Product Lecture 11 — Localization— Slide 56 gidgreen.com/course
John Doe Acme, Inc Suite 3B-3824 294 W Ronson Dallas TX 75211 USA
John Smith Acme, Ltd Flat 384 33 Walton Road Birmingham B26 3QJ UK
〒100-8994 東京都中央区八重洲一丁目5番3号 東京中央郵便局 Tokyo Central Post Office 1-5-3 Yaesu, Chuo-ku Tokyo 100-8994 Japan
C/Pescadoro, 13, 2°, 3ª 28331 – Madrid Spain
Addresses
• Single multi-line field • Change in response to country • Generic format
From Code to Product Lecture 11 — Localization— Slide 57 gidgreen.com/course
Indexing, sorting, searching
• Capitalization and accents – Øyvind matches oyvind?
• Collation (sort order) – Swedish: a b c … x y z å ä ö – French: cote côte coté côté
• CJK (ideographic languages) – No spaces between words – Sort based on stroke count
From Code to Product Lecture 11 — Localization— Slide 58 gidgreen.com/course
Domain names
• Country-code top-level domains – .fr .de .uk .in .br .jp .cn
• Need separate registrar for many • Some countries have restrictions – .com.au requires registered company – .ca requires nationality/residence – Also restricted: .fr .br .cn .ie .jp …
• Internationalized domain names
From Code to Product Lecture 11 — Localization— Slide 59 gidgreen.com/course
And there’s more…
• Phone numbers • Units of measurement • Colors • Images of people • Calendars • Border disputes • Culture • Law From Code to Product Lecture 11 — Localization— Slide 60 gidgreen.com/course
Google in China
• 2005: Chinese language google.com • 2006: google.cn under censorship • 2009: China blocks YouTube • 2010: Google claims hacking attack – Redirects google.cn to google.com.hk – China blocks it for a day
• Today: Baidu 79%, Google 17% – Baidu links to MP3/movie downloads
From Code to Product Lecture 11 — Localization— Slide 61 gidgreen.com/course
Getting real
• It’s time consuming and costly • Cheap wins in version 1.0 – Parameterize + functionize – Use Unicode throughout – Flexible layouts
• See where there is demand – Identify most important locales
From Code to Product Lecture 11 — Localization— Slide 62 gidgreen.com/course
Getting real
• Don’t skimp the details – Needs to look native
• Use serious service providers • Prepare for tech support – Machine translation an option?
• It will slow development – So wait for product maturity
From Code to Product Lecture 11 — Localization— Slide 63 gidgreen.com/course