HOWTO Migrate rails-2.1.x(gettext-1.93.0) to rails-2.3.2(gettext-2.0.0)

ruby-gettext-rails-migration

[Ruby-GetText for Ruby on Rails]

Ruby-GetText-Package-2.0.0 and the family supports rails-2.3.2. (rails-2.3.1 or earlier doesn't work with gettext-2.0.0)

This HOWTO is the migration from rails-2.1.x to rails-2.3.2 with gettext.

Install new gems (Reguired)

(su)
$ gem uninstall gettext # for gettext-1.93.0
$ gem install gettext_rails
Successfully installed locale-2.0.0
Successfully installed gettext-2.0.0
Successfully installed gettext_activerecord-2.0.0
Successfully installed locale_rails-2.0.0
Successfully installed gettext_rails-2.0.0
5 gems installed

Update your rails applications

config/environment.rb (Required)

Rails::Initializer.run do |config|
 :
 :
 config.gem "locale_rails"
 config.gem "gettext_activerecord"
 config.gem "gettext_rails"
end

app/controller/app/controllers/application_controller.rb (Required)

Rename application.rb to application_controller.rb. init_gettext is same with older version of gettext.

Rakefile (Recommand)

"gettext/utils" is deprecated. Use "gettext_rails/tools" and new APIs instead.

desc "Create mo-files for L10n"
task :makemo do
  require 'gettext_rails/tools'
  GetText.create_mofiles
end

desc "Update pot/po files to match new version."
task :updatepo do
  require 'gettext_rails/tools'
  GetText.update_pofiles("blog", Dir.glob("{app,lib}/**/*.{rb,erb}"),
                         "blog 2.0.0")
end

Rename "gettext/utils" to "gettext_rails/tools". And parameters of GetText.crate_mofiles, GetText.update_pofiles are changed.

That's all!!

Enjoy!!

Last modified:2009/04/02 00:13:09
Keyword(s):
References:[Ruby-GetText for Ruby on Rails]