]> git.openstreetmap.org Git - rails.git/blob - config/initializers/http_accept_language.rb
Fix translation interpolations
[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   class Parser
7     def compatible_language_from(available_languages)
8       user_preferred_languages.find do |x|
9         available_languages.find { |y| y.to_s == x.to_s } ||
10           available_languages.find { |y| y.to_s =~ /^#{Regexp.escape(x.to_s)}-/ }
11       end
12     end
13   end
14 end