locale country code fix 2

jamesperet 10 anos atrás
pai
commit
ac9eabcf59
1 arquivos alterados com 3 adições e 5 exclusões
  1. 3 5
      app/controllers/application_controller.rb

+ 3 - 5
app/controllers/application_controller.rb

@@ -24,13 +24,11 @@ class ApplicationController < ActionController::Base
24 24
         l = cookies[:avalanche_locale].to_sym
25 25
       else
26 26
         begin
27
-          country_code = request.location.country_code
27
+          
28 28
           http_accept_language = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first
29 29
           if http_accept_language != ''
30
-            [:"pt-BR", :"pt-br", :pt, :br].include?(http_accept_language) ? l = :"pt-BR" : l = @config.default_language
31
-          elsif country_code != ''
32
-            country_code = country_code.downcase.to_sym
33
-            [:"pt-BR", :"pt-br", :pt, :br].include?(country_code) ? l = :"pt-BR" : l = @config.default_language
30
+            ["pt-BR", "pt-br", "pt", "br"].include?(http_accept_language) ? l = :"pt-BR" : l = @config.default_language
31
+          
34 32
           else
35 33
             l = @config.default_language # use default locale if cannot retrieve this info
36 34
           end