View
0
Download
0
Category
Preview:
Citation preview
Growing Up with Globalization
Andrew Turgeon - IBM - Pittsburgh, PAapturgeo@us.ibm.com
1
2
In the Beginning…
3
4
5
6
7
8
9
10
New Customer!Except they require the following:
• 8 languages other than English
• Culturally-accurate data formats
• Timezone support for 12 unique locations
• Bidirectional text capabilities
11
Wish I would have prepared for that before I wrote all this code…
12
Agenda• Statistics Overview
• Globalization
• Getting Started
• Basic I18n - The Rails Way
• Variables & Pluralization
• Culture-Specific Data Formats
• Bidirectional Languages
• Testing
• Takeaways
13
Statistics OverviewLanguages of the Internet (2015)
English26%
Chinese21%
Spanish8%
Arabic5%
Portuguese4%
Japanese3%
Russian3%
Malay3%
French3%
German3%
Other22%
74% of Internet traffic in 2015 was from users
who prefer or only speak languages other than
English
14
http://www.internetworldstats.com/stats7.htm
520%
0%
1,750%
3,500%
5,250%
7,000%
Japa
nese
Ger
man
Engl
ish
Fren
ch
Oth
er
Span
ish
Mal
ay
Portu
gues
e
Chi
nese
Rus
sian
Arab
ic
Growth of Internet Users By Language (2000-2015)
15
Statistics Overview
http://www.internetworldstats.com/stats7.htm
Statistics OverviewTimezones of the Internet
*Currently 39 Unique Local Times in use
16
http://royal.pingdom.com/wp-content/uploads/2013/02/internet-users-time-zones-pingdom-5801.jpg
I get it. What do I need to do?
17
Globalization (in a nutshell)
Internationalization (i18n)
Localization (l10n)
Our Job
18
Step 1 Step 2
Watson Explorer
Lots of… English…19
Getting Started
• You can retrieve the locale from the user preferences (best)• Or you can try getting it from the accept language header (ok)
• Using the pre-bundled I18n framework in Rails, add the following to the controller:
*Make sure to use it in the html tag!
20
Basic I18n - The Rails Way
Somewhere in a galaxy far far away…
../config/locales/en/activity_feed.yml
• DON’T REUSE same text• Hierarchy with short keys
BAD
*Note: Use ellipsis character (…), not three dots (...)21
../app/widgets/activity_feed/display.html.erb
Variables & Pluralization
• Use interpolated variables for dynamic data• More plural forms exist in other languages
Bad
22
Culture-Specific Data Formats
• Define all your formats in key-value lookups, including defaults• Follow similar structure for currency, numbers, and percentages
Bad
23
*Required hierarchy for I18n.l usage
Timezones• Always store in UTC (ISO6801)• Always consume in currently configured timezone• Make sensible defaults, but user setting is preferred
Bad
Example: Time visualizations in Javascript
24
Bidirectional LanguagesNot all languages read the same direction!
• Use Unicode• For both right-to-left AND left-to-right text at the same time, use
embedded tags to indicate text direction
HTML5
25
• Serve mirrored CSS for absolute/relative positioning
Testing• Static code analysis with i18n-tasks gem
• Testing dynamic translations (with RSpec):
• Transitioning from non-i18n to i18n, create a “foo” or longer word language pack for testing (easy to spot non-foo)
26
Takeaways• Treat language as an abstraction from the beginning (sooner the better)
• Don’t try to be a hero when doing i18n
• Getting started isn’t too bad when you use a framework that is:
• Maintainable
• Modifiable
• Testable
• Translatable
• addresses main pitfalls discussed in this presentation
27
Q&A
28
Andrew Turgeon - apturgeo@us.ibm.com
Thanks!
29
Recommended