Module: Sinatra::I18nSupport::Helpers
- Defined in:
- lib/sinatra/support/i18nsupport.rb
Instance Method Summary collapse
- #available_locales ⇒ Object
-
#current_locale ⇒ Object
Override this if you need to, say, check for the user’s preferred locale.
- #l(what, options = {}) ⇒ Object
- #t(what, options = {}) ⇒ Object
Instance Method Details
#available_locales ⇒ Object
106 107 108 |
# File 'lib/sinatra/support/i18nsupport.rb', line 106 def available_locales I18n.available_locales end |
#current_locale ⇒ Object
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, ={}) I18n.l what, {:locale => current_locale}.merge() end |
#t(what, options = {}) ⇒ Object
114 115 116 |
# File 'lib/sinatra/support/i18nsupport.rb', line 114 def t(what, ={}) I18n.t what, {:locale => current_locale}.merge() end |