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:
parent
b16fbd52b2
commit
f0bd439486
3 changed files with 25 additions and 20 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue