Method: I18n.with_locale

Defined in:
lib/active_support/vendor/i18n-0.4.1/i18n.rb

.with_locale(tmp_locale = nil) ⇒ Object

Executes block with given I18n.locale set.


236
237
238
239
240
241
242
243
244
# File 'lib/active_support/vendor/i18n-0.4.1/i18n.rb', line 236

def 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