Rails 2.3RC1でlocale_rails-2.0.0



# gem1.8 install locale_rails

よたらぼ:Ruby-Locale for Ruby on Rails HOWTOに従い、i18nをしていないアプリケーションをi18n化する。


# in config/initializer/locale.rb

# Tell the I18n library where to find your translations
I18n.load_path += Dir[ File.join(RAILS_ROOT, 'lib', 'locale', '*.{rb,yml}') ]

# Tell the supported locales. This is the one of additional setting by Ruby-Locale for Ruby on Rails.
# If supported_locales is not set, the locale information which is given by WWW browser is used.
# This setting is required if your application wants to restrict the locales.
I18n.supported_locales = Dir[ File.join(RAILS_ROOT, 'lib', 'locale', '*.{rb,yml}') ].collect{|v| File.basename(v, ".*")}.uniq

# Tell the default locale. If this value is not set, "en" is set.
# With this library, this value is used as the lowest priority locale
# (If other locale candidates are not found, this value is used).
I18n.default_locale = "ja-JP" 

# For single language application, set Locale.default with I18n.default_locale. 
# Locale.default forces to use this locale in Ruby-Locale.
I18n.default_locale = "ja-JP" 
#Locale.default = "ja-JP"


# config/environment.rb
Rails::Initializer.run do |config|
 config.gem 'locale' # add
 config.gem 'locale_rails' # add