Set the default locale in config (#6580)
Previously the default locale was set by Localized concern for controllers, but it was not enforced for mailers. config is enforced throughout the application and an appropriate place to set the default locale.
This commit is contained in:
parent
9110db41c5
commit
51d760960c
4 changed files with 28 additions and 51 deletions
|
@ -17,11 +17,7 @@ module Localized
|
|||
end
|
||||
|
||||
def default_locale
|
||||
request_locale || env_locale || I18n.default_locale
|
||||
end
|
||||
|
||||
def env_locale
|
||||
ENV['DEFAULT_LOCALE']
|
||||
request_locale || I18n.default_locale
|
||||
end
|
||||
|
||||
def request_locale
|
||||
|
@ -29,12 +25,10 @@ module Localized
|
|||
end
|
||||
|
||||
def preferred_locale
|
||||
http_accept_language.preferred_language_from([env_locale]) ||
|
||||
http_accept_language.preferred_language_from(I18n.available_locales)
|
||||
http_accept_language.preferred_language_from(I18n.available_locales)
|
||||
end
|
||||
|
||||
def compatible_locale
|
||||
http_accept_language.compatible_language_from([env_locale]) ||
|
||||
http_accept_language.compatible_language_from(I18n.available_locales)
|
||||
http_accept_language.compatible_language_from(I18n.available_locales)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue