Module: Padrino::Contrib::AutoLocale::Helpers
- Defined in:
- lib/padrino-contrib/auto_locale.rb
Instance Method Summary collapse
-
#switch_to_lang(lang) ⇒ Object
This reload the page changing the I18n.locale.
Instance Method Details
#switch_to_lang(lang) ⇒ Object
This reload the page changing the I18n.locale
25 26 27 28 29 |
# File 'lib/padrino-contrib/auto_locale.rb', line 25 def switch_to_lang(lang) return unless settings.locales.include?(lang) return url("/#{lang}", false) if request.path_info == '/' url(request.path_info.sub(/\/#{I18n.locale}/, "/#{lang}"), false) end |