Accept-Language header support
This commit is contained in:
parent
52890707c5
commit
50e1186e79
1
Gemfile
1
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'
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue