rails/activesupport/lib/active_support/i18n.rb
Ufuk Kayserilioglu c2b195e1e3
Change load error messages to use Kernel#warn instead of $stderr.puts
When development tools try to load Rails components, they sometimes end up loading files that will error out since a dependency is missing. In these cases, the tooling can catch the error and change its behaviour.

However, since the warning is printed directly to `$stderr`, the tooling cannot catch and suppress it easily, which ends up causing noise in the output of the tool.

This change makes Rails print these warnings using `Kernel#warn` instead, which can be suppressed by the tooling.
2023-07-21 00:38:12 +03:00

18 lines
558 B
Ruby

# frozen_string_literal: true
require "active_support/core_ext/hash/deep_merge"
require "active_support/core_ext/hash/except"
require "active_support/core_ext/hash/slice"
begin
require "i18n"
require "i18n/backend/fallbacks"
rescue LoadError => e
warn "The i18n gem is not available. Please add it to your Gemfile and run bundle install"
raise e
end
require "active_support/lazy_load_hooks"
ActiveSupport.run_load_hooks(:i18n)
I18n.load_path << File.expand_path("locale/en.yml", __dir__)
I18n.load_path << File.expand_path("locale/en.rb", __dir__)