FIX: Rails.logger isn't always available when loading plugin locales

This commit is contained in:
Robin Ward 2018-06-22 10:20:20 -04:00
parent c08c725c54
commit 6901e0e043
1 changed files with 7 additions and 1 deletions

View File

@ -591,7 +591,13 @@ JS
DiscoursePluginRegistry.register_locale(locale, opts)
Rails.configuration.assets.precompile << "locales/#{locale}.js"
else
Rails.logger.error "Invalid locale! #{opts.inspect}"
msg = "Invalid locale! #{opts.inspect}"
# The logger isn't always present during boot / parsing locales from plugins
if Rails.logger.present?
Rails.logger.error(msg)
else
puts msg
end
end
end
end