module I18n

Public Class Methods

with_locale(tmp_locale = nil) { || ... } click to toggle source

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

# 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