+ All Categories

I35s

Date post: 06-May-2015
Category:
Upload: ujihisa
View: 2,839 times
Download: 0 times
Share this document with a friend
Description:
i18n in Ruby on Rails (Ruby-GetText-Package) motivation and usage
Popular Tags:
55
i35s 2007-08-11 Tatsuhiro Ujihisa internationalization in ruby on rails Ruby/Rails Kansai Workshop #18
Transcript
Page 1: I35s

i35s2007-08-11

Tatsuhiro Ujihisa

internationalization in ruby on rails

Ruby/Rails Kansai Workshop #18

Page 2: I35s

Tatsuhiro Ujihisa•Osaka Univ. graduate student

• love Haskell, Ruby, and other functional languages...

• love Mac, vim, KeyNote, and cats

Page 3: I35s

Tatsuhiro Ujihisa•Osaka Univ. graduate student

• love Haskell, Ruby, and other functional languages...

• love Mac, vim, KeyNote, and cats

His blog: rubynekohttp://ujihisa.nowa.jp/

Page 4: I35s

Tatsuhiro Ujihisa•Osaka Univ. graduate student

• love Haskell, Ruby, and other functional languages...

• love Mac, vim, KeyNote, and cats

His blog: rubynekohttp://ujihisa.nowa.jp/

exponent of the word: MDD(Mascot Driven Development)

Page 5: I35s
Page 6: I35s

i35s

Page 7: I35s
Page 8: I35s

Internationalization

in Ruby on Railsincluding \s+

Page 9: I35s

•at Osaka International University

•at Ruby/Rails Kansai Workshop#18

Page 10: I35s

•at Osaka International University

•at Ruby/Rails Kansai Workshop#18

i18n

Page 11: I35s

uda.la

Page 12: I35s

i35s do

Page 13: I35s

Backgrounds...

Page 14: I35s

prevalent languages1 Chinese 1.3 billion2 Arabic 420 million3 Hindi 366 million4 English 341 million... ... ...9 Japanese 125 million

source: wikipedia

Page 15: I35s

•Most Japanese start learning English at Junior High School

➡88% Japanese <- [En, Jp]

➡EnglishPeople.count #=> 451

Page 16: I35s

•451 / 125.0 #=> 3.608

• if Japanese -> Englishthen YourWebService.profit #=> 3.6 times upper

end

Page 17: I35s
Page 18: I35s

Your worktime

Page 19: I35s

Your worktime

8h

Page 20: I35s

Your worktime

8h

2.2h

Page 21: I35s

Your worktime

8h

2.2h

Page 22: I35s

Set your default language,English!

Page 23: I35s

That's all.Thank you!

Page 24: I35s
Page 25: I35s
Page 26: I35s

中文对应?

Page 27: I35s

这个程序需要中文版

Page 28: I35s

•Your app must supportboth English and Chinese

•One app, has_many langs

‣eg. English, Chinese, Arabian, Hindi, etc...

Page 29: I35s

Ruby-GetText-Package

Page 30: I35s

Ruby-GetText-Package•phrase/keyword replacement

•author: Masao Mutoh

• install: sudo gem install gettext

•current ver. 1.10.0

Page 31: I35s

Ruby-GetText-Package•phrase/keyword replacement

•author: Masao Mutoh

• install: sudo gem install gettext

•current ver. 1.10.0

now!

Page 32: I35s

•the basis of usingRuby-GetText-Package on Rails

•applied usage ->http://www.yotabanana.com/hiki/ja/ruby-gettext-howto-ror.html

sudo gem install gettext

Page 33: I35s

READMERuby-GetText-Package is a Localization(L10n) libraryand tools which modeled after GNU gettext package.This library provides to translate original messages tolocalized messages properly using client-side locale information(environment variable or CGI variable).

Page 34: I35s

On Rails1. vim config/environment.rb

2. vim app/controllers/application.rb

3. vim Rakefile

4. rake updatepo

5. (make po files from pot)

6. rake makemo

messy...

Page 35: I35s

application

Page 36: I35s

applicationpot file

Page 37: I35s

applicationpot file

ja

plde

po files

Page 38: I35s

applicationpot file

ja

plde

po files

mo file

Page 39: I35s

demonstration

Mac OSX, zsh, vim, Shiira, rails-1.2.3.6653

Page 40: I35s

checkpoints

Page 41: I35s

checkpoints• vim config/environment.rb

• vim app/controllers/application.rb

• vim Rakefile

• rake updatepo

• (make po files from pot)

• rake makemo

Page 42: I35s

for edger

require 'gettext/rails'module GetText module ErbParser @config = { :extnames => ['.rhtml', '.erb'] } endend config/environment.rb

Page 43: I35s

weak points

✴Bad Knowhow

✴_('foo')

Page 44: I35s

weak points• lefty:

write "gettext" now!

rgettext ;-(

Page 45: I35s

applied theme

• singulars/plurals

• % notation

• setting locale

• edit po files on the web (Pootle)

Page 46: I35s

That's all.Thank you!

Page 47: I35s

P.S.

Page 48: I35s

On Lisp party #1•Paul Graham

•2007-08-19

•welcome!

http://cotocoto.jp/event/1697

Page 49: I35s

On Lisp party #1•Paul Graham

•2007-08-19

•welcome!

http://cotocoto.jp/event/1697

entry now!

Page 50: I35s

Language Dev Camp•make your lang!

•2007-09-**

http://wiki.fdiary.net/ldev/

Page 51: I35s

Stack Stock Bookshttp://stack.nayutaya.jp/

Page 52: I35s

Stack Stock Bookshttp://stack.nayutaya.jp/

•Nayutaya

• for your happystacked books life!

Page 53: I35s

Stack Stock Bookshttp://stack.nayutaya.jp/

•Nayutaya

• for your happystacked books life!

Page 54: I35s

end