app/api/locomotive/api/middlewares/locale_middleware.rb in locomotivecms-3.0.0.pre.beta.1 vs app/api/locomotive/api/middlewares/locale_middleware.rb in locomotivecms-3.0.0.rc1
- old
+ new
@@ -24,12 +24,17 @@
private
def find_locale(env)
env['HTTP_X_LOCOMOTIVE_LOCALE'].presence ||
- Rack::Request.new(env).params[:locale].presence ||
+ params(env)[:locale].presence ||
+ params(env)['locale'].presence ||
env['locomotive.site'].try(:default_locale).presence ||
Locomotive.config.site_locales.first
+ end
+
+ def params(env)
+ @params ||= Rack::Request.new(env).params
end
end
end