Use HTTP Accept-Language to detect locale (#1166)
* Use HTTP Accept-Language to detect locale * Fix gem order to comply with codeclimate * Sort gem to comply with rubocop * I18n.default_locale fallback when there is no accept-language header
This commit is contained in:
@ -26,6 +26,8 @@ module Localized
|
||||
end
|
||||
|
||||
def default_locale
|
||||
ENV.fetch('DEFAULT_LOCALE') { I18n.default_locale }
|
||||
ENV.fetch('DEFAULT_LOCALE') {
|
||||
http_accept_language.compatible_language_from(I18n.available_locales) || I18n.default_locale
|
||||
}
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user