Merge pull request #7699 from Homebrew/dependabot/bundler/Library/Homebrew/i18n-1.8.3
build(deps): bump i18n from 1.8.2 to 1.8.3 in /Library/Homebrew
This commit is contained in:
commit
13caf6e6bb
@ -24,7 +24,7 @@ GEM
|
|||||||
hpricot (0.8.6)
|
hpricot (0.8.6)
|
||||||
http-cookie (1.0.3)
|
http-cookie (1.0.3)
|
||||||
domain_name (~> 0.5)
|
domain_name (~> 0.5)
|
||||||
i18n (1.8.2)
|
i18n (1.8.3)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
json (2.3.0)
|
json (2.3.0)
|
||||||
mechanize (2.7.6)
|
mechanize (2.7.6)
|
||||||
|
@ -4,7 +4,7 @@ ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
|
|||||||
ruby_version = RbConfig::CONFIG["ruby_version"]
|
ruby_version = RbConfig::CONFIG["ruby_version"]
|
||||||
path = File.expand_path('..', __FILE__)
|
path = File.expand_path('..', __FILE__)
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.8.2/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.8.3/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.14.1/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.14.1/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/thread_safe-0.3.6/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/thread_safe-0.3.6/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-1.2.7/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-1.2.7/lib"
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
module I18n
|
|
||||||
module Locale
|
|
||||||
module Tag
|
|
||||||
module Parents
|
|
||||||
def parent
|
|
||||||
@parent ||= begin
|
|
||||||
segs = to_a.compact
|
|
||||||
segs.length > 1 ? self.class.tag(*segs[0..(segs.length-2)].join('-')) : nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def self_and_parents
|
|
||||||
@self_and_parents ||= [self] + parents
|
|
||||||
end
|
|
||||||
|
|
||||||
def parents
|
|
||||||
@parents ||= ([parent] + (parent ? parent.parents : [])).compact
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -223,11 +223,11 @@ module I18n
|
|||||||
alias :t! :translate!
|
alias :t! :translate!
|
||||||
|
|
||||||
# Returns true if a translation exists for a given key, otherwise returns false.
|
# Returns true if a translation exists for a given key, otherwise returns false.
|
||||||
def exists?(key, _locale = nil, locale: _locale)
|
def exists?(key, _locale = nil, locale: _locale, **options)
|
||||||
locale ||= config.locale
|
locale ||= config.locale
|
||||||
raise Disabled.new('exists?') if locale == false
|
raise Disabled.new('exists?') if locale == false
|
||||||
raise I18n::ArgumentError if key.is_a?(String) && key.empty?
|
raise I18n::ArgumentError if key.is_a?(String) && key.empty?
|
||||||
config.backend.exists?(locale, key)
|
config.backend.exists?(locale, key, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Transliterates UTF-8 characters to ASCII. By default this method will
|
# Transliterates UTF-8 characters to ASCII. By default this method will
|
||||||
@ -389,7 +389,7 @@ module I18n
|
|||||||
@@normalized_key_cache[separator][key] ||=
|
@@normalized_key_cache[separator][key] ||=
|
||||||
case key
|
case key
|
||||||
when Array
|
when Array
|
||||||
key.map { |k| normalize_key(k, separator) }.flatten
|
key.flat_map { |k| normalize_key(k, separator) }
|
||||||
else
|
else
|
||||||
keys = key.to_s.split(separator)
|
keys = key.to_s.split(separator)
|
||||||
keys.delete('')
|
keys.delete('')
|
@ -64,7 +64,7 @@ module I18n
|
|||||||
entry
|
entry
|
||||||
end
|
end
|
||||||
|
|
||||||
def exists?(locale, key)
|
def exists?(locale, key, options = EMPTY_HASH)
|
||||||
lookup(locale, key) != nil
|
lookup(locale, key) != nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ module I18n
|
|||||||
I18n.translate(subject, **options.merge(:locale => locale, :throw => true))
|
I18n.translate(subject, **options.merge(:locale => locale, :throw => true))
|
||||||
when Proc
|
when Proc
|
||||||
date_or_time = options.delete(:object) || object
|
date_or_time = options.delete(:object) || object
|
||||||
resolve(locale, object, subject.call(date_or_time, options))
|
resolve(locale, object, subject.call(date_or_time, **options))
|
||||||
else
|
else
|
||||||
subject
|
subject
|
||||||
end
|
end
|
||||||
@ -163,6 +163,7 @@ module I18n
|
|||||||
# not standard with regards to the CLDR pluralization rules.
|
# not standard with regards to the CLDR pluralization rules.
|
||||||
# Other backends can implement more flexible or complex pluralization rules.
|
# Other backends can implement more flexible or complex pluralization rules.
|
||||||
def pluralize(locale, entry, count)
|
def pluralize(locale, entry, count)
|
||||||
|
entry = entry.reject { |k, _v| k == :attributes } if entry.is_a?(Hash)
|
||||||
return entry unless entry.is_a?(Hash) && count && entry.values.none? { |v| v.is_a?(Hash) }
|
return entry unless entry.is_a?(Hash) && count && entry.values.none? { |v| v.is_a?(Hash) }
|
||||||
|
|
||||||
key = pluralization_key(entry, count)
|
key = pluralization_key(entry, count)
|
@ -73,9 +73,9 @@ module I18n
|
|||||||
throw(:exception, I18n::MissingTranslation.new(locale, key, options))
|
throw(:exception, I18n::MissingTranslation.new(locale, key, options))
|
||||||
end
|
end
|
||||||
|
|
||||||
def exists?(locale, key)
|
def exists?(locale, key, options = EMPTY_HASH)
|
||||||
backends.any? do |backend|
|
backends.any? do |backend|
|
||||||
backend.exists?(locale, key)
|
backend.exists?(locale, key, options)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -101,8 +101,7 @@ module I18n
|
|||||||
init_translations unless initialized?
|
init_translations unless initialized?
|
||||||
translations
|
translations
|
||||||
end
|
end
|
||||||
|
memo.deep_merge!(partial_translations) { |_, a, b| b || a }
|
||||||
memo.deep_merge!(partial_translations)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -46,7 +46,10 @@ module I18n
|
|||||||
begin
|
begin
|
||||||
catch(:exception) do
|
catch(:exception) do
|
||||||
result = super(fallback, key, fallback_options)
|
result = super(fallback, key, fallback_options)
|
||||||
return result unless result.nil?
|
unless result.nil?
|
||||||
|
on_fallback(locale, fallback, key, options) if locale != fallback
|
||||||
|
return result
|
||||||
|
end
|
||||||
end
|
end
|
||||||
rescue I18n::InvalidLocale
|
rescue I18n::InvalidLocale
|
||||||
# we do nothing when the locale is invalid, as this is a fallback anyways.
|
# we do nothing when the locale is invalid, as this is a fallback anyways.
|
||||||
@ -68,7 +71,8 @@ module I18n
|
|||||||
return first_non_symbol_default
|
return first_non_symbol_default
|
||||||
end
|
end
|
||||||
|
|
||||||
def exists?(locale, key)
|
def exists?(locale, key, options = EMPTY_HASH)
|
||||||
|
return super unless options.fetch(:fallback, true)
|
||||||
I18n.fallbacks[locale].each do |fallback|
|
I18n.fallbacks[locale].each do |fallback|
|
||||||
begin
|
begin
|
||||||
return true if super(fallback, key)
|
return true if super(fallback, key)
|
||||||
@ -79,6 +83,13 @@ module I18n
|
|||||||
|
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
# Overwrite on_fallback to add specified logic when the fallback succeeds.
|
||||||
|
def on_fallback(_original_locale, _fallback_locale, _key, _optoins)
|
||||||
|
nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
@ -18,14 +18,17 @@ module I18n
|
|||||||
# and creates way less objects than the one at I18n.normalize_keys.
|
# and creates way less objects than the one at I18n.normalize_keys.
|
||||||
# It also handles escaping the translation keys.
|
# It also handles escaping the translation keys.
|
||||||
def self.normalize_flat_keys(locale, key, scope, separator)
|
def self.normalize_flat_keys(locale, key, scope, separator)
|
||||||
keys = [scope, key].flatten.compact
|
keys = [scope, key]
|
||||||
|
keys.flatten!
|
||||||
|
keys.compact!
|
||||||
|
|
||||||
separator ||= I18n.default_separator
|
separator ||= I18n.default_separator
|
||||||
|
|
||||||
if separator != FLATTEN_SEPARATOR
|
if separator != FLATTEN_SEPARATOR
|
||||||
keys.map! do |k|
|
from_str = "#{FLATTEN_SEPARATOR}#{separator}"
|
||||||
k.to_s.tr("#{FLATTEN_SEPARATOR}#{separator}",
|
to_str = "#{SEPARATOR_ESCAPE_CHAR}#{FLATTEN_SEPARATOR}"
|
||||||
"#{SEPARATOR_ESCAPE_CHAR}#{FLATTEN_SEPARATOR}")
|
|
||||||
end
|
keys.map! { |k| k.to_s.tr from_str, to_str }
|
||||||
end
|
end
|
||||||
|
|
||||||
keys.join(".")
|
keys.join(".")
|
@ -18,12 +18,24 @@ module I18n
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# deep_merge_hash! by Stefan Rusterholz, see http://www.ruby-forum.com/topic/142809
|
# deep_merge from activesupport 5
|
||||||
def deep_merge!(data)
|
# Copyright (c) 2005-2019 David Heinemeier Hansson
|
||||||
merger = lambda do |_key, v1, v2|
|
def deep_merge(other_hash, &block)
|
||||||
Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2
|
dup.deep_merge!(other_hash, &block)
|
||||||
|
end
|
||||||
|
|
||||||
|
# deep_merge! from activesupport 5
|
||||||
|
# Copyright (c) 2005-2019 David Heinemeier Hansson
|
||||||
|
def deep_merge!(other_hash, &block)
|
||||||
|
merge!(other_hash) do |key, this_val, other_val|
|
||||||
|
if this_val.is_a?(Hash) && other_val.is_a?(Hash)
|
||||||
|
this_val.deep_merge(other_val, &block)
|
||||||
|
elsif block_given?
|
||||||
|
block.call(key, this_val, other_val)
|
||||||
|
else
|
||||||
|
other_val
|
||||||
|
end
|
||||||
end
|
end
|
||||||
merge!(data, &merger)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def symbolize_key(key)
|
def symbolize_key(key)
|
@ -60,7 +60,7 @@ module I18n
|
|||||||
end
|
end
|
||||||
|
|
||||||
def defaults=(defaults)
|
def defaults=(defaults)
|
||||||
@defaults = defaults.map { |default| compute(default, false) }.flatten
|
@defaults = defaults.flat_map { |default| compute(default, false) }
|
||||||
end
|
end
|
||||||
attr_reader :defaults
|
attr_reader :defaults
|
||||||
|
|
||||||
@ -84,13 +84,15 @@ module I18n
|
|||||||
protected
|
protected
|
||||||
|
|
||||||
def compute(tags, include_defaults = true, exclude = [])
|
def compute(tags, include_defaults = true, exclude = [])
|
||||||
result = Array(tags).collect do |tag|
|
result = Array(tags).flat_map do |tag|
|
||||||
tags = I18n::Locale::Tag.tag(tag).self_and_parents.map! { |t| t.to_sym } - exclude
|
tags = I18n::Locale::Tag.tag(tag).self_and_parents.map! { |t| t.to_sym } - exclude
|
||||||
tags.each { |_tag| tags += compute(@map[_tag], false, exclude + tags) if @map[_tag] }
|
tags.each { |_tag| tags += compute(@map[_tag], false, exclude + tags) if @map[_tag] }
|
||||||
tags
|
tags
|
||||||
end.flatten
|
end
|
||||||
result.push(*defaults) if include_defaults
|
result.push(*defaults) if include_defaults
|
||||||
result.uniq.compact
|
result.uniq!
|
||||||
|
result.compact!
|
||||||
|
result
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
24
Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.3/lib/i18n/locale/tag/parents.rb
vendored
Normal file
24
Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.3/lib/i18n/locale/tag/parents.rb
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
module I18n
|
||||||
|
module Locale
|
||||||
|
module Tag
|
||||||
|
module Parents
|
||||||
|
def parent
|
||||||
|
@parent ||=
|
||||||
|
begin
|
||||||
|
segs = to_a
|
||||||
|
segs.compact!
|
||||||
|
segs.length > 1 ? self.class.tag(*segs[0..(segs.length - 2)].join('-')) : nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def self_and_parents
|
||||||
|
@self_and_parents ||= [self].concat parents
|
||||||
|
end
|
||||||
|
|
||||||
|
def parents
|
||||||
|
@parents ||= parent ? [parent].concat(parent.parents) : []
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -19,7 +19,7 @@ module I18n
|
|||||||
end
|
end
|
||||||
|
|
||||||
def subtags
|
def subtags
|
||||||
@subtags = tag.to_s.split('-').map { |subtag| subtag.to_s }
|
@subtags = tag.to_s.split('-').map!(&:to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_sym
|
def to_sym
|
@ -1,5 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module I18n
|
module I18n
|
||||||
VERSION = "1.8.2"
|
VERSION = "1.8.3"
|
||||||
end
|
end
|
Loading…
x
Reference in New Issue
Block a user