Rails I18n From The Trenches

Preview:

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.

Citation preview

Rails i18nFrom the TrenchesClemens Kofler

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

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

• The latest developments in Ruby/Rails i18n

• Current problems (in Rails) and potential future changes

i18n

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

i18n basics in 2 minutes

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

_

s_

p_

n_

ns_

np_

t

i18n news

Additions in i18n 0.2.0

• translation procs

• custom namespace separators

• Ruby 1.9-style string interpolation

• (symlinked translations)

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

Additions in i18n 0.2.0

• translation procs

• custom namespace separators

• Ruby 1.9-style string interpolation

• (symlinked translations)

bleeding edge

Current edge

• Base backend + module includes

• Pluralization module

• Cache module

• Locale fallbacks module from Globalize 2

• Chain backend from Globalize 2

• Gettext support (experimental)

Current edge

• Base backend + module includes

• Pluralization module

• Cache module

• Locale fallbacks module from Globalize 2

• Chain backend from Globalize 2

• Gettext support (experimental)

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”)

Tools

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

Parsing dates/times isreally hard

(you can try out my experimental delocalize plugin)

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

scary hack.

i18n vs. Gettext?

War? Not really.

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

((ever))

Recommendations

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)

Questions?

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

clemens@railway.at

http://www.railway.at

http://github.com/clemens

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/

Recommended