Module: Sinatra::I18nSupport::Helpers

Defined in:
lib/sinatra/support/i18nsupport.rb

Instance Method Summary collapse

Instance Method Details

#available_localesObject



106
107
108
# File 'lib/sinatra/support/i18nsupport.rb', line 106

def available_locales
  I18n.available_locales
end

#current_localeObject

Override this if you need to, say, check for the user’s preferred locale.



102
103
104
# File 'lib/sinatra/support/i18nsupport.rb', line 102

def current_locale
  session[:locale] || settings.default_locale
end

#l(what, options = {}) ⇒ Object



110
111
112
# File 'lib/sinatra/support/i18nsupport.rb', line 110

def l(what, options={})
  I18n.l what, {:locale => current_locale}.merge(options)
end

#t(what, options = {}) ⇒ Object



114
115
116
# File 'lib/sinatra/support/i18nsupport.rb', line 114

def t(what, options={})
  I18n.t what, {:locale => current_locale}.merge(options)
end