]> git.openstreetmap.org Git - rails.git/blobdiff - vendor/plugins/http_accept_language/lib/http_accept_language.rb
Merged 17047 from trunk.
[rails.git] / vendor / plugins / http_accept_language / lib / http_accept_language.rb
index 85ee89c95d8885f80bff36be063efd4d429b8a9e..1266a3e645560b26bec1f3a7faba4f5479dddf21 100644 (file)
@@ -48,9 +48,8 @@ module HttpAcceptLanguage
   #
   def compatible_language_from(array)
     user_preferred_languages.map do |x|
-      x = x.to_s.split("-")[0]
       array.find do |y|
-        y.to_s.split("-")[0] == x
+        y.to_s =~ /^#{Regexp.escape(x.to_s)}(-|$)/
       end
     end.compact.first
   end