]> git.openstreetmap.org Git - rails.git/blob - config/initializers/http_accept_language.rb
Fix formatting of comments in the notes RSS feed
[rails.git] / config / initializers / http_accept_language.rb
1 #
2 # Monkey patch HttpAcceptLanguage pending integration of
3 # https://github.com/iain/http_accept_language/pull/6
4 #
5 module HttpAcceptLanguage
6   def compatible_language_from(available_languages)
7     user_preferred_languages.find do |x|
8       available_languages.find { |y| y.to_s == x.to_s } ||
9       available_languages.find { |y| y.to_s =~ /^#{Regexp.escape(x.to_s)}-/ }
10     end
11   end
12 end