diff --git a/Gemfile b/Gemfile index 08a17ecd3..080e04a44 100644 --- a/Gemfile +++ b/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 diff --git a/Gemfile.lock b/Gemfile.lock index 0abdfce6e..a412b4f3c 100644 --- a/Gemfile.lock +++ b/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) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 870e94c3f..97d3b36fa 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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