An i18n Journey

A
An i18n Journey
Andy Waite
November 2013
notonthehighstreet.com
notonthehighstreet.de
Basics
Lots of extracting to t(…) and l(…)
rails-i18n gem helps a lot for supported languages.
Coverage of dates, times, numbers, error messages.
But doesn’t help for JavaScript-heavy sites
Single or Separate DBs?
Each site to have separate products and suppliers
Scoping everything by site - massive amount of work.
Site was MySQL so couldn’t use Postgres schemas for multi-
tenancy (Apartment gem).
Went with separate DBs for UK and German sites.
Schema migrations run on both sites to keep schemas the same.
But used primary key offsets so that we could potentially merge
back together in future.
Database State Values
Generally not i18n friendly
<%= order.status.titleize %>
Order.where(status: ‘shipped’)
Timezones
Changing timezone -> broken tests -> usually due to a badly
designed test
Zonebie gem (time zone randomization)
Time.parse -> Time.zone.parse
Time.now -> Time.zone.now
.to_time -> .to_time_in_current_zone
Use ISO8601 for APIs (“2012-03-16T14:55:33Z")
Credit Cards
Two-thirds of Germans don’t own a credit card
Second lowest credit card use in all of EU
‘debt’ == ‘guilt’ (Schuld)
Capitalization
German is the only language in the world that requires
the capitalization of ALL nouns.
der amerikanische Präsident
#titleize considered harmful
Crazy Pluralization
English / German: one, other
Icelandic:
one:	 1, 21, 31, 41, 51, 61, …, 0.1, 0.2, 0.3
other	 0, 2-20, 22-30, 32-40, …, 0.0, 2.0, 3.0, …
Arabic:
zero	 0, 0.0, …	
one	 1, 1.00, 1.0, …	
two	 2, 2.00, 2.00, 2.0, …	
few	 3-10, 103-110, 203-210, …, 3.00, 3.00, 4.00, …
many	 11-99, 111-199, 211-299, …, 11.00, 11.00, 12.00, …
other	 100-102, 200-202, 300-302, …, 0.1, 0.2, 0.3, …
http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html
blog.andywaite.com
@andyw8
Lessons Learned
Stick to Rails conventions
Demo to native speakers as early as you can
Consider i18n-friendly-by-default approach:
Store all strings in YAML config
Wrap date/number/currency calls in l(…) in views
1 of 11

More Related Content

Viewers also liked(13)

Internationalization (i18n) PrimerInternationalization (i18n) Primer
Internationalization (i18n) Primer
Lingoport (www.lingoport.com)2.3K views
Sem ProjectsSem Projects
Sem Projects
zacharys540 views
Virus y antivirus informáticasVirus y antivirus informáticas
Virus y antivirus informáticas
German Muñoz Galvis71 views
ενοτητα 3ηενοτητα 3η
ενοτητα 3η
ntinakatirtzi292 views
Virus y antivirus nelson vargasVirus y antivirus nelson vargas
Virus y antivirus nelson vargas
Nelson Vargas130 views
Blog5Blog5
Blog5
Christina Karakotsou69 views
karen-e-malone resumekaren-e-malone resume
karen-e-malone resume
Karen Malone209 views
LocalizationLocalization
Localization
PriyaThakre228 views
La etologia del caballo 1La etologia del caballo 1
La etologia del caballo 1
Camilo Bernal5.8K views
Tasting i18nTasting i18n
Tasting i18n
abhisharma832 views

An i18n Journey

  • 1. An i18n Journey Andy Waite November 2013
  • 3. Basics Lots of extracting to t(…) and l(…) rails-i18n gem helps a lot for supported languages. Coverage of dates, times, numbers, error messages. But doesn’t help for JavaScript-heavy sites
  • 4. Single or Separate DBs? Each site to have separate products and suppliers Scoping everything by site - massive amount of work. Site was MySQL so couldn’t use Postgres schemas for multi- tenancy (Apartment gem). Went with separate DBs for UK and German sites. Schema migrations run on both sites to keep schemas the same. But used primary key offsets so that we could potentially merge back together in future.
  • 5. Database State Values Generally not i18n friendly <%= order.status.titleize %> Order.where(status: ‘shipped’)
  • 6. Timezones Changing timezone -> broken tests -> usually due to a badly designed test Zonebie gem (time zone randomization) Time.parse -> Time.zone.parse Time.now -> Time.zone.now .to_time -> .to_time_in_current_zone Use ISO8601 for APIs (“2012-03-16T14:55:33Z")
  • 7. Credit Cards Two-thirds of Germans don’t own a credit card Second lowest credit card use in all of EU ‘debt’ == ‘guilt’ (Schuld)
  • 8. Capitalization German is the only language in the world that requires the capitalization of ALL nouns. der amerikanische Präsident #titleize considered harmful
  • 9. Crazy Pluralization English / German: one, other Icelandic: one: 1, 21, 31, 41, 51, 61, …, 0.1, 0.2, 0.3 other 0, 2-20, 22-30, 32-40, …, 0.0, 2.0, 3.0, … Arabic: zero 0, 0.0, … one 1, 1.00, 1.0, … two 2, 2.00, 2.00, 2.0, … few 3-10, 103-110, 203-210, …, 3.00, 3.00, 4.00, … many 11-99, 111-199, 211-299, …, 11.00, 11.00, 12.00, … other 100-102, 200-202, 300-302, …, 0.1, 0.2, 0.3, … http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html
  • 11. Lessons Learned Stick to Rails conventions Demo to native speakers as early as you can Consider i18n-friendly-by-default approach: Store all strings in YAML config Wrap date/number/currency calls in l(…) in views