update http_accept_language and try to find the preferred locale first, should fix #2715
This commit is contained in:
parent
6befd552d0
commit
12575bd7f0
3 changed files with 6 additions and 10 deletions
2
Gemfile
2
Gemfile
|
|
@ -91,7 +91,7 @@ gem 'acts-as-taggable-on', :git => 'git://github.com/diaspora/acts-as-taggable-o
|
|||
# URIs and HTTP
|
||||
|
||||
gem 'addressable', '2.2.4', :require => 'addressable/uri'
|
||||
gem 'http_accept_language', :git => 'git://github.com/iain/http_accept_language.git', :ref => '0b78aa7849fc90cf9e12'
|
||||
gem 'http_accept_language', '~> 1.0.2'
|
||||
gem 'typhoeus'
|
||||
|
||||
# views
|
||||
|
|
|
|||
10
Gemfile.lock
10
Gemfile.lock
|
|
@ -31,13 +31,6 @@ GIT
|
|||
oauth2 (= 0.5.0)
|
||||
sinatra
|
||||
|
||||
GIT
|
||||
remote: git://github.com/iain/http_accept_language.git
|
||||
revision: 0b78aa7849fc90cf9e12586af162fa4c408a795d
|
||||
ref: 0b78aa7849fc90cf9e12
|
||||
specs:
|
||||
http_accept_language (1.0.1)
|
||||
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
|
|
@ -194,6 +187,7 @@ GEM
|
|||
heroku (>= 2)
|
||||
rails (>= 2)
|
||||
highline (1.6.9)
|
||||
http_accept_language (1.0.2)
|
||||
i18n (0.5.0)
|
||||
i18n-inflector (2.6.3)
|
||||
i18n (>= 0.4.1)
|
||||
|
|
@ -443,7 +437,7 @@ DEPENDENCIES
|
|||
haml
|
||||
heroku
|
||||
heroku_san
|
||||
http_accept_language!
|
||||
http_accept_language (~> 1.0.2)
|
||||
i18n-inflector-rails (~> 1.0)
|
||||
jammit (= 0.6.5)
|
||||
jasmine (~> 1.1.2)
|
||||
|
|
|
|||
|
|
@ -76,7 +76,9 @@ class ApplicationController < ActionController::Base
|
|||
if user_signed_in?
|
||||
I18n.locale = current_user.language
|
||||
else
|
||||
I18n.locale = request.compatible_language_from AVAILABLE_LANGUAGE_CODES
|
||||
locale = request.preferred_language_from AVAILABLE_LANGUAGE_CODES
|
||||
locale ||= request.compatible_language_from AVAILABLE_LANGUAGE_CODES
|
||||
I18n.locale = locale
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue