I35s

3,409 views

Published on

i18n in Ruby on Rails
(Ruby-GetText-Package)
motivation and usage

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,409
On SlideShare
0
From Embeds
0
Number of Embeds
36
Actions
Shares
0
Downloads
118
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

I35s

  1. 1. i35s internationalization in ruby on rails 2007-08-11 Tatsuhiro Ujihisa Ruby/Rails Kansai Workshop #18
  2. 2. Tatsuhiro Ujihisa • Osaka Univ. graduate student • love Haskell, Ruby, and other functional languages... • love Mac, vim, KeyNote, and cats
  3. 3. Tatsuhiro Ujihisa • blog: rubyneko Osaka Univ. graduate student His • love Haskell, Ruby, and http://ujihisa.nowa.jp/ other functional languages... • love Mac, vim, KeyNote, and cats
  4. 4. Tatsuhiro Ujihisa • blog: rubyneko Osaka Univ. graduate student His • love Haskell, Ruby, and http://ujihisa.nowa.jp/ other functional languages... • love Mac, vim, KeyNote, exponent of the word: MDD and cats (Mascot Driven Development)
  5. 5. s 35 i
  6. 6. zation ionali ternat In n Rails uby o in R including s+
  7. 7. • at Osaka International University • at Ruby/Rails Kansai Workshop#18
  8. 8. • at Osaka International University • at Ruby/Rails Kansai Workshop#18 i18n
  9. 9. uda.la
  10. 10. i35s do
  11. 11. Backgrounds...
  12. 12. prevalent languages 1 Chinese 1.3 billion 2 Arabic 420 million 3 Hindi 366 million 4 English 341 million ... ... ... Japanese 9 125 million source: wikipedia
  13. 13. • Most Japanese start learning English at Junior High School ➡88% Japanese <- [En, Jp] ➡EnglishPeople.count #=> 451
  14. 14. • 451 / 125.0 #=> 3.608 • if Japanese -> English then YourWebService.profit #=> 3.6 times upper end
  15. 15. Your worktime
  16. 16. Your worktime 8h
  17. 17. Your worktime 2.2h 8h
  18. 18. Your worktime 2.2h 8h
  19. 19. Set your default language, English!
  20. 20. That's all. Thank you!
  21. 21. • Your app must support both English and Chinese • One app, has_many langs ‣Hindi, etc... eg. English, Chinese, Arabian,
  22. 22. Ruby-GetText-Package
  23. 23. Ruby-GetText-Package • phrase/keyword replacement • author: Masao Mutoh • install: sudo gem install gettext • current ver. 1.10.0
  24. 24. Ruby-GetText-Package • phrase/keyword replacement • author: Masao Mutoh • install: now! sudo gem install gettext • current ver. 1.10.0
  25. 25. • the basis of using Ruby-Ge Te on Rails t xt-Package • applied usage -> http://www.yotabanana.com/hiki/ ja/ruby-gettext-howto-ror.html sudo gem install gettext
  26. 26. README Ruby-GetText-Package is a Localization(L10n) library and tools which modeled after GNU gettext package. This library provides to translate original messages to localized messages properly using client-side locale information (environment variable or CGI variable).
  27. 27. On Rails 1. vim config/environment.rb 2. vim app/controllers/application.rb messy... 3. vim Rakefile 4. rake updatepo 5. (make po files from pot) 6. rake makemo
  28. 28. application
  29. 29. pot file application
  30. 30. pot file application po files ja de pl
  31. 31. pot file application po files ja de pl mo file
  32. 32. demonstration Mac OSX, zsh, vim, Shiira, rails-1.2.3.6653
  33. 33. checkpoints
  34. 34. checkpoints • vim config/environment.rb • vim app/controllers/application.rb • vim Rakefile • rake updatepo • (make po files from pot) • rake makemo
  35. 35. for edger require 'gettext/rails' module GetText module ErbParser @config = { :extnames => ['.rhtml', '.erb'] } end config/environment.rb end
  36. 36. weak points ✴ Bad Knowhow ✴ _('foo')
  37. 37. weak points • lefty: write quot;gettextquot; now! rgettext ;-(
  38. 38. applied theme • singulars/plurals • % notation • setting locale • edit po files on the web (Pootle)
  39. 39. That's all. Thank you!
  40. 40. P.S.
  41. 41. On Lisp party #1 • Paul Graham • 2007-08-19 • welcome! http://cotocoto.jp/event/1697
  42. 42. On Lisp party #1 • Paul Graham • 2007-08-19 • welcome! entry now! http://cotocoto.jp/event/1697
  43. 43. Language Dev Camp • make your lang! • 2007-09-** http://wiki.fdiary.net/ldev/
  44. 44. http://stack.nayutaya.jp/ Stack Stock Books
  45. 45. • Nayutaya • for your happy stacked books life! http://stack.nayutaya.jp/ Stack Stock Books
  46. 46. • Nayutaya • for your happy stacked books life! http://stack.nayutaya.jp/ Stack Stock Books
  47. 47. end
  48. 48. references • http://ja.wikipedia.org/wiki/%E8%A8%80%E8%AA%9E • http://geekphilosopher.com/MainPage/photos.htm • http://commons.wikimedia.org/wiki/Main_Page

×