summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-05-30 18:40:02 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-05-30 18:40:02 +0000
commit9894a3781e9cc7fc295f7fa7133fe951ca843e51 (patch)
treed42d4924513227feede04948590dbdbe53b989f8 /app/controllers
parent5d2abb84bdcb8724e5d24a5299bb90f0770f6c23 (diff)
downloadredmine-9894a3781e9cc7fc295f7fa7133fe951ca843e51.tar.gz
redmine-9894a3781e9cc7fc295f7fa7133fe951ca843e51.zip
Fixed: browser's accept-language subcodes ignored (#1320).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1481 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/application.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/controllers/application.rb b/app/controllers/application.rb
index abf621641..2daee50de 100644
--- a/app/controllers/application.rb
+++ b/app/controllers/application.rb
@@ -61,11 +61,11 @@ class ApplicationController < ActionController::Base
def set_localization
User.current.language = nil unless User.current.logged?
lang = begin
- if !User.current.language.blank? and GLoc.valid_languages.include? User.current.language.to_sym
+ if !User.current.language.blank? && GLoc.valid_language?(User.current.language)
User.current.language
elsif request.env['HTTP_ACCEPT_LANGUAGE']
- accept_lang = parse_qvalues(request.env['HTTP_ACCEPT_LANGUAGE']).first.split('-').first
- if accept_lang and !accept_lang.empty? and GLoc.valid_languages.include? accept_lang.to_sym
+ accept_lang = parse_qvalues(request.env['HTTP_ACCEPT_LANGUAGE']).first.downcase
+ if !accept_lang.blank? && (GLoc.valid_language?(accept_lang) || GLoc.valid_language?(accept_lang = accept_lang.split('-').first))
User.current.language = accept_lang
end
end