Switch to using http_accept_language as a gem

This commit is contained in:
Tom Hughes 2012-01-21 11:20:39 +00:00
parent a29c8f670d
commit 10fb373e5e
9 changed files with 15 additions and 192 deletions

View file

@ -0,0 +1,12 @@
#
# Monkey patch HttpAcceptLanguage pending integration of
# https://github.com/iain/http_accept_language/pull/6
#
module HttpAcceptLanguage
def compatible_language_from(available_languages)
user_preferred_languages.find do |x|
available_languages.find { |y| y.to_s == x.to_s } ||
available_languages.find { |y| y.to_s =~ /^#{Regexp.escape(x.to_s)}-/ }
end
end
end