Fix compatible_language_from in the http_accept_language plugin to

correctly follow the RFC 2616 language selection algorithm and then
revert to the previous way of selecting languages.
This commit is contained in:
Tom Hughes 2009-07-15 23:42:56 +00:00
parent 1368f194da
commit 25d0017b18
2 changed files with 3 additions and 5 deletions

View 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 =~ /^#{x.to_s}(-|$)/
end
end.compact.first
end