Switch to using http_accept_language as a gem
This commit is contained in:
parent
a29c8f670d
commit
10fb373e5e
9 changed files with 15 additions and 192 deletions
12
config/initializers/http_accept_language.rb
Normal file
12
config/initializers/http_accept_language.rb
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue