Rails2.x + ruby-gettext
基本komagataさんのやりかた通りにやる
http://p0t.jp/mt/archives/2007/06/pot_po.html
rakutoさんのところを見て erb に対応する
http://rakuto.blogspot.com/2008/01/ruby-ruby-gettext-1100eruby.html
GetText::ErbParser.init(:extnames => ['.rhtml', '.erb']) desc "Update pot/po files." task :updatepo do require 'gettext/utils' GetText.update_pofiles('myapp', Dir.glob("{app,config,components,lib}/**/*.{rb,erb,rhtml}"), 'myapp 1.0.0') end desc "Create mo-fileds" task :makemo do require 'gettext/utils' GetText.create_mofiles(true, "po", "locale") end
エラーがでたのでnaokiさんのBlogを見る
http://www.r-stone.net/blogs/ishikawa/2007/06/edge-railsruby-gettext.html
/opt/local/lib/ruby/gems/1.8/gems/gettext-1.9.0/lib/gettext/locale_cgi.rb 2007-05-28 16:11:27.000000000 +0300
+++ Desktop/locale_cgi.rb 2007-05-28 16:11:49.000000000 +0300 @@ -23,7 +23,7 @@ module Locale def system return @@default_locale unless @@cgi cgi_ = cgi - if ret = cgi_["lang"] and ret.size > 0 + if not cgi_.params.empty? and ret = cgi_["lang"] and ret.size > 0 elsif ret = cgi_.cookies["lang"][0] elsif lang = cgi_.accept_language and lang.size > 0 num = lang.index(/;|,/)