i35s

Post on 06-May-2015

2.839 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

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

TRANSCRIPT

i35s2007-08-11

Tatsuhiro Ujihisa

internationalization in ruby on rails

Ruby/Rails Kansai Workshop #18

Tatsuhiro Ujihisa•Osaka Univ. graduate student

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

• love Mac, vim, KeyNote, and cats

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/

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)

i35s

Internationalization

in Ruby on Railsincluding \s+

•at Osaka International University

•at Ruby/Rails Kansai Workshop#18

•at Osaka International University

•at Ruby/Rails Kansai Workshop#18

i18n

uda.la

i35s do

Backgrounds...

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

source: wikipedia

•Most Japanese start learning English at Junior High School

➡88% Japanese <- [En, Jp]

➡EnglishPeople.count #=> 451

•451 / 125.0 #=> 3.608

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

end

Your worktime

Your worktime

8h

Your worktime

8h

2.2h

Your worktime

8h

2.2h

Set your default language,English!

That's all.Thank you!

中文对应?

这个程序需要中文版

•Your app must supportboth English and Chinese

•One app, has_many langs

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

Ruby-GetText-Package

Ruby-GetText-Package•phrase/keyword replacement

•author: Masao Mutoh

• install: sudo gem install gettext

•current ver. 1.10.0

Ruby-GetText-Package•phrase/keyword replacement

•author: Masao Mutoh

• install: sudo gem install gettext

•current ver. 1.10.0

now!

•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

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

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...

application

applicationpot file

applicationpot file

ja

plde

po files

applicationpot file

ja

plde

po files

mo file

demonstration

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

checkpoints

checkpoints• vim config/environment.rb

• vim app/controllers/application.rb

• vim Rakefile

• rake updatepo

• (make po files from pot)

• rake makemo

for edger

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

weak points

✴Bad Knowhow

✴_('foo')

weak points• lefty:

write "gettext" now!

rgettext ;-(

applied theme

• singulars/plurals

• % notation

• setting locale

• edit po files on the web (Pootle)

That's all.Thank you!

P.S.

On Lisp party #1•Paul Graham

•2007-08-19

•welcome!

http://cotocoto.jp/event/1697

On Lisp party #1•Paul Graham

•2007-08-19

•welcome!

http://cotocoto.jp/event/1697

entry now!

Language Dev Camp•make your lang!

•2007-09-**

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

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

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

•Nayutaya

• for your happystacked books life!

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

•Nayutaya

• for your happystacked books life!

end

top related