Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package rubygem-i18n for openSUSE:Factory checked in at 2023-11-05 12:18:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-i18n (Old) and /work/SRC/openSUSE:Factory/.rubygem-i18n.new.17445 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-i18n" Sun Nov 5 12:18:49 2023 rev:36 rq:1123206 version:1.14.1 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-i18n/rubygem-i18n.changes 2022-08-07 18:33:57.857158870 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-i18n.new.17445/rubygem-i18n.changes 2023-11-05 12:19:04.769765659 +0100 @@ -1,0 +2,65 @@ +Fri Nov 3 07:39:05 UTC 2023 - Dan Äermák <[email protected]> + +- 1.14.1: + +## Included in this release + +* Simplify the "Translation missing" message when default is an empty Array by @amatsuda in https://github.com/ruby-i18n/i18n/pull/662 + +## Maintenance stuff +* Skip CIing on jruby against Rails 5.2 by @amatsuda in https://github.com/ruby-i18n/i18n/pull/664 +* A fix for failing CI against edge Rails by @amatsuda in https://github.com/ruby-i18n/i18n/pull/663 +* Add documentation hint for fallback values by @mark-a in https://github.com/ruby-i18n/i18n/pull/659 +* CI against Ruby 3.2 by @amatsuda in https://github.com/ruby-i18n/i18n/pull/665 +* Fix build warnings in the CI by using actions/checkout@v3 by @amatsuda in https://github.com/ruby-i18n/i18n/pull/666 + +Thanks to @amatsuda for these PRs! + +## New Contributors +* @mark-a made their first contribution in https://github.com/ruby-i18n/i18n/pull/659 + +**Full Changelog**: https://github.com/ruby-i18n/i18n/compare/v1.14.0...v1.14.1 + +1.14.0: + +## What's Changed +* fix LazyLoadable#available_locales duplicating locales by @ccutrer in https://github.com/ruby-i18n/i18n/pull/655 +* Add more helpful translation error when :default option is provided. by @Nerian in https://github.com/ruby-i18n/i18n/pull/654 +* Fix I18n::Locale::Fallbacks not initializing itself on Ruby 3 by @yheuhtozr in https://github.com/ruby-i18n/i18n/pull/653 +* Fix I18n.t when locale contains separator by @tubaxenor in https://github.com/ruby-i18n/i18n/pull/656 + * **This reverts a change from #651, that was released in v1.13.0** + +## New Contributors +* @ccutrer made their first contribution in https://github.com/ruby-i18n/i18n/pull/655 +* @Nerian made their first contribution in https://github.com/ruby-i18n/i18n/pull/654 +* @yheuhtozr made their first contribution in https://github.com/ruby-i18n/i18n/pull/653 +* @tubaxenor made their first contribution in https://github.com/ruby-i18n/i18n/pull/656 + +**Full Changelog**: https://github.com/ruby-i18n/i18n/compare/v1.13.0...v1.14.0 + +1.13.0: + +## What's Changed +* Fix symbol resolving with pluralization by @movermeyer in https://github.com/ruby-i18n/i18n/pull/636 +* Updating DEFAULT_APPROXIMATIONS with capitalised German Eszett character for consistency by @lucapericlp in https://github.com/ruby-i18n/i18n/pull/627 +* Fix load_path example in README.md by @nickcampbell18 in https://github.com/ruby-i18n/i18n/pull/642 +* Add support for meridian indicators on `Date` objects by @movermeyer in https://github.com/ruby-i18n/i18n/pull/640 +* Make translations loading thread-safe by @mensfeld in https://github.com/ruby-i18n/i18n/pull/644 +* Get closer to full CLDR pluralization support by @movermeyer in https://github.com/ruby-i18n/i18n/pull/634 +* Allow passing scope argument to exists? by @misdoro in https://github.com/ruby-i18n/i18n/pull/647 +* Revert #503 changes for `Backend::Base` by @movermeyer in https://github.com/ruby-i18n/i18n/pull/637 +* Properly stub constants by @fatkodima in https://github.com/ruby-i18n/i18n/pull/650 +* Optimize `I18n.t` by @fatkodima in https://github.com/ruby-i18n/i18n/pull/651 +* Return same string object when no interpolations were made by @fatkodima in https://github.com/ruby-i18n/i18n/pull/649 + +## New Contributors +* @lucapericlp made their first contribution in https://github.com/ruby-i18n/i18n/pull/627 +* @nickcampbell18 made their first contribution in https://github.com/ruby-i18n/i18n/pull/642 +* @mensfeld made their first contribution in https://github.com/ruby-i18n/i18n/pull/644 +* @misdoro made their first contribution in https://github.com/ruby-i18n/i18n/pull/647 + +**Full Changelog**: https://github.com/ruby-i18n/i18n/compare/v1.12.0...v1.13.0 + + + +------------------------------------------------------------------- Old: ---- i18n-1.12.0.gem New: ---- i18n-1.14.1.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-i18n.spec ++++++ --- /var/tmp/diff_new_pack.ibEjbh/_old 2023-11-05 12:19:05.469791337 +0100 +++ /var/tmp/diff_new_pack.ibEjbh/_new 2023-11-05 12:19:05.469791337 +0100 @@ -1,7 +1,7 @@ # # spec file for package rubygem-i18n # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,7 +24,7 @@ # Name: rubygem-i18n -Version: 1.12.0 +Version: 1.14.1 Release: 0 %define mod_name i18n %define mod_full_name %{mod_name}-%{version} @@ -34,16 +34,14 @@ %define rb_build_ruby_abis ruby:2.5.0 ruby:2.6.0 %endif # /MANUAL -BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildRequires: ruby-macros >= 5 BuildRequires: %{ruby >= 2.3.0} BuildRequires: %{rubygem gem2rpm} -BuildRequires: ruby-macros >= 5 URL: https://github.com/ruby-i18n/i18n Source: https://rubygems.org/gems/%{mod_full_name}.gem Source1: gem2rpm.yml Summary: New wave Internationalization support for Ruby License: MIT -Group: Development/Languages/Ruby %description New wave Internationalization support for Ruby. ++++++ i18n-1.12.0.gem -> i18n-1.14.1.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2022-07-13 22:48:41.000000000 +0200 +++ new/README.md 2023-06-04 22:27:49.000000000 +0200 @@ -26,7 +26,7 @@ Then configure I18n with some translations, and a default locale: ```ruby -I18n.load_path << Dir[File.expand_path("config/locales") + "/*.yml"] +I18n.load_path += Dir[File.expand_path("config/locales") + "/*.yml"] I18n.default_locale = :en # (note that `en` is already the default!) ``` Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/backend/base.rb new/lib/i18n/backend/base.rb --- old/lib/i18n/backend/base.rb 2022-07-13 22:48:41.000000000 +0200 +++ new/lib/i18n/backend/base.rb 2023-06-04 22:27:49.000000000 +0200 @@ -54,7 +54,7 @@ end deep_interpolation = options[:deep_interpolation] - values = Utils.except(options, *RESERVED_KEYS) + values = Utils.except(options, *RESERVED_KEYS) unless options.empty? if values entry = if deep_interpolation deep_interpolate(locale, entry, values) @@ -66,7 +66,7 @@ end def exists?(locale, key, options = EMPTY_HASH) - lookup(locale, key) != nil + lookup(locale, key, options[:scope]) != nil end # Acts the same as +strftime+, but uses a localized version of the @@ -123,7 +123,12 @@ # first translation that can be resolved. Otherwise it tries to resolve # the translation directly. def default(locale, object, subject, options = EMPTY_HASH) - options = options.reject { |key, value| key == :default } + if options.size == 1 && options.has_key?(:default) + options = {} + else + options = Utils.except(options, :default) + end + case subject when Array subject.each do |item| @@ -166,7 +171,7 @@ # Other backends can implement more flexible or complex pluralization rules. 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 key = pluralization_key(entry, count) raise InvalidPluralizationData.new(entry, count, key) unless entry.has_key?(key) @@ -282,8 +287,8 @@ when '%^b' then I18n.t!(:"date.abbr_month_names", :locale => locale, :format => format)[object.mon].upcase when '%B' then I18n.t!(:"date.month_names", :locale => locale, :format => format)[object.mon] when '%^B' then I18n.t!(:"date.month_names", :locale => locale, :format => format)[object.mon].upcase - when '%p' then I18n.t!(:"time.#{object.hour < 12 ? :am : :pm}", :locale => locale, :format => format).upcase if object.respond_to? :hour - when '%P' then I18n.t!(:"time.#{object.hour < 12 ? :am : :pm}", :locale => locale, :format => format).downcase if object.respond_to? :hour + when '%p' then I18n.t!(:"time.#{(object.respond_to?(:hour) ? object.hour : 0) < 12 ? :am : :pm}", :locale => locale, :format => format).upcase + when '%P' then I18n.t!(:"time.#{(object.respond_to?(:hour) ? object.hour : 0) < 12 ? :am : :pm}", :locale => locale, :format => format).downcase end end rescue MissingTranslationData => e diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/backend/chain.rb new/lib/i18n/backend/chain.rb --- old/lib/i18n/backend/chain.rb 2022-07-13 22:48:41.000000000 +0200 +++ new/lib/i18n/backend/chain.rb 2023-06-04 22:27:49.000000000 +0200 @@ -16,6 +16,8 @@ # # The implementation assumes that all backends added to the Chain implement # a lookup method with the same API as Simple backend does. + # + # Fallback translations using the :default option are only used by the last backend of a chain. class Chain module Implementation include Base diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/backend/lazy_loadable.rb new/lib/i18n/backend/lazy_loadable.rb --- old/lib/i18n/backend/lazy_loadable.rb 2022-07-13 22:48:41.000000000 +0200 +++ new/lib/i18n/backend/lazy_loadable.rb 2023-06-04 22:27:49.000000000 +0200 @@ -98,7 +98,7 @@ # Parse the load path and extract all locales. def available_locales if lazy_load? - I18n.load_path.map { |path| LocaleExtractor.locale_from_path(path) } + I18n.load_path.map { |path| LocaleExtractor.locale_from_path(path) }.uniq else super end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/backend/pluralization.rb new/lib/i18n/backend/pluralization.rb --- old/lib/i18n/backend/pluralization.rb 2022-07-13 22:48:41.000000000 +0200 +++ new/lib/i18n/backend/pluralization.rb 2023-06-04 22:27:49.000000000 +0200 @@ -16,26 +16,57 @@ 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 + # 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. + # 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 # - # 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. + # 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) - key = count == 0 && entry.has_key?(:zero) ? :zero : pluralizer.call(count) - raise InvalidPluralizationData.new(entry, count, key) unless entry.has_key?(key) - entry[key] + # Deprecation: The use of the `zero` key in this way is incorrect. + # Users that want a different string for the case of `count == 0` should use the explicit "0" key instead. + # We keep this incorrect behaviour for now for backwards compatibility until we can remove it. + # Ref: https://github.com/ruby-i18n/i18n/issues/629 + return entry[:zero] if count == 0 && entry.has_key?(:zero) + + # "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 @@ -43,13 +74,23 @@ protected - def pluralizers - @pluralizers ||= {} - end + def pluralizers + @pluralizers ||= {} + end - def pluralizer(locale) - pluralizers[locale] ||= I18n.t(:'i18n.plural.rule', :locale => locale, :resolve => false) - 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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/backend/simple.rb new/lib/i18n/backend/simple.rb --- old/lib/i18n/backend/simple.rb 2022-07-13 22:48:41.000000000 +0200 +++ new/lib/i18n/backend/simple.rb 2023-06-04 22:27:49.000000000 +0200 @@ -21,6 +21,9 @@ class Simple module Implementation include Base + + # Mutex to ensure that concurrent translations loading will be thread-safe + MUTEX = Mutex.new def initialized? @initialized ||= false @@ -68,7 +71,11 @@ # call `init_translations` init_translations if do_init && !initialized? - @translations ||= Concurrent::Hash.new { |h, k| h[k] = Concurrent::Hash.new } + @translations ||= Concurrent::Hash.new do |h, k| + MUTEX.synchronize do + h[k] = Concurrent::Hash.new + end + end end protected @@ -94,7 +101,7 @@ return nil unless result.has_key?(_key) end result = result[_key] - result = resolve_entry(locale, _key, result, options.merge(:scope => nil)) if result.is_a?(Symbol) + result = resolve_entry(locale, _key, result, Utils.except(options.merge(:scope => nil), :count)) if result.is_a?(Symbol) result end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/backend/transliterator.rb new/lib/i18n/backend/transliterator.rb --- old/lib/i18n/backend/transliterator.rb 2022-07-13 22:48:41.000000000 +0200 +++ new/lib/i18n/backend/transliterator.rb 2023-06-04 22:27:49.000000000 +0200 @@ -45,30 +45,30 @@ "Ã"=>"C", "Ã"=>"E", "Ã"=>"E", "Ã"=>"E", "Ã"=>"E", "Ã"=>"I", "Ã"=>"I", "Ã"=>"I", "Ã"=>"I", "Ã"=>"D", "Ã"=>"N", "Ã"=>"O", "Ã"=>"O", "Ã"=>"O", "Ã"=>"O", "Ã"=>"O", "Ã"=>"x", "Ã"=>"O", "Ã"=>"U", "Ã"=>"U", "Ã"=>"U", - "Ã"=>"U", "Ã"=>"Y", "Ã"=>"Th", "Ã"=>"ss", "à "=>"a", "á"=>"a", "â"=>"a", - "ã"=>"a", "ä"=>"a", "Ã¥"=>"a", "æ"=>"ae", "ç"=>"c", "è"=>"e", "é"=>"e", - "ê"=>"e", "ë"=>"e", "ì"=>"i", "Ã"=>"i", "î"=>"i", "ï"=>"i", "ð"=>"d", - "ñ"=>"n", "ò"=>"o", "ó"=>"o", "ô"=>"o", "õ"=>"o", "ö"=>"o", "ø"=>"o", - "ù"=>"u", "ú"=>"u", "û"=>"u", "ü"=>"u", "ý"=>"y", "þ"=>"th", "ÿ"=>"y", - "Ä"=>"A", "Ä"=>"a", "Ä"=>"A", "Ä"=>"a", "Ä"=>"A", "Ä "=>"a", "Ä"=>"C", - "Ä"=>"c", "Ä"=>"C", "Ä"=>"c", "Ä"=>"C", "Ä"=>"c", "Ä"=>"C", "Ä"=>"c", - "Ä"=>"D", "Ä"=>"d", "Ä"=>"D", "Ä"=>"d", "Ä"=>"E", "Ä"=>"e", "Ä"=>"E", - "Ä"=>"e", "Ä"=>"E", "Ä"=>"e", "Ä"=>"E", "Ä"=>"e", "Ä"=>"E", "Ä"=>"e", - "Ä"=>"G", "Ä"=>"g", "Ä"=>"G", "Ä"=>"g", "Ä "=>"G", "Ä¡"=>"g", "Ä¢"=>"G", - "Ä£"=>"g", "Ĥ"=>"H", "Ä¥"=>"h", "Ħ"=>"H", "ħ"=>"h", "Ĩ"=>"I", "Ä©"=>"i", - "Ī"=>"I", "Ä«"=>"i", "Ĭ"=>"I", "Ä"=>"i", "Ä®"=>"I", "į"=>"i", "İ"=>"I", - "ı"=>"i", "IJ"=>"IJ", "ij"=>"ij", "Ä´"=>"J", "ĵ"=>"j", "Ķ"=>"K", "Ä·"=>"k", - "ĸ"=>"k", "Ĺ"=>"L", "ĺ"=>"l", "Ä»"=>"L", "ļ"=>"l", "Ľ"=>"L", "ľ"=>"l", - "Ä¿"=>"L", "Å"=>"l", "Å"=>"L", "Å"=>"l", "Å"=>"N", "Å"=>"n", "Å "=>"N", - "Å"=>"n", "Å"=>"N", "Å"=>"n", "Å"=>"'n", "Å"=>"NG", "Å"=>"ng", - "Å"=>"O", "Å"=>"o", "Å"=>"O", "Å"=>"o", "Å"=>"O", "Å"=>"o", "Å"=>"OE", - "Å"=>"oe", "Å"=>"R", "Å"=>"r", "Å"=>"R", "Å"=>"r", "Å"=>"R", "Å"=>"r", - "Å"=>"S", "Å"=>"s", "Å"=>"S", "Å"=>"s", "Å"=>"S", "Å"=>"s", "Å "=>"S", - "Å¡"=>"s", "Å¢"=>"T", "Å£"=>"t", "Ť"=>"T", "Å¥"=>"t", "Ŧ"=>"T", "ŧ"=>"t", - "Ũ"=>"U", "Å©"=>"u", "Ū"=>"U", "Å«"=>"u", "Ŭ"=>"U", "Å"=>"u", "Å®"=>"U", - "ů"=>"u", "Ű"=>"U", "ű"=>"u", "Ų"=>"U", "ų"=>"u", "Å´"=>"W", "ŵ"=>"w", - "Ŷ"=>"Y", "Å·"=>"y", "Ÿ"=>"Y", "Ź"=>"Z", "ź"=>"z", "Å»"=>"Z", "ż"=>"z", - "Ž"=>"Z", "ž"=>"z" + "Ã"=>"U", "Ã"=>"Y", "Ã"=>"Th", "Ã"=>"ss", "áº"=>"SS", "à "=>"a", + "á"=>"a", "â"=>"a", "ã"=>"a", "ä"=>"a", "Ã¥"=>"a", "æ"=>"ae", "ç"=>"c", + "è"=>"e", "é"=>"e", "ê"=>"e", "ë"=>"e", "ì"=>"i", "Ã"=>"i", "î"=>"i", + "ï"=>"i", "ð"=>"d", "ñ"=>"n", "ò"=>"o", "ó"=>"o", "ô"=>"o", "õ"=>"o", + "ö"=>"o", "ø"=>"o", "ù"=>"u", "ú"=>"u", "û"=>"u", "ü"=>"u", "ý"=>"y", + "þ"=>"th", "ÿ"=>"y", "Ä"=>"A", "Ä"=>"a", "Ä"=>"A", "Ä"=>"a", "Ä"=>"A", + "Ä "=>"a", "Ä"=>"C", "Ä"=>"c", "Ä"=>"C", "Ä"=>"c", "Ä"=>"C", "Ä"=>"c", + "Ä"=>"C", "Ä"=>"c", "Ä"=>"D", "Ä"=>"d", "Ä"=>"D", "Ä"=>"d", "Ä"=>"E", + "Ä"=>"e", "Ä"=>"E", "Ä"=>"e", "Ä"=>"E", "Ä"=>"e", "Ä"=>"E", "Ä"=>"e", + "Ä"=>"E", "Ä"=>"e", "Ä"=>"G", "Ä"=>"g", "Ä"=>"G", "Ä"=>"g", "Ä "=>"G", + "Ä¡"=>"g", "Ä¢"=>"G", "Ä£"=>"g", "Ĥ"=>"H", "Ä¥"=>"h", "Ħ"=>"H", "ħ"=>"h", + "Ĩ"=>"I", "Ä©"=>"i", "Ī"=>"I", "Ä«"=>"i", "Ĭ"=>"I", "Ä"=>"i", "Ä®"=>"I", + "į"=>"i", "İ"=>"I", "ı"=>"i", "IJ"=>"IJ", "ij"=>"ij", "Ä´"=>"J", "ĵ"=>"j", + "Ķ"=>"K", "Ä·"=>"k", "ĸ"=>"k", "Ĺ"=>"L", "ĺ"=>"l", "Ä»"=>"L", "ļ"=>"l", + "Ľ"=>"L", "ľ"=>"l", "Ä¿"=>"L", "Å"=>"l", "Å"=>"L", "Å"=>"l", "Å"=>"N", + "Å"=>"n", "Å "=>"N", "Å"=>"n", "Å"=>"N", "Å"=>"n", "Å"=>"'n", "Å"=>"NG", + "Å"=>"ng", "Å"=>"O", "Å"=>"o", "Å"=>"O", "Å"=>"o", "Å"=>"O", "Å"=>"o", + "Å"=>"OE", "Å"=>"oe", "Å"=>"R", "Å"=>"r", "Å"=>"R", "Å"=>"r", "Å"=>"R", + "Å"=>"r", "Å"=>"S", "Å"=>"s", "Å"=>"S", "Å"=>"s", "Å"=>"S", "Å"=>"s", + "Å "=>"S", "Å¡"=>"s", "Å¢"=>"T", "Å£"=>"t", "Ť"=>"T", "Å¥"=>"t", "Ŧ"=>"T", + "ŧ"=>"t", "Ũ"=>"U", "Å©"=>"u", "Ū"=>"U", "Å«"=>"u", "Ŭ"=>"U", "Å"=>"u", + "Å®"=>"U", "ů"=>"u", "Ű"=>"U", "ű"=>"u", "Ų"=>"U", "ų"=>"u", "Å´"=>"W", + "ŵ"=>"w", "Ŷ"=>"Y", "Å·"=>"y", "Ÿ"=>"Y", "Ź"=>"Z", "ź"=>"z", "Å»"=>"Z", + "ż"=>"z", "Ž"=>"Z", "ž"=>"z" }.freeze def initialize(rule = nil) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/exceptions.rb new/lib/i18n/exceptions.rb --- old/lib/i18n/exceptions.rb 2022-07-13 22:48:41.000000000 +0200 +++ new/lib/i18n/exceptions.rb 2023-06-04 22:27:49.000000000 +0200 @@ -47,7 +47,7 @@ class MissingTranslation < ArgumentError module Base - PERMITTED_KEYS = [:scope].freeze + PERMITTED_KEYS = [:scope, :default].freeze attr_reader :locale, :key, :options @@ -63,8 +63,18 @@ end def message - "translation missing: #{keys.join('.')}" + if (default = options[:default]).is_a?(Array) && default.any? + other_options = ([key, *default]).map { |k| normalized_option(k).prepend('- ') }.join("\n") + "Translation missing. Options considered were:\n#{other_options}" + else + "Translation missing: #{keys.join('.')}" + end + end + + def normalized_option(key) + I18n.normalize_keys(locale, key, options[:scope]).join('.') end + alias :to_s :message def to_exception diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/interpolate/ruby.rb new/lib/i18n/interpolate/ruby.rb --- old/lib/i18n/interpolate/ruby.rb 2022-07-13 22:48:41.000000000 +0200 +++ new/lib/i18n/interpolate/ruby.rb 2023-06-04 22:27:49.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # heavily based on Masao Mutoh's gettext String interpolation extension # http://github.com/mutoh/gettext/blob/f6566738b981fe0952548c421042ad1e0cdfb31e/lib/gettext/core_ext/string.rb @@ -10,6 +12,11 @@ INTERPOLATION_PATTERN = Regexp.union(DEFAULT_INTERPOLATION_PATTERNS) deprecate_constant :INTERPOLATION_PATTERN + INTERPOLATION_PATTERNS_CACHE = Hash.new do |hash, patterns| + hash[patterns] = Regexp.union(patterns) + end + private_constant :INTERPOLATION_PATTERNS_CACHE + class << self # Return String or raises MissingInterpolationArgument exception. # Missing argument's logic is handled by I18n.config.missing_interpolation_argument_handler. @@ -20,7 +27,12 @@ end def interpolate_hash(string, values) - string.gsub(Regexp.union(config.interpolation_patterns)) do |match| + pattern = INTERPOLATION_PATTERNS_CACHE[config.interpolation_patterns] + interpolated = false + + interpolated_string = string.gsub(pattern) do |match| + interpolated = true + if match == '%%' '%' else @@ -34,6 +46,8 @@ $3 ? sprintf("%#{$3}", value) : value end end + + interpolated ? interpolated_string : string end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/tests/localization/date.rb new/lib/i18n/tests/localization/date.rb --- old/lib/i18n/tests/localization/date.rb 2022-07-13 22:48:41.000000000 +0200 +++ new/lib/i18n/tests/localization/date.rb 2023-06-04 22:27:49.000000000 +0200 @@ -34,6 +34,11 @@ assert_equal 'Sa', I18n.l(@date, :format => '%a', :locale => :de) end + test "localize Date: given an meridian indicator format it returns the correct meridian indicator" do + assert_equal 'AM', I18n.l(@date, :format => '%p', :locale => :de) + assert_equal 'am', I18n.l(@date, :format => '%P', :locale => :de) + end + test "localize Date: given an abbreviated and uppercased day name format it returns the correct abbreviated day name in upcase" do assert_equal 'sa'.upcase, I18n.l(@date, :format => '%^a', :locale => :de) end @@ -59,7 +64,7 @@ end test "localize Date: given missing translations it returns the correct error message" do - assert_equal 'translation missing: fr.date.abbr_month_names', I18n.l(@date, :format => '%b', :locale => :fr) + assert_equal 'Translation missing: fr.date.abbr_month_names', I18n.l(@date, :format => '%b', :locale => :fr) end test "localize Date: given an unknown format it does not fail" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/tests/localization/date_time.rb new/lib/i18n/tests/localization/date_time.rb --- old/lib/i18n/tests/localization/date_time.rb 2022-07-13 22:48:41.000000000 +0200 +++ new/lib/i18n/tests/localization/date_time.rb 2023-06-04 22:27:49.000000000 +0200 @@ -60,7 +60,7 @@ end test "localize DateTime: given missing translations it returns the correct error message" do - assert_equal 'translation missing: fr.date.abbr_month_names', I18n.l(@datetime, :format => '%b', :locale => :fr) + assert_equal 'Translation missing: fr.date.abbr_month_names', I18n.l(@datetime, :format => '%b', :locale => :fr) end test "localize DateTime: given a meridian indicator format it returns the correct meridian indicator" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/tests/localization/time.rb new/lib/i18n/tests/localization/time.rb --- old/lib/i18n/tests/localization/time.rb 2022-07-13 22:48:41.000000000 +0200 +++ new/lib/i18n/tests/localization/time.rb 2023-06-04 22:27:49.000000000 +0200 @@ -61,7 +61,7 @@ end test "localize Time: given missing translations it returns the correct error message" do - assert_equal 'translation missing: fr.date.abbr_month_names', I18n.l(@time, :format => '%b', :locale => :fr) + assert_equal 'Translation missing: fr.date.abbr_month_names', I18n.l(@time, :format => '%b', :locale => :fr) end test "localize Time: given a meridian indicator format it returns the correct meridian indicator" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/tests/lookup.rb new/lib/i18n/tests/lookup.rb --- old/lib/i18n/tests/lookup.rb 2022-07-13 22:48:41.000000000 +0200 +++ new/lib/i18n/tests/lookup.rb 2023-06-04 22:27:49.000000000 +0200 @@ -30,7 +30,7 @@ end test "lookup: given a missing key, no default and no raise option it returns an error message" do - assert_equal "translation missing: en.missing", I18n.t(:missing) + assert_equal "Translation missing: en.missing", I18n.t(:missing) end test "lookup: given a missing key, no default and the raise option it raises MissingTranslationData" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/version.rb new/lib/i18n/version.rb --- old/lib/i18n/version.rb 2022-07-13 22:48:41.000000000 +0200 +++ new/lib/i18n/version.rb 2023-06-04 22:27:49.000000000 +0200 @@ -1,5 +1,5 @@ # frozen_string_literal: true module I18n - VERSION = "1.12.0" + VERSION = "1.14.1" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2022-07-13 22:48:41.000000000 +0200 +++ new/metadata 2023-06-04 22:27:49.000000000 +0200 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: i18n version: !ruby/object:Gem::Version - version: 1.12.0 + version: 1.14.1 platform: ruby authors: - Sven Fuchs @@ -13,7 +13,7 @@ autorequire: bindir: bin cert_chain: [] -date: 2022-07-13 00:00:00.000000000 Z +date: 2023-06-04 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: concurrent-ruby
