rails i18n from the trenches

55
Rails i18n From the Trenches Clemens Koer

Upload: clemensk

Post on 19-Jan-2015

2.667 views

Category:

Technology


1 download

DESCRIPTION

Slides from my talk at Rails Underground. Video from the guys as SkillsMatter will follow.License: Creative Commons Attribution-Noncommercial-Share Alike 3.0If you want to use my presentation in some way prohibited by this license, please get in touch with me and get my permission.

TRANSCRIPT

Page 1: Rails I18n From The Trenches

Rails i18nFrom the TrenchesClemens Kofler

Page 2: Rails I18n From The Trenches

Hi, I’m Clemens!(Clemens Kofler, clemensk)

Page 3: Rails I18n From The Trenches

Today, I’m going to talk about ...

• The latest developments in Ruby/Rails i18n

• Current problems (in Rails) and potential future changes

Page 4: Rails I18n From The Trenches

i18n

Page 5: Rails I18n From The Trenches
Page 6: Rails I18n From The Trenches

http://guides.rails.info/i18n.html

Page 7: Rails I18n From The Trenches

i18n basics in 2 minutes

Page 8: Rails I18n From The Trenches
Page 9: Rails I18n From The Trenches

Do you like Gettext?(of course it’s fake)

Page 10: Rails I18n From The Trenches

_

s_

p_

n_

ns_

np_

t

Page 11: Rails I18n From The Trenches
Page 12: Rails I18n From The Trenches
Page 13: Rails I18n From The Trenches

i18n news

Page 14: Rails I18n From The Trenches

Additions in i18n 0.2.0

• translation procs

• custom namespace separators

• Ruby 1.9-style string interpolation

• (symlinked translations)

Page 15: Rails I18n From The Trenches
Page 16: Rails I18n From The Trenches
Page 17: Rails I18n From The Trenches
Page 18: Rails I18n From The Trenches
Page 19: Rails I18n From The Trenches
Page 20: Rails I18n From The Trenches
Page 21: Rails I18n From The Trenches

+ a bunch of neat plugins(list at the end)

Page 22: Rails I18n From The Trenches

Additions in i18n 0.2.0

• translation procs

• custom namespace separators

• Ruby 1.9-style string interpolation

• (symlinked translations)

Page 23: Rails I18n From The Trenches

bleeding edge

Page 24: Rails I18n From The Trenches

Current edge

• Base backend + module includes

• Pluralization module

• Cache module

• Locale fallbacks module from Globalize 2

• Chain backend from Globalize 2

• Gettext support (experimental)

Page 25: Rails I18n From The Trenches
Page 26: Rails I18n From The Trenches
Page 27: Rails I18n From The Trenches
Page 28: Rails I18n From The Trenches
Page 29: Rails I18n From The Trenches
Page 30: Rails I18n From The Trenches
Page 31: Rails I18n From The Trenches
Page 32: Rails I18n From The Trenches
Page 33: Rails I18n From The Trenches

Current edge

• Base backend + module includes

• Pluralization module

• Cache module

• Locale fallbacks module from Globalize 2

• Chain backend from Globalize 2

• Gettext support (experimental)

Page 34: Rails I18n From The Trenches

Current problems

• Tools

• Data input

• CLDR compliance

• Some unfinished integration (Date/Time#to_s, labels)

• Bad Rails implementations (AR Errors)

• (Clean) routing i18n nearly impossible

• (Gettext support / “enterprise-readiness”)

Page 35: Rails I18n From The Trenches

Tools

Page 36: Rails I18n From The Trenches

http://github.com/svenfuchs/i18n-tools

Page 37: Rails I18n From The Trenches
Page 38: Rails I18n From The Trenches
Page 39: Rails I18n From The Trenches

Parsing dates/times isreally hard

(you can try out my experimental delocalize plugin)

Page 40: Rails I18n From The Trenches
Page 41: Rails I18n From The Trenches
Page 42: Rails I18n From The Trenches
Page 43: Rails I18n From The Trenches
Page 44: Rails I18n From The Trenches
Page 45: Rails I18n From The Trenches

You can do something like this with translate_routes but it’s basically a really

scary hack.

Page 46: Rails I18n From The Trenches

i18n vs. Gettext?

Page 47: Rails I18n From The Trenches

War? Not really.

Page 48: Rails I18n From The Trenches

We are not Gettext(and we don’t want to be)

((ever))

Page 49: Rails I18n From The Trenches

Recommendations

Page 50: Rails I18n From The Trenches

The Setup

• i18n edge

• Translations from GitHub

• (Globalize 2 for model translations)

• (localized_dates for transparent date handling)

• (delocalize for parsing localized input)

• (translate_routes for i18n routing)

Page 51: Rails I18n From The Trenches
Page 52: Rails I18n From The Trenches

Questions?

Page 53: Rails I18n From The Trenches

Some resources

• http://rails-i18n.org

• http://guides.rails.info/i18n.html

• http://github.com/svenfuchs/i18n

• http://github.com/svenfuchs/rails-i18n

• http://github.com/svenfuchs/i18n-tools

• http://groups.google.com/group/rails-i18n

• Pluralization rules: http://gist.github.com/106372

Page 54: Rails I18n From The Trenches

[email protected]

http://www.railway.at

http://github.com/clemens

Page 55: Rails I18n From The Trenches

Image credits

• http://www.sxc.hu/photo/708615

• http://www.flickr.com/photos/ferneyes/469259974/

• http://aceitapretzel.files.wordpress.com/2008/09/dexter-ap.jpg

• http://www.flickr.com/photos/dunechaser/2936384313/

• http://www.festivalcervantino.gob.mx/Ficesmas/prensa/galerias/oct/12/Hamletokok/images/061012_hamlet_20FGJ.jpg

• http://www.flickr.com/photos/srgblog/1408923862/

• http://www.flickr.com/photos/purrr/126597849/