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:
Akihiko Odaki 2018-03-04 17:21:35 +09:00 committed by Eugen Rochko
parent 9110db41c5
commit 51d760960c
4 changed files with 28 additions and 51 deletions

View file

@ -31,7 +31,7 @@ module Mastodon
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# All translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
config.i18n.available_locales = [
:en,
@ -73,7 +73,12 @@ module Mastodon
:'zh-TW',
]
config.i18n.default_locale = :en
config.i18n.default_locale = ENV['DEFAULT_LOCALE']&.to_sym
if config.i18n.available_locales.include?(config.i18n.default_locale)
config.i18n.fallbacks = [:en]
else
config.i18n.default_locale = :en
end
# config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb')
# config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]