From e4ad119ca28ff2c9fe553367881713d020c6dd9c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 15 Feb 2022 18:04:08 +0000 Subject: [PATCH 1/3] build(deps): bump i18n from 1.9.1 to 1.10.0 in /Library/Homebrew Bumps [i18n](https://github.com/ruby-i18n/i18n) from 1.9.1 to 1.10.0. - [Release notes](https://github.com/ruby-i18n/i18n/releases) - [Changelog](https://github.com/ruby-i18n/i18n/blob/master/CHANGELOG.md) - [Commits](https://github.com/ruby-i18n/i18n/compare/v1.9.1...v1.10.0) --- updated-dependencies: - dependency-name: i18n dependency-type: indirect update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Library/Homebrew/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/Gemfile.lock b/Library/Homebrew/Gemfile.lock index 5a4f244d46..df2ea1f13a 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -33,7 +33,7 @@ GEM hpricot (0.8.6) http-cookie (1.0.4) domain_name (~> 0.5) - i18n (1.9.1) + i18n (1.10.0) concurrent-ruby (~> 1.0) json_schemer (0.2.18) ecma-re-validator (~> 0.3) From ddcf41eba8b1be51e3464d91ee1b7a66889d408d Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Tue, 15 Feb 2022 18:06:41 +0000 Subject: [PATCH 2/3] brew vendor-gems: commit updates. --- .../Homebrew/vendor/bundle/bundler/setup.rb | 2 +- .../{i18n-1.9.1 => i18n-1.10.0}/lib/i18n.rb | 10 +- .../lib/i18n/backend.rb | 3 +- .../lib/i18n/backend/base.rb | 10 +- .../lib/i18n/backend/cache.rb | 0 .../lib/i18n/backend/cache_file.rb | 0 .../lib/i18n/backend/cascade.rb | 0 .../lib/i18n/backend/chain.rb | 0 .../lib/i18n/backend/fallbacks.rb | 17 +- .../lib/i18n/backend/flatten.rb | 0 .../lib/i18n/backend/gettext.rb | 0 .../i18n/backend/interpolation_compiler.rb | 0 .../lib/i18n/backend/key_value.rb | 0 .../lib/i18n/backend/lazy_loadable.rb | 184 ++++++++++++++++++ .../lib/i18n/backend/memoize.rb | 0 .../lib/i18n/backend/metadata.rb | 0 .../lib/i18n/backend/pluralization.rb | 0 .../lib/i18n/backend/simple.rb | 2 +- .../lib/i18n/backend/transliterator.rb | 0 .../lib/i18n/config.rb | 0 .../lib/i18n/exceptions.rb | 34 ++++ .../lib/i18n/gettext.rb | 0 .../lib/i18n/gettext/helpers.rb | 0 .../lib/i18n/gettext/po_parser.rb | 0 .../lib/i18n/interpolate/ruby.rb | 0 .../lib/i18n/locale.rb | 0 .../lib/i18n/locale/fallbacks.rb | 0 .../lib/i18n/locale/tag.rb | 0 .../lib/i18n/locale/tag/parents.rb | 0 .../lib/i18n/locale/tag/rfc4646.rb | 0 .../lib/i18n/locale/tag/simple.rb | 0 .../lib/i18n/middleware.rb | 0 .../lib/i18n/utils.rb | 0 .../lib/i18n/version.rb | 2 +- 34 files changed, 248 insertions(+), 16 deletions(-) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n.rb (98%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/backend.rb (93%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/backend/base.rb (97%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/backend/cache.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/backend/cache_file.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/backend/cascade.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/backend/chain.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/backend/fallbacks.rb (87%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/backend/flatten.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/backend/gettext.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/backend/interpolation_compiler.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/backend/key_value.rb (100%) create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/lazy_loadable.rb rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/backend/memoize.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/backend/metadata.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/backend/pluralization.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/backend/simple.rb (96%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/backend/transliterator.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/config.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/exceptions.rb (75%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/gettext.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/gettext/helpers.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/gettext/po_parser.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/interpolate/ruby.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/locale.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/locale/fallbacks.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/locale/tag.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/locale/tag/parents.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/locale/tag/rfc4646.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/locale/tag/simple.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/middleware.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/utils.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{i18n-1.9.1 => i18n-1.10.0}/lib/i18n/version.rb (69%) diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index 497bef5f02..cbc959a723 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -4,7 +4,7 @@ ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby' ruby_version = RbConfig::CONFIG["ruby_version"] path = File.expand_path('..', __FILE__) $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.9.1/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.10.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.15.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-2.0.4/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/zeitwerk-2.5.4/lib" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n.rb index 1b32f470d3..e197e2b1c9 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n.rb @@ -338,11 +338,11 @@ module I18n def normalize_keys(locale, key, scope, separator = nil) separator ||= I18n.default_separator - keys = [] - keys.concat normalize_key(locale, separator) - keys.concat normalize_key(scope, separator) - keys.concat normalize_key(key, separator) - keys + [ + *normalize_key(locale, separator), + *normalize_key(scope, separator), + *normalize_key(key, separator) + ] end # Returns true when the passed locale, which can be either a String or a diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend.rb index 453ed71699..863d618782 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend.rb @@ -3,7 +3,6 @@ module I18n module Backend autoload :Base, 'i18n/backend/base' - autoload :InterpolationCompiler, 'i18n/backend/interpolation_compiler' autoload :Cache, 'i18n/backend/cache' autoload :CacheFile, 'i18n/backend/cache_file' autoload :Cascade, 'i18n/backend/cascade' @@ -11,7 +10,9 @@ module I18n autoload :Fallbacks, 'i18n/backend/fallbacks' autoload :Flatten, 'i18n/backend/flatten' autoload :Gettext, 'i18n/backend/gettext' + autoload :InterpolationCompiler, 'i18n/backend/interpolation_compiler' autoload :KeyValue, 'i18n/backend/key_value' + autoload :LazyLoadable, 'i18n/backend/lazy_loadable' autoload :Memoize, 'i18n/backend/memoize' autoload :Metadata, 'i18n/backend/metadata' autoload :Pluralization, 'i18n/backend/pluralization' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/base.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/base.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/base.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/base.rb index b78a6af1a3..4cbcc3c0e4 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/base.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/base.rb @@ -13,7 +13,10 @@ module I18n # for details. def load_translations(*filenames) filenames = I18n.load_path if filenames.empty? - filenames.flatten.each { |filename| load_file(filename) } + filenames.flatten.each do |filename| + loaded_translations = load_file(filename) + yield filename, loaded_translations if block_given? + end end # This method receives a locale, a data hash and options for storing translations. @@ -32,7 +35,7 @@ module I18n if entry.nil? && options.key?(:default) entry = default(locale, key, options[:default], options) else - entry = resolve(locale, key, entry, options) + entry = resolve_entry(locale, key, entry, options) end count = options[:count] @@ -151,6 +154,7 @@ module I18n end result unless result.is_a?(MissingTranslation) end + alias_method :resolve_entry, :resolve # Picks a translation from a pluralized mnemonic subkey according to English # pluralization rules : @@ -226,6 +230,8 @@ module I18n raise InvalidLocaleData.new(filename, 'expects it to return a hash, but does not') end data.each { |locale, d| store_translations(locale, d || {}, skip_symbolize_keys: keys_symbolized) } + + data end # Loads a plain Ruby translations file. eval'ing the file must yield diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/cache.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/cache.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/cache.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/cache.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/cache_file.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/cache_file.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/cache_file.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/cache_file.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/cascade.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/cascade.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/cascade.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/cascade.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/chain.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/chain.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/chain.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/chain.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/fallbacks.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/fallbacks.rb similarity index 87% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/fallbacks.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/fallbacks.rb index acab6dfec6..7afbfe3a22 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/fallbacks.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/fallbacks.rb @@ -64,13 +64,20 @@ module I18n throw(:exception, I18n::MissingTranslation.new(locale, key, options)) end - def resolve(locale, object, subject, options = EMPTY_HASH) + def resolve_entry(locale, object, subject, options = EMPTY_HASH) return subject if options[:resolve] == false - return super unless subject.is_a?(Symbol) - result = catch(:exception) do - options.delete(:fallback_in_progress) - I18n.translate(subject, **options.merge(locale: options[:fallback_original_locale], throw: true)) + options.delete(:fallback_in_progress) if options.key?(:fallback_in_progress) + + case subject + when Symbol + I18n.translate(subject, **options.merge(:locale => options[:fallback_original_locale], :throw => true)) + when Proc + date_or_time = options.delete(:object) || object + resolve_entry(options[:fallback_original_locale], object, subject.call(date_or_time, **options)) + else + subject + end end result unless result.is_a?(MissingTranslation) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/flatten.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/flatten.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/flatten.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/flatten.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/gettext.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/gettext.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/gettext.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/gettext.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/interpolation_compiler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/interpolation_compiler.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/interpolation_compiler.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/interpolation_compiler.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/key_value.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/key_value.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/key_value.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/key_value.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/lazy_loadable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/lazy_loadable.rb new file mode 100644 index 0000000000..60f21fa12d --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/lazy_loadable.rb @@ -0,0 +1,184 @@ +# frozen_string_literal: true + +module I18n + module Backend + # Backend that lazy loads translations based on the current locale. This + # implementation avoids loading all translations up front. Instead, it only + # loads the translations that belong to the current locale. This offers a + # performance incentive in local development and test environments for + # applications with many translations for many different locales. It's + # particularly useful when the application only refers to a single locales' + # translations at a time (ex. A Rails workload). The implementation + # identifies which translation files from the load path belong to the + # current locale by pattern matching against their path name. + # + # Specifically, a translation file is considered to belong to a locale if: + # a) the filename is in the I18n load path + # b) the filename ends in a supported extension (ie. .yml, .json, .po, .rb) + # c) the filename starts with the locale identifier + # d) the locale identifier and optional proceeding text is separated by an underscore, ie. "_". + # + # Examples: + # Valid files that will be selected by this backend: + # + # "files/locales/en_translation.yml" (Selected for locale "en") + # "files/locales/fr.po" (Selected for locale "fr") + # + # Invalid files that won't be selected by this backend: + # + # "files/locales/translation-file" + # "files/locales/en-translation.unsupported" + # "files/locales/french/translation.yml" + # "files/locales/fr/translation.yml" + # + # The implementation uses this assumption to defer the loading of + # translation files until the current locale actually requires them. + # + # The backend has two working modes: lazy_load and eager_load. + # + # Note: This backend should only be enabled in test environments! + # When the mode is set to false, the backend behaves exactly like the + # Simple backend, with an additional check that the paths being loaded + # abide by the format. If paths can't be matched to the format, an error is raised. + # + # You can configure lazy loaded backends through the initializer or backends + # accessor: + # + # # In test environments + # + # I18n.backend = I18n::Backend::LazyLoadable.new(lazy_load: true) + # + # # In other environments, such as production and CI + # + # I18n.backend = I18n::Backend::LazyLoadable.new(lazy_load: false) # default + # + class LocaleExtractor + class << self + def locale_from_path(path) + name = File.basename(path, ".*") + locale = name.split("_").first + locale.to_sym unless locale.nil? + end + end + end + + class LazyLoadable < Simple + def initialize(lazy_load: false) + @lazy_load = lazy_load + end + + # Returns whether the current locale is initialized. + def initialized? + if lazy_load? + initialized_locales[I18n.locale] + else + super + end + end + + # Clean up translations and uninitialize all locales. + def reload! + if lazy_load? + @initialized_locales = nil + @translations = nil + else + super + end + end + + # Eager loading is not supported in the lazy context. + def eager_load! + if lazy_load? + raise UnsupportedMethod.new(__method__, self.class, "Cannot eager load translations because backend was configured with lazy_load: true.") + else + super + end + end + + # Parse the load path and extract all locales. + def available_locales + if lazy_load? + I18n.load_path.map { |path| LocaleExtractor.locale_from_path(path) } + else + super + end + end + + def lookup(locale, key, scope = [], options = EMPTY_HASH) + if lazy_load? + I18n.with_locale(locale) do + super + end + else + super + end + end + + protected + + + # Load translations from files that belong to the current locale. + def init_translations + file_errors = if lazy_load? + initialized_locales[I18n.locale] = true + load_translations_and_collect_file_errors(filenames_for_current_locale) + else + @initialized = true + load_translations_and_collect_file_errors(I18n.load_path) + end + + raise InvalidFilenames.new(file_errors) unless file_errors.empty? + end + + def initialized_locales + @initialized_locales ||= Hash.new(false) + end + + private + + def lazy_load? + @lazy_load + end + + class FilenameIncorrect < StandardError + def initialize(file, expected_locale, unexpected_locales) + super "#{file} can only load translations for \"#{expected_locale}\". Found translations for: #{unexpected_locales}." + end + end + + # Loads each file supplied and asserts that the file only loads + # translations as expected by the name. The method returns a list of + # errors corresponding to offending files. + def load_translations_and_collect_file_errors(files) + errors = [] + + load_translations(files) do |file, loaded_translations| + assert_file_named_correctly!(file, loaded_translations) + rescue FilenameIncorrect => e + errors << e + end + + errors + end + + # Select all files from I18n load path that belong to current locale. + # These files must start with the locale identifier (ie. "en", "pt-BR"), + # followed by an "_" demarcation to separate proceeding text. + def filenames_for_current_locale + I18n.load_path.flatten.select do |path| + LocaleExtractor.locale_from_path(path) == I18n.locale + end + end + + # Checks if a filename is named in correspondence to the translations it loaded. + # The locale extracted from the path must be the single locale loaded in the translations. + def assert_file_named_correctly!(file, translations) + loaded_locales = translations.keys.map(&:to_sym) + expected_locale = LocaleExtractor.locale_from_path(file) + unexpected_locales = loaded_locales.reject { |locale| locale == expected_locale } + + raise FilenameIncorrect.new(file, expected_locale, unexpected_locales) unless unexpected_locales.empty? + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/memoize.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/memoize.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/memoize.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/memoize.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/metadata.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/metadata.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/metadata.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/metadata.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/pluralization.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/pluralization.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/pluralization.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/pluralization.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/simple.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/simple.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/simple.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/simple.rb index 687c115413..0c49de8f92 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/simple.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/simple.rb @@ -94,7 +94,7 @@ module I18n return nil unless result.has_key?(_key) end result = result[_key] - result = resolve(locale, _key, result, options.merge(:scope => nil)) if result.is_a?(Symbol) + result = resolve_entry(locale, _key, result, options.merge(:scope => nil)) if result.is_a?(Symbol) result end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/transliterator.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/transliterator.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/backend/transliterator.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/backend/transliterator.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/config.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/config.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/config.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/config.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/exceptions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/exceptions.rb similarity index 75% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/exceptions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/exceptions.rb index 212a9039e2..f66e2076c8 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/exceptions.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/exceptions.rb @@ -110,4 +110,38 @@ module I18n super "can not load translations from #{filename}, the file type #{type} is not known" end end + + class UnsupportedMethod < ArgumentError + attr_reader :method, :backend_klass, :msg + def initialize(method, backend_klass, msg) + @method = method + @backend_klass = backend_klass + @msg = msg + super "#{backend_klass} does not support the ##{method} method. #{msg}" + end + end + + class InvalidFilenames < ArgumentError + NUMBER_OF_ERRORS_SHOWN = 20 + def initialize(file_errors) + super <<~MSG + Found #{file_errors.count} error(s). + The first #{[file_errors.count, NUMBER_OF_ERRORS_SHOWN].min} error(s): + #{file_errors.map(&:message).first(NUMBER_OF_ERRORS_SHOWN).join("\n")} + + To use the LazyLoadable backend: + 1. Filenames must start with the locale. + 2. An underscore must separate the locale with any optional text that follows. + 3. The file must only contain translation data for the single locale. + + Example: + "/config/locales/fr.yml" which contains: + ```yml + fr: + dog: + chien + ``` + MSG + end + end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/gettext.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/gettext.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/gettext.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/gettext.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/gettext/helpers.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/gettext/helpers.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/gettext/helpers.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/gettext/helpers.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/gettext/po_parser.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/gettext/po_parser.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/gettext/po_parser.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/gettext/po_parser.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/interpolate/ruby.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/interpolate/ruby.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/interpolate/ruby.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/interpolate/ruby.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/locale.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/locale.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/locale.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/locale.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/locale/fallbacks.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/locale/fallbacks.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/locale/fallbacks.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/locale/fallbacks.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/locale/tag.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/locale/tag.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/locale/tag.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/locale/tag.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/locale/tag/parents.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/locale/tag/parents.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/locale/tag/parents.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/locale/tag/parents.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/locale/tag/rfc4646.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/locale/tag/rfc4646.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/locale/tag/rfc4646.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/locale/tag/rfc4646.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/locale/tag/simple.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/locale/tag/simple.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/locale/tag/simple.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/locale/tag/simple.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/middleware.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/middleware.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/middleware.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/middleware.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/utils.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/utils.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/utils.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/utils.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/version.rb similarity index 69% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/version.rb index d55f340656..bc754ba526 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.9.1/lib/i18n/version.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.10.0/lib/i18n/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module I18n - VERSION = "1.9.1" + VERSION = "1.10.0" end From 2448757557625c77d20476c7c6faf75df4974dfd Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Tue, 15 Feb 2022 18:11:05 +0000 Subject: [PATCH 3/3] Update RBI files for i18n. --- .../gems/{i18n@1.9.1.rbi => i18n@1.10.0.rbi} | 49 ++++++++++++++++++- .../sorbet/rbi/hidden-definitions/hidden.rbi | 16 +----- 2 files changed, 50 insertions(+), 15 deletions(-) rename Library/Homebrew/sorbet/rbi/gems/{i18n@1.9.1.rbi => i18n@1.10.0.rbi} (93%) diff --git a/Library/Homebrew/sorbet/rbi/gems/i18n@1.9.1.rbi b/Library/Homebrew/sorbet/rbi/gems/i18n@1.10.0.rbi similarity index 93% rename from Library/Homebrew/sorbet/rbi/gems/i18n@1.9.1.rbi rename to Library/Homebrew/sorbet/rbi/gems/i18n@1.10.0.rbi index 3faf895400..f5405c64e6 100644 --- a/Library/Homebrew/sorbet/rbi/gems/i18n@1.9.1.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/i18n@1.10.0.rbi @@ -79,6 +79,7 @@ module I18n::Backend::Base def pluralization_key(entry, count); end def pluralize(locale, entry, count); end def resolve(locale, object, subject, options = T.unsafe(nil)); end + def resolve_entry(locale, object, subject, options = T.unsafe(nil)); end def subtrees?; end def translate_localization_format(locale, object, format, options); end end @@ -148,7 +149,7 @@ end module I18n::Backend::Fallbacks def exists?(locale, key, options = T.unsafe(nil)); end def extract_non_symbol_default!(options); end - def resolve(locale, object, subject, options = T.unsafe(nil)); end + def resolve_entry(locale, object, subject, options = T.unsafe(nil)); end def translate(locale, key, options = T.unsafe(nil)); end private @@ -266,6 +267,38 @@ class I18n::Backend::KeyValue::SubtreeProxy def nil?; end end +class I18n::Backend::LazyLoadable < ::I18n::Backend::Simple + def initialize(lazy_load: T.unsafe(nil)); end + + def available_locales; end + def eager_load!; end + def initialized?; end + def lookup(locale, key, scope = T.unsafe(nil), options = T.unsafe(nil)); end + def reload!; end + + protected + + def init_translations; end + def initialized_locales; end + + private + + def assert_file_named_correctly!(file, translations); end + def filenames_for_current_locale; end + def lazy_load?; end + def load_translations_and_collect_file_errors(files); end +end + +class I18n::Backend::LazyLoadable::FilenameIncorrect < ::StandardError + def initialize(file, expected_locale, unexpected_locales); end +end + +class I18n::Backend::LocaleExtractor + class << self + def locale_from_path(path); end + end +end + module I18n::Backend::Memoize def available_locales; end def eager_load!; end @@ -462,6 +495,12 @@ end I18n::Gettext::PLURAL_SEPARATOR = T.let(T.unsafe(nil), String) I18n::INTERPOLATION_PATTERN = T.let(T.unsafe(nil), Regexp) +class I18n::InvalidFilenames < ::I18n::ArgumentError + def initialize(file_errors); end +end + +I18n::InvalidFilenames::NUMBER_OF_ERRORS_SHOWN = T.let(T.unsafe(nil), Integer) + class I18n::InvalidLocale < ::I18n::ArgumentError def initialize(locale); end @@ -654,6 +693,14 @@ class I18n::UnknownFileType < ::I18n::ArgumentError def type; end end +class I18n::UnsupportedMethod < ::I18n::ArgumentError + def initialize(method, backend_klass, msg); end + + def backend_klass; end + def method; end + def msg; end +end + module I18n::Utils class << self def deep_merge(hash, other_hash, &block); end diff --git a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi index 4aba981365..52b9694b37 100644 --- a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi +++ b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi @@ -3498,13 +3498,7 @@ end Net::HTTPFatalErrorCode = Net::HTTPClientError -class Net::HTTPInformation -end - -Net::HTTPInformationCode::EXCEPTION_TYPE = Net::HTTPError - -class Net::HTTPInformation -end +Net::HTTPInformationCode = Net::HTTPInformation class Net::HTTPLoopDetected HAS_BODY = ::T.let(nil, ::T.untyped) @@ -3564,13 +3558,7 @@ Net::HTTPServerErrorCode = Net::HTTPServerError Net::HTTPSession = Net::HTTP -class Net::HTTPSuccess -end - -Net::HTTPSuccessCode::EXCEPTION_TYPE = Net::HTTPError - -class Net::HTTPSuccess -end +Net::HTTPSuccessCode = Net::HTTPSuccess class Net::HTTPURITooLong HAS_BODY = ::T.let(nil, ::T.untyped)