Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

An i18n Journey

274 views

Published on

An i18n Journey

Published in: Software
  • Be the first to comment

  • Be the first to like this

An i18n Journey

  1. 1. An i18n Journey Andy Waite November 2013
  2. 2. notonthehighstreet.com notonthehighstreet.de
  3. 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. 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. 5. Database State Values Generally not i18n friendly <%= order.status.titleize %> Order.where(status: ‘shipped’)
  6. 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. 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. 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. 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
  10. 10. blog.andywaite.com @andyw8
  11. 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

×