Merge pull request #13558 from Homebrew/dependabot/bundler/Library/Homebrew/i18n-1.12.0
build(deps): bump i18n from 1.11.0 to 1.12.0 in /Library/Homebrew
This commit is contained in:
commit
0c785673d9
@ -33,7 +33,7 @@ GEM
|
|||||||
hpricot (0.8.6)
|
hpricot (0.8.6)
|
||||||
http-cookie (1.0.5)
|
http-cookie (1.0.5)
|
||||||
domain_name (~> 0.5)
|
domain_name (~> 0.5)
|
||||||
i18n (1.11.0)
|
i18n (1.12.0)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
json (2.6.2)
|
json (2.6.2)
|
||||||
json_schemer (0.2.21)
|
json_schemer (0.2.21)
|
||||||
|
|||||||
@ -333,10 +333,6 @@ module I18n::Backend::Pluralization
|
|||||||
|
|
||||||
def pluralizer(locale); end
|
def pluralizer(locale); end
|
||||||
def pluralizers; end
|
def pluralizers; end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def symbolic_count(count); end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class I18n::Backend::Simple
|
class I18n::Backend::Simple
|
||||||
@ -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.10/lib/concurrent-ruby"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.11.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.12.0/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.16.2/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.16.2/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-2.0.4/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-2.0.4/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/zeitwerk-2.6.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/zeitwerk-2.6.0/lib"
|
||||||
|
|||||||
@ -1,90 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
# I18n Pluralization are useful when you want your application to
|
|
||||||
# customize pluralization rules.
|
|
||||||
#
|
|
||||||
# To enable locale specific pluralizations you can simply include the
|
|
||||||
# Pluralization module to the Simple backend - or whatever other backend you
|
|
||||||
# are using.
|
|
||||||
#
|
|
||||||
# I18n::Backend::Simple.include(I18n::Backend::Pluralization)
|
|
||||||
#
|
|
||||||
# You also need to make sure to provide pluralization algorithms to the
|
|
||||||
# backend, i.e. include them to your I18n.load_path accordingly.
|
|
||||||
module I18n
|
|
||||||
module Backend
|
|
||||||
module Pluralization
|
|
||||||
# Overwrites the Base backend translate method so that it will check the
|
|
||||||
# translation meta data space (:i18n) for a locale specific pluralization
|
|
||||||
# rule and use it to pluralize the given entry. I.e., the library expects
|
|
||||||
# pluralization rules to be stored at I18n.t(:'i18n.plural.rule')
|
|
||||||
#
|
|
||||||
# Pluralization rules are expected to respond to #call(count) and
|
|
||||||
# return a pluralization key. Valid keys depend on the pluralization
|
|
||||||
# rules for the locale, as defined in the CLDR.
|
|
||||||
# As of v41, 6 locale-specific plural categories are defined:
|
|
||||||
# :few, :many, :one, :other, :two, :zero
|
|
||||||
#
|
|
||||||
# n.b., The :one plural category does not imply the number 1.
|
|
||||||
# Instead, :one is a category for any number that behaves like 1 in
|
|
||||||
# that locale. For example, in some locales, :one is used for numbers
|
|
||||||
# that end in "1" (like 1, 21, 151) but that don't end in
|
|
||||||
# 11 (like 11, 111, 10311).
|
|
||||||
# Similar notes apply to the :two, and :zero plural categories.
|
|
||||||
#
|
|
||||||
# If you want to have different strings for the categories of count == 0
|
|
||||||
# (e.g. "I don't have any cars") or count == 1 (e.g. "I have a single car")
|
|
||||||
# use the explicit `"0"` and `"1"` keys.
|
|
||||||
# https://unicode-org.github.io/cldr/ldml/tr35-numbers.html#Explicit_0_1_rules
|
|
||||||
def pluralize(locale, entry, count)
|
|
||||||
return entry unless entry.is_a?(Hash) && count
|
|
||||||
|
|
||||||
pluralizer = pluralizer(locale)
|
|
||||||
if pluralizer.respond_to?(:call)
|
|
||||||
# "0" and "1" are special cases
|
|
||||||
# https://unicode-org.github.io/cldr/ldml/tr35-numbers.html#Explicit_0_1_rules
|
|
||||||
if count == 0 || count == 1
|
|
||||||
value = entry[symbolic_count(count)]
|
|
||||||
return value if value
|
|
||||||
end
|
|
||||||
|
|
||||||
# Lateral Inheritance of "count" attribute (http://www.unicode.org/reports/tr35/#Lateral_Inheritance):
|
|
||||||
# > If there is no value for a path, and that path has a [@count="x"] attribute and value, then:
|
|
||||||
# > 1. If "x" is numeric, the path falls back to the path with [@count=«the plural rules category for x for that locale»], within that the same locale.
|
|
||||||
# > 2. If "x" is anything but "other", it falls back to a path [@count="other"], within that the same locale.
|
|
||||||
# > 3. If "x" is "other", it falls back to the path that is completely missing the count item, within that the same locale.
|
|
||||||
# Note: We don't yet implement #3 above, since we haven't decided how lateral inheritance attributes should be represented.
|
|
||||||
plural_rule_category = pluralizer.call(count)
|
|
||||||
|
|
||||||
value = if entry.has_key?(plural_rule_category) || entry.has_key?(:other)
|
|
||||||
entry[plural_rule_category] || entry[:other]
|
|
||||||
else
|
|
||||||
raise InvalidPluralizationData.new(entry, count, plural_rule_category)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
super
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
protected
|
|
||||||
|
|
||||||
def pluralizers
|
|
||||||
@pluralizers ||= {}
|
|
||||||
end
|
|
||||||
|
|
||||||
def pluralizer(locale)
|
|
||||||
pluralizers[locale] ||= I18n.t(:'i18n.plural.rule', :locale => locale, :resolve => false)
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
# Normalizes categories of 0.0 and 1.0
|
|
||||||
# and returns the symbolic version
|
|
||||||
def symbolic_count(count)
|
|
||||||
count = 0 if count == 0
|
|
||||||
count = 1 if count == 1
|
|
||||||
count.to_s.to_sym
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
55
Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.12.0/lib/i18n/backend/pluralization.rb
vendored
Normal file
55
Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.12.0/lib/i18n/backend/pluralization.rb
vendored
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# I18n Pluralization are useful when you want your application to
|
||||||
|
# customize pluralization rules.
|
||||||
|
#
|
||||||
|
# To enable locale specific pluralizations you can simply include the
|
||||||
|
# Pluralization module to the Simple backend - or whatever other backend you
|
||||||
|
# are using.
|
||||||
|
#
|
||||||
|
# I18n::Backend::Simple.include(I18n::Backend::Pluralization)
|
||||||
|
#
|
||||||
|
# You also need to make sure to provide pluralization algorithms to the
|
||||||
|
# backend, i.e. include them to your I18n.load_path accordingly.
|
||||||
|
module I18n
|
||||||
|
module Backend
|
||||||
|
module Pluralization
|
||||||
|
# Overwrites the Base backend translate method so that it will check the
|
||||||
|
# translation meta data space (:i18n) for a locale specific pluralization
|
||||||
|
# rule and use it to pluralize the given entry. I.e. the library expects
|
||||||
|
# pluralization rules to be stored at I18n.t(:'i18n.plural.rule')
|
||||||
|
#
|
||||||
|
# Pluralization rules are expected to respond to #call(count) and
|
||||||
|
# return a pluralization key. Valid keys depend on the translation data
|
||||||
|
# hash (entry) but it is generally recommended to follow CLDR's style,
|
||||||
|
# i.e., return one of the keys :zero, :one, :few, :many, :other.
|
||||||
|
#
|
||||||
|
# The :zero key is always picked directly when count equals 0 AND the
|
||||||
|
# translation data has the key :zero. This way translators are free to
|
||||||
|
# either pick a special :zero translation even for languages where the
|
||||||
|
# pluralizer does not return a :zero key.
|
||||||
|
def pluralize(locale, entry, count)
|
||||||
|
return entry unless entry.is_a?(Hash) && count
|
||||||
|
|
||||||
|
pluralizer = pluralizer(locale)
|
||||||
|
if pluralizer.respond_to?(:call)
|
||||||
|
key = count == 0 && entry.has_key?(:zero) ? :zero : pluralizer.call(count)
|
||||||
|
raise InvalidPluralizationData.new(entry, count, key) unless entry.has_key?(key)
|
||||||
|
entry[key]
|
||||||
|
else
|
||||||
|
super
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def pluralizers
|
||||||
|
@pluralizers ||= {}
|
||||||
|
end
|
||||||
|
|
||||||
|
def pluralizer(locale)
|
||||||
|
pluralizers[locale] ||= I18n.t(:'i18n.plural.rule', :locale => locale, :resolve => false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -1,5 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module I18n
|
module I18n
|
||||||
VERSION = "1.11.0"
|
VERSION = "1.12.0"
|
||||||
end
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user