class RoutingFilter::RefineryLocales
Public Instance Methods
around_recognize(path, env) { || ... }
click to toggle source
# File lib/refinery/i18n-filter.rb, line 4 def around_recognize(path, env, &block) if ::Refinery::I18n.url_filter_enabled? if path =~ %r{^/(#{::Refinery::I18n.locales.keys.join('|')})(/|$)} path.sub! %r(^/(([a-zA-Z\-_])*)(?=/|$)) do ::I18n.locale = $1 '' end path.sub!(%r{^$}) { '/' } else ::I18n.locale = ::Refinery::I18n.default_frontend_locale end end yield.tap do |params| params[:locale] = ::I18n.locale.to_s end