diff --git a/Gemfile b/Gemfile index d285b9a9..78211c86 100644 --- a/Gemfile +++ b/Gemfile @@ -39,6 +39,7 @@ gem 'fog' gem 'fog-aws' gem 'momentjs-rails', '>= 2.9.0' gem 'bootstrap3-datetimepicker-rails', '~> 4.7.14' +gem 'http_accept_language' gem 'ruby-progressbar' diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index aae3e36e..09191790 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -14,6 +14,8 @@ class ApplicationController < ActionController::Base I18n.locale = current_user.locale elsif not cookies[:hl].nil? I18n.locale = cookies[:hl] + elsif not http_accept_language.user_preferred_languages.length > 0 + I18n.locale = http_accept_language.compatible_language_from(I18n.available_locales) or "en" end else I18n.locale = params[:hl]