diff --git a/lib/generators/foxinator/setup/templates/cms/app/controllers/concerns/localizify.rb b/lib/generators/foxinator/setup/templates/cms/app/controllers/concerns/localizify.rb index 3205613..2cd4a3a 100644 --- a/lib/generators/foxinator/setup/templates/cms/app/controllers/concerns/localizify.rb +++ b/lib/generators/foxinator/setup/templates/cms/app/controllers/concerns/localizify.rb @@ -79,8 +79,8 @@ def accept_locale if request.env['HTTP_ACCEPT_LANGUAGE'].present? parsed_locale = request.env['HTTP_ACCEPT_LANGUAGE'].gsub(/\s+/, '').split(',').first parsed_locale = parsed_locale.scan(/^[a-z]{2}-[a-z]{2}|[a-z]{2}/i).first if parsed_locale - parsed_locale = parsed_locale.split('-').last.try(:downcase).try(:to_sym) if parsed_locale - + parsed_locale = parsed_locale.split('-').first.try(:downcase).try(:to_sym) if parsed_locale + locale_available?(parsed_locale) ? parsed_locale.try(:to_sym) : nil end end