I18n

locale_rails/lib/i18n.rb - Ruby/Locale for “Ruby on Rails”

Copyright (C) 2008,2009 Masao Mutoh

You may redistribute it and/or modify it under the same license terms as Ruby or LGPL.

Public Instance Methods

default_locale=(tag) click to toggle source

Sets the default locale.

I18n.default_locale = "ja"
# File lib/locale_rails/i18n.rb, line 42
def default_locale=(tag)
  tag = Locale::Tag::Rfc.parse(tag.to_s) if tag.kind_of? Symbol
  Locale.default = tag
  @@default_locale = tag
end
locale=(tag) click to toggle source

Sets the locale.

I18n.locale = "ja-JP"
# File lib/locale_rails/i18n.rb, line 33
def locale=(tag)
  Locale.clear
  tag = Locale::Tag::Rfc.parse(tag.to_s) if tag.kind_of? Symbol
  Locale.current = tag
  Thread.current[:locale] = Locale.candidates(:type => :rfc)[0]
end
set_supported_locales(*tags) click to toggle source

Sets the supported locales.

I18n.set_supported_locales("ja-JP", "ko-KR", ...)
# File lib/locale_rails/i18n.rb, line 21
def set_supported_locales(*tags)
  Locale.set_app_language_tags(*tags)
end
supported_locales() click to toggle source

Gets the supported locales.

# File lib/locale_rails/i18n.rb, line 15
def supported_locales 
  Locale.app_language_tags
end
supported_locales=(tags) click to toggle source

Sets the supported locales as an Array.

I18n.supported_locales = ["ja-JP", "ko-KR", ...]
# File lib/locale_rails/i18n.rb, line 27
def supported_locales=(tags)
  Locale.set_app_language_tags(*tags)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.