Fixed #323 Allow users to select a language in settings (GRN-17) (#324)

* <Added ui for language setting and migration>

* <Option to choose languages added>

* <Fixed code style>

* <Added Rspec tests>

* <sync db>

* <Sync db>

* <Generalized language settings>

* <Fixed flash message>

* Fixed las issue with i18n fallback

* <Modified fallback config>

* <Fixed code style>
This commit is contained in:
John Ma
2018-12-06 16:00:22 -05:00
committed by Jesus Federico
parent 895af7494e
commit b3f37cd3b3
11 changed files with 89 additions and 8 deletions

View File

@ -39,7 +39,15 @@ class ApplicationController < ActionController::Base
# Sets the appropriate locale.
def set_locale
I18n.locale = http_accept_language.language_region_compatible_from(I18n.available_locales)
update_locale(current_user)
end
def update_locale(user)
I18n.locale = if user && user.language != 'default'
user.language
else
http_accept_language.language_region_compatible_from(I18n.available_locales)
end
end
def meeting_name_limit