Rails I18n From The Trenches
-
Upload
clemensk -
Category
Technology
-
view
2.668 -
download
1
description
Transcript of Rails I18n From The Trenches
![Page 1: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/1.jpg)
Rails i18nFrom the TrenchesClemens Kofler
![Page 2: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/2.jpg)
Hi, I’m Clemens!(Clemens Kofler, clemensk)
![Page 3: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/3.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/4.jpg)
i18n
![Page 5: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/5.jpg)
![Page 6: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/6.jpg)
http://guides.rails.info/i18n.html
![Page 7: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/7.jpg)
i18n basics in 2 minutes
![Page 8: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/8.jpg)
![Page 9: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/9.jpg)
Do you like Gettext?(of course it’s fake)
![Page 10: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/10.jpg)
_
s_
p_
n_
ns_
np_
t
![Page 11: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/11.jpg)
![Page 12: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/12.jpg)
![Page 13: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/13.jpg)
i18n news
![Page 14: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/14.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/15.jpg)
![Page 16: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/16.jpg)
![Page 17: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/17.jpg)
![Page 18: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/18.jpg)
![Page 19: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/19.jpg)
![Page 20: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/20.jpg)
![Page 21: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/21.jpg)
+ a bunch of neat plugins(list at the end)
![Page 22: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/22.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/23.jpg)
bleeding edge
![Page 24: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/24.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/25.jpg)
![Page 26: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/26.jpg)
![Page 27: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/27.jpg)
![Page 28: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/28.jpg)
![Page 29: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/29.jpg)
![Page 30: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/30.jpg)
![Page 31: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/31.jpg)
![Page 32: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/32.jpg)
![Page 33: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/33.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/34.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/35.jpg)
Tools
![Page 36: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/36.jpg)
http://github.com/svenfuchs/i18n-tools
![Page 37: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/37.jpg)
![Page 38: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/38.jpg)
![Page 39: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/39.jpg)
Parsing dates/times isreally hard
(you can try out my experimental delocalize plugin)
![Page 40: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/40.jpg)
![Page 41: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/41.jpg)
![Page 42: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/42.jpg)
![Page 43: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/43.jpg)
![Page 44: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/44.jpg)
![Page 45: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/45.jpg)
You can do something like this with translate_routes but it’s basically a really
scary hack.
![Page 46: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/46.jpg)
i18n vs. Gettext?
![Page 47: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/47.jpg)
War? Not really.
![Page 48: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/48.jpg)
We are not Gettext(and we don’t want to be)
((ever))
![Page 49: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/49.jpg)
Recommendations
![Page 50: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/50.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/51.jpg)
![Page 52: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/52.jpg)
Questions?
![Page 53: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/53.jpg)
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 55: Rails I18n From The Trenches](https://reader034.fdocuments.us/reader034/viewer/2022042601/54bd173d4a7959f95e8b4595/html5/thumbnails/55.jpg)
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/