try setting locale from query parameter first

This commit is contained in:
Taylor Griffin committed 2014-10-16 06:37:02 +11:00
1 parent aebd9e1d4e
commit 6a7c935d43
1 file changed
+2 -2
+2 -2
View File
@@ -35,10 +35,10 @@ class ApplicationController < ActionController::Base
end
def set_locale
I18n.locale = extract_locale_tld || I18n.default_locale
I18n.locale = params[:locale] || extract_locale_from_subdomain || I18n.default_locale
end
def extract_locale_tld
def extract_locale_from_subdomain
parsed_locale = request.subdomains.first
I18n.available_locales.map(&:to_s).include?(parsed_locale) ? parsed_locale : nil
end