Module: I18n

Defined in:
lib/gettext_i18n_rails/i18n_hacks.rb

Defined Under Namespace

Classes: Config

Class Method Summary collapse

Class Method Details

.with_locale(tmp_locale = nil) ⇒ Object

backport I18n.with_locale if it does not exist Executes block with given I18n.locale set.



16
17
18
19
20
21
22
23
24
# File 'lib/gettext_i18n_rails/i18n_hacks.rb', line 16

def self.with_locale(tmp_locale = nil)
  if tmp_locale
    current_locale = self.locale
    self.locale = tmp_locale
  end
  yield
ensure
  self.locale = current_locale if tmp_locale
end