module SimpleLocalizer
Public Instance Methods
read_locale()
click to toggle source
# File lib/simple_localizer.rb, line 116 def read_locale (Thread.current[:simple_localizer_locale] || I18n.locale || I18n.default_locale).to_s end
set_locale(locale)
click to toggle source
# File lib/simple_localizer.rb, line 124 def set_locale(locale) Thread.current[:simple_localizer_locale] = locale && locale.to_s end
supported_locales()
click to toggle source
# File lib/simple_localizer.rb, line 98 def supported_locales @@supported_locales end
supported_locales=(value)
click to toggle source
# File lib/simple_localizer.rb, line 102 def supported_locales=(value) @@supported_locales = value end
with_locale(new_locale) { || ... }
click to toggle source
# File lib/simple_localizer.rb, line 106 def with_locale(new_locale, &block) begin pre_locale = Thread.current[:simple_localizer_locale] set_locale(new_locale) yield ensure set_locale(pre_locale) end end