X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/0e96027a209d59ff5e7f5c2b1405febc59664a16..c08f9a2f0343a4c9ca2543737c8cb8747d816e02:/vendor/plugins/http_accept_language/lib/http_accept_language.rb diff --git a/vendor/plugins/http_accept_language/lib/http_accept_language.rb b/vendor/plugins/http_accept_language/lib/http_accept_language.rb index f181c9f43..1266a3e64 100644 --- a/vendor/plugins/http_accept_language/lib/http_accept_language.rb +++ b/vendor/plugins/http_accept_language/lib/http_accept_language.rb @@ -25,7 +25,7 @@ module HttpAcceptLanguage # Sets the user languages preference, overiding the browser # def user_preferred_languages=(languages) - @user_preferred_languages = languages.join(",") + @user_preferred_languages = languages end # Finds the locale specifically requested by the browser. @@ -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