mirror of https://github.com/Siphonay/mastodon
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
|
@ -17,11 +17,7 @@ module Localized
|
||||||
end
|
end
|
||||||
|
|
||||||
def default_locale
|
def default_locale
|
||||||
request_locale || env_locale || I18n.default_locale
|
request_locale || I18n.default_locale
|
||||||
end
|
|
||||||
|
|
||||||
def env_locale
|
|
||||||
ENV['DEFAULT_LOCALE']
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def request_locale
|
def request_locale
|
||||||
|
@ -29,12 +25,10 @@ module Localized
|
||||||
end
|
end
|
||||||
|
|
||||||
def preferred_locale
|
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
|
end
|
||||||
|
|
||||||
def compatible_locale
|
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
|
||||||
end
|
end
|
||||||
|
|