Hello community, here is the log from the commit of package rubygem-i18n for openSUSE:Factory checked in at 2018-04-19 15:33:05 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-i18n (Old) and /work/SRC/openSUSE:Factory/.rubygem-i18n.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "rubygem-i18n" Thu Apr 19 15:33:05 2018 rev:19 rq:598291 version:1.0.1 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-i18n/rubygem-i18n.changes 2018-03-06 10:45:26.688279237 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-i18n.new/rubygem-i18n.changes 2018-04-19 15:33:06.346137111 +0200 @@ -1,0 +2,6 @@ +Wed Apr 18 05:05:10 UTC 2018 - factory-auto@kulow.org + +- updated to version 1.0.1 + no changelog found + +------------------------------------------------------------------- Old: ---- i18n-1.0.0.gem New: ---- i18n-1.0.1.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-i18n.spec ++++++ --- /var/tmp/diff_new_pack.Hv0riy/_old 2018-04-19 15:33:07.006109898 +0200 +++ /var/tmp/diff_new_pack.Hv0riy/_new 2018-04-19 15:33:07.010109733 +0200 @@ -24,7 +24,7 @@ # Name: rubygem-i18n -Version: 1.0.0 +Version: 1.0.1 Release: 0 %define mod_name i18n %define mod_full_name %{mod_name}-%{version} ++++++ i18n-1.0.0.gem -> i18n-1.0.1.gem ++++++ 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 2018-02-14 02:29:03.000000000 +0100 +++ new/lib/i18n/backend/base.rb 2018-04-18 06:56:28.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'yaml' require 'i18n/core_ext/hash' require 'i18n/core_ext/kernel/suppress_warnings' @@ -17,11 +19,11 @@ # This method receives a locale, a data hash and options for storing translations. # Should be implemented - def store_translations(locale, data, options = {}) + def store_translations(locale, data, options = EMPTY_HASH) raise NotImplementedError end - def translate(locale, key, options = {}) + def translate(locale, key, options = EMPTY_HASH) raise I18n::ArgumentError if (key.is_a?(String) || key.is_a?(Symbol)) && key.empty? raise InvalidLocale.new(locale) unless locale return nil if key.nil? && !options.key?(:default) @@ -68,7 +70,7 @@ # Acts the same as +strftime+, but uses a localized version of the # format string. Takes a key from the date/time formats translations as # a format argument (<em>e.g.</em>, <tt>:short</tt> in <tt>:'date.formats'</tt>). - def localize(locale, object, format = :default, options = {}) + def localize(locale, object, format = :default, options = EMPTY_HASH) if object.nil? && options.include?(:default) return options[:default] end @@ -97,7 +99,7 @@ protected # The method which actually looks up for the translation in the store. - def lookup(locale, key, scope = [], options = {}) + def lookup(locale, key, scope = [], options = EMPTY_HASH) raise NotImplementedError end @@ -109,7 +111,7 @@ # If given subject is an Array, it walks the array and returns the # first translation that can be resolved. Otherwise it tries to resolve # the translation directly. - def default(locale, object, subject, options = {}) + def default(locale, object, subject, options = EMPTY_HASH) options = options.dup.reject { |key, value| key == :default } case subject when Array @@ -126,7 +128,7 @@ # If the given subject is a Symbol, it will be translated with the # given options. If it is a Proc then it will be evaluated. All other # subjects will be returned directly. - def resolve(locale, object, subject, options = {}) + def resolve(locale, object, subject, options = EMPTY_HASH) return subject if options[:resolve] == false result = catch(:exception) do case subject @@ -168,7 +170,7 @@ # each element of the array is recursively interpolated (until it finds a string) # method interpolates ["yes, %{user}", ["maybe no, %{user}, "no, %{user}"]], :user => "bartuz" # # => "["yes, bartuz",["maybe no, bartuz", "no, bartuz"]]" - def interpolate(locale, subject, values = {}) + def interpolate(locale, subject, values = EMPTY_HASH) return subject if values.empty? case subject @@ -184,7 +186,7 @@ # deep_interpolate { people: { ann: "Ann is %{ann}", john: "John is %{john}" } }, # ann: 'good', john: 'big' # #=> { people: { ann: "Ann is good", john: "John is big" } } - def deep_interpolate(locale, data, values = {}) + def deep_interpolate(locale, data, values = EMPTY_HASH) return data if values.empty? case data diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/backend/cache.rb new/lib/i18n/backend/cache.rb --- old/lib/i18n/backend/cache.rb 2018-02-14 02:29:03.000000000 +0100 +++ new/lib/i18n/backend/cache.rb 2018-04-18 06:56:28.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This module allows you to easily cache all responses from the backend - thus # speeding up the I18n aspects of your application quite a bit. # @@ -14,9 +16,9 @@ # ActiveSupport::Cache (only the methods #fetch and #write are being used). # # The cache_key implementation by default assumes you pass values that return -# a valid key from #hash (see -# http://www.ruby-doc.org/core/classes/Object.html#M000337). However, you can -# configure your own digest method via which responds to #hexdigest (see +# a valid key from #hash (see +# http://www.ruby-doc.org/core/classes/Object.html#M000337). However, you can +# configure your own digest method via which responds to #hexdigest (see # http://ruby-doc.org/stdlib/libdoc/digest/rdoc/index.html): # # I18n.cache_key_digest = Digest::MD5.new @@ -75,7 +77,7 @@ module Backend # TODO Should the cache be cleared if new translations are stored? module Cache - def translate(locale, key, options = {}) + def translate(locale, key, options = EMPTY_HASH) I18n.perform_caching? ? fetch(cache_key(locale, key, options)) { super } : super end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/backend/cascade.rb new/lib/i18n/backend/cascade.rb --- old/lib/i18n/backend/cascade.rb 2018-02-14 02:29:03.000000000 +0100 +++ new/lib/i18n/backend/cascade.rb 2018-04-18 06:56:28.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # The Cascade module adds the ability to do cascading lookups to backends that # are compatible to the Simple backend. # @@ -31,7 +33,7 @@ module I18n module Backend module Cascade - def lookup(locale, key, scope = [], options = {}) + def lookup(locale, key, scope = [], options = EMPTY_HASH) return super unless cascade = options[:cascade] cascade = { :step => 1 } unless cascade.is_a?(Hash) 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 2018-02-14 02:29:03.000000000 +0100 +++ new/lib/i18n/backend/chain.rb 2018-04-18 06:56:28.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module I18n module Backend # Backend that chains multiple other backends and checks each of them when @@ -28,7 +30,7 @@ backends.each { |backend| backend.reload! } end - def store_translations(locale, data, options = {}) + def store_translations(locale, data, options = EMPTY_HASH) backends.first.store_translations(locale, data, options) end @@ -36,7 +38,7 @@ backends.map { |backend| backend.available_locales }.flatten.uniq end - def translate(locale, key, default_options = {}) + def translate(locale, key, default_options = EMPTY_HASH) namespace = nil options = default_options.except(:default) @@ -62,7 +64,7 @@ end end - def localize(locale, object, format = :default, options = {}) + def localize(locale, object, format = :default, options = EMPTY_HASH) backends.each do |backend| catch(:exception) do result = backend.localize(locale, object, format, options) and return result diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/backend/fallbacks.rb new/lib/i18n/backend/fallbacks.rb --- old/lib/i18n/backend/fallbacks.rb 2018-02-14 02:29:03.000000000 +0100 +++ new/lib/i18n/backend/fallbacks.rb 2018-04-18 06:56:28.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # I18n locale fallbacks are useful when you want your application to use # translations from other locales when translations for the current locale are # missing. E.g. you might want to use :en translations when translations in @@ -34,25 +36,21 @@ # The default option takes precedence over fallback locales only when # it's a Symbol. When the default contains a String, Proc or Hash # it is evaluated last after all the fallback locales have been tried. - def translate(locale, key, options = {}) + def translate(locale, key, options = EMPTY_HASH) return super unless options.fetch(:fallback, true) return super if options[:fallback_in_progress] default = extract_non_symbol_default!(options) if options[:default] - begin - options[:fallback_in_progress] = true - I18n.fallbacks[locale].each do |fallback| - begin - catch(:exception) do - result = super(fallback, key, options) - return result unless result.nil? - end - rescue I18n::InvalidLocale - # we do nothing when the locale is invalid, as this is a fallback anyways. + fallback_options = options.merge(:fallback_in_progress => true) + I18n.fallbacks[locale].each do |fallback| + begin + catch(:exception) do + result = super(fallback, key, fallback_options) + return result unless result.nil? end + rescue I18n::InvalidLocale + # we do nothing when the locale is invalid, as this is a fallback anyways. end - ensure - options.delete(:fallback_in_progress) end return if options.key?(:default) && options[:default].nil? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/backend/flatten.rb new/lib/i18n/backend/flatten.rb --- old/lib/i18n/backend/flatten.rb 2018-02-14 02:29:03.000000000 +0100 +++ new/lib/i18n/backend/flatten.rb 2018-04-18 06:56:28.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module I18n module Backend # This module contains several helpers to assist flattening translations. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/backend/gettext.rb new/lib/i18n/backend/gettext.rb --- old/lib/i18n/backend/gettext.rb 2018-02-14 02:29:03.000000000 +0100 +++ new/lib/i18n/backend/gettext.rb 2018-04-18 06:56:28.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'i18n/gettext' require 'i18n/gettext/po_parser' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/backend/interpolation_compiler.rb new/lib/i18n/backend/interpolation_compiler.rb --- old/lib/i18n/backend/interpolation_compiler.rb 2018-02-14 02:29:03.000000000 +0100 +++ new/lib/i18n/backend/interpolation_compiler.rb 2018-04-18 06:56:28.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # The InterpolationCompiler module contains optimizations that can tremendously # speed up the interpolation process on the Simple backend. # @@ -104,7 +106,7 @@ end end - def store_translations(locale, data, options = {}) + def store_translations(locale, data, options = EMPTY_HASH) compile_all_strings_in(data) super end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/backend/key_value.rb new/lib/i18n/backend/key_value.rb --- old/lib/i18n/backend/key_value.rb 2018-02-14 02:29:03.000000000 +0100 +++ new/lib/i18n/backend/key_value.rb 2018-04-18 06:56:28.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'i18n/backend/base' module I18n @@ -74,7 +76,7 @@ @store, @subtrees = store, subtrees end - def store_translations(locale, data, options = {}) + def store_translations(locale, data, options = EMPTY_HASH) escape = options.fetch(:escape, true) flatten_translations(locale, data, escape, @subtrees).each do |key, value| key = "#{locale}.#{key}" @@ -107,7 +109,7 @@ @subtrees end - def lookup(locale, key, scope = [], options = {}) + def lookup(locale, key, scope = [], options = EMPTY_HASH) key = normalize_flat_keys(locale, key, scope, options[:separator]) value = @store["#{locale}.#{key}"] value = JSON.decode(value) if value diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/backend/memoize.rb new/lib/i18n/backend/memoize.rb --- old/lib/i18n/backend/memoize.rb 2018-02-14 02:29:03.000000000 +0100 +++ new/lib/i18n/backend/memoize.rb 2018-04-18 06:56:28.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Memoize module simply memoizes the values returned by lookup using # a flat hash and can tremendously speed up the lookup process in a backend. # @@ -14,7 +16,7 @@ @memoized_locales ||= super end - def store_translations(locale, data, options = {}) + def store_translations(locale, data, options = EMPTY_HASH) reset_memoizations!(locale) super end @@ -26,7 +28,7 @@ protected - def lookup(locale, key, scope = nil, options = {}) + def lookup(locale, key, scope = nil, options = EMPTY_HASH) flat_key = I18n::Backend::Flatten.normalize_flat_keys(locale, key, scope, options[:separator]).to_sym flat_hash = memoized_lookup[locale.to_sym] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/backend/metadata.rb new/lib/i18n/backend/metadata.rb --- old/lib/i18n/backend/metadata.rb 2018-02-14 02:29:03.000000000 +0100 +++ new/lib/i18n/backend/metadata.rb 2018-04-18 06:56:28.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # I18n translation metadata is useful when you want to access information # about how a translation was looked up, pluralized or interpolated in # your application. @@ -35,19 +37,19 @@ end end - def translate(locale, key, options = {}) + def translate(locale, key, options = EMPTY_HASH) metadata = { :locale => locale, :key => key, :scope => options[:scope], :default => options[:default], :separator => options[:separator], - :values => options.reject { |name, value| RESERVED_KEYS.include?(name) } + :values => options.reject { |name, _value| RESERVED_KEYS.include?(name) } } with_metadata(metadata) { super } end - def interpolate(locale, entry, values = {}) + def interpolate(locale, entry, values = EMPTY_HASH) metadata = entry.translation_metadata.merge(:original => entry) with_metadata(metadata) { 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 2018-02-14 02:29:03.000000000 +0100 +++ new/lib/i18n/backend/pluralization.rb 2018-04-18 06:56:28.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # I18n Pluralization are useful when you want your application to # customize pluralization rules. # 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 2018-02-14 02:29:03.000000000 +0100 +++ new/lib/i18n/backend/simple.rb 2018-04-18 06:56:28.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module I18n module Backend # A simple backend that reads translations from YAML files and stores them in @@ -28,7 +30,7 @@ # This uses a deep merge for the translations hash, so existing # translations will be overwritten by new ones only at the deepest # level of the hash. - def store_translations(locale, data, options = {}) + def store_translations(locale, data, options = EMPTY_HASH) if I18n.enforce_available_locales && I18n.available_locales_initialized? && !I18n.available_locales.include?(locale.to_sym) && @@ -73,7 +75,7 @@ # nested translations hash. Splits keys or scopes containing dots # into multiple keys, i.e. <tt>currency.format</tt> is regarded the same as # <tt>%w(currency format)</tt>. - def lookup(locale, key, scope = [], options = {}) + def lookup(locale, key, scope = [], options = EMPTY_HASH) init_translations unless initialized? keys = I18n.normalize_keys(locale, key, scope, options[:separator]) 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 2018-02-14 02:29:03.000000000 +0100 +++ new/lib/i18n/backend/transliterator.rb 2018-04-18 06:56:28.000000000 +0200 @@ -1,4 +1,6 @@ # encoding: utf-8 +# frozen_string_literal: true + module I18n module Backend module Transliterator diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/backend.rb new/lib/i18n/backend.rb --- old/lib/i18n/backend.rb 2018-02-14 02:29:03.000000000 +0100 +++ new/lib/i18n/backend.rb 2018-04-18 06:56:28.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module I18n module Backend autoload :Base, 'i18n/backend/base' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/config.rb new/lib/i18n/config.rb --- old/lib/i18n/config.rb 2018-02-14 02:29:03.000000000 +0100 +++ new/lib/i18n/config.rb 2018-04-18 06:56:28.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'set' module I18n @@ -57,7 +59,7 @@ @@available_locales = nil if @@available_locales.empty? @@available_locales_set = nil end - + # Returns true if the available_locales have been initialized def available_locales_initialized? ( !!defined?(@@available_locales) && !!@@available_locales ) 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 2018-02-14 02:29:03.000000000 +0100 +++ new/lib/i18n/exceptions.rb 2018-04-18 06:56:28.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'cgi' module I18n @@ -42,7 +44,7 @@ module Base attr_reader :locale, :key, :options - def initialize(locale, key, options = {}) + def initialize(locale, key, options = EMPTY_HASH) @key, @locale, @options = key, locale, options.dup options.each { |k, v| self.options[k] = v.inspect if v.is_a?(Proc) } end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/gettext/helpers.rb new/lib/i18n/gettext/helpers.rb --- old/lib/i18n/gettext/helpers.rb 2018-02-14 02:29:03.000000000 +0100 +++ new/lib/i18n/gettext/helpers.rb 2018-04-18 06:56:28.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'i18n/gettext' module I18n @@ -16,7 +18,7 @@ msgsid end - def gettext(msgid, options = {}) + def gettext(msgid, options = EMPTY_HASH) I18n.t(msgid, { :default => msgid, :separator => '|' }.merge(options)) end alias _ gettext diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/gettext/po_parser.rb new/lib/i18n/gettext/po_parser.rb --- old/lib/i18n/gettext/po_parser.rb 2018-02-14 02:29:03.000000000 +0100 +++ new/lib/i18n/gettext/po_parser.rb 2018-04-18 06:56:28.000000000 +0200 @@ -28,7 +28,7 @@ ret.gsub!(/\\"/, "\"") ret end - + def parse(str, data, ignore_fuzzy = true) @comments = [] @data = data @@ -64,7 +64,7 @@ str = $' when /\A\#(.*)/ @q.push [:COMMENT, $&] - str = $' + str = $' when /\A\"(.*)\"/ @q.push [:STRING, $1] str = $' @@ -73,7 +73,7 @@ #@q.push [:STRING, c] str = str[1..-1] end - end + end @q.push [false, '$end'] if $DEBUG @q.each do |a,b| @@ -88,7 +88,7 @@ end @data end - + def next_token @q.shift end @@ -101,11 +101,11 @@ @comments.clear @msgctxt = "" end - + def on_comment(comment) @fuzzy = true if (/fuzzy/ =~ comment) @comments << comment - end + end ..end src/poparser.ry modeval..id7a99570e05 @@ -245,7 +245,7 @@ module_eval <<'.,.,', 'src/poparser.ry', 48 def _reduce_8( val, _values, result ) - if @fuzzy and $ignore_fuzzy + if @fuzzy and $ignore_fuzzy if val[1] != "" $stderr.print _("Warning: fuzzy message was ignored.\n") $stderr.print " msgid '#{val[1]}'\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/gettext.rb new/lib/i18n/gettext.rb --- old/lib/i18n/gettext.rb 2018-02-14 02:29:03.000000000 +0100 +++ new/lib/i18n/gettext.rb 2018-04-18 06:56:28.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module I18n module Gettext PLURAL_SEPARATOR = "\001" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/locale.rb new/lib/i18n/locale.rb --- old/lib/i18n/locale.rb 2018-02-14 02:29:03.000000000 +0100 +++ new/lib/i18n/locale.rb 2018-04-18 06:56:28.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module I18n module Locale autoload :Fallbacks, 'i18n/locale/fallbacks' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/middleware.rb new/lib/i18n/middleware.rb --- old/lib/i18n/middleware.rb 2018-02-14 02:29:04.000000000 +0100 +++ new/lib/i18n/middleware.rb 2018-04-18 06:56:28.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module I18n class Middleware diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/tests/interpolation.rb new/lib/i18n/tests/interpolation.rb --- old/lib/i18n/tests/interpolation.rb 2018-02-14 02:29:04.000000000 +0100 +++ new/lib/i18n/tests/interpolation.rb 2018-04-18 06:56:28.000000000 +0200 @@ -104,9 +104,10 @@ end test "interpolation: given a translations containing a reserved key it raises I18n::ReservedInterpolationKey" do - assert_raise(I18n::ReservedInterpolationKey) { interpolate(:default => '%{default}', :foo => :bar) } - assert_raise(I18n::ReservedInterpolationKey) { interpolate(:default => '%{scope}', :foo => :bar) } - assert_raise(I18n::ReservedInterpolationKey) { interpolate(:default => '%{separator}', :foo => :bar) } + assert_raise(I18n::ReservedInterpolationKey) { interpolate(:foo => :bar, :default => '%{exception_handler}') } + assert_raise(I18n::ReservedInterpolationKey) { interpolate(:foo => :bar, :default => '%{default}') } + assert_raise(I18n::ReservedInterpolationKey) { interpolate(:foo => :bar, :default => '%{separator}') } + assert_raise(I18n::ReservedInterpolationKey) { interpolate(:foo => :bar, :default => '%{scope}') } end test "interpolation: deep interpolation for default string" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n/tests.rb new/lib/i18n/tests.rb --- old/lib/i18n/tests.rb 2018-02-14 02:29:04.000000000 +0100 +++ new/lib/i18n/tests.rb 2018-04-18 06:56:28.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module I18n module Tests autoload :Basics, 'i18n/tests/basics' 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 2018-02-14 02:29:04.000000000 +0100 +++ new/lib/i18n/version.rb 2018-04-18 06:56:28.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module I18n - VERSION = "1.0.0" + VERSION = "1.0.1" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/i18n.rb new/lib/i18n.rb --- old/lib/i18n.rb 2018-02-14 02:29:03.000000000 +0100 +++ new/lib/i18n.rb 2018-04-18 06:56:28.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'concurrent/map' require 'i18n/version' @@ -12,9 +14,23 @@ autoload :Tests, 'i18n/tests' autoload :Middleware, 'i18n/middleware' - RESERVED_KEYS = [:scope, :default, :separator, :resolve, :object, :fallback, :fallback_in_progress, :format, :cascade, :throw, :raise, :deep_interpolation] + RESERVED_KEYS = %i[ + cascade + deep_interpolation + default + exception_handler + fallback + fallback_in_progress + format + object + raise + resolve + scope + separator + throw + ].freeze RESERVED_KEYS_PATTERN = /%\{(#{RESERVED_KEYS.join("|")})\}/ - + EMPTY_HASH = {}.freeze def self.new_double_nested_cache # :nodoc: Concurrent::Map.new { |h,k| h[k] = Concurrent::Map.new } @@ -175,7 +191,7 @@ # Wrapper for <tt>translate</tt> that adds <tt>:raise => true</tt>. With # this option, if no translation is found, it will raise <tt>I18n::MissingTranslationData</tt> - def translate!(key, options={}) + def translate!(key, options = EMPTY_HASH) translate(key, options.merge(:raise => true)) end alias :t! :translate! diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2018-02-14 02:29:03.000000000 +0100 +++ new/metadata 2018-04-18 06:56:28.000000000 +0200 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: i18n version: !ruby/object:Gem::Version - version: 1.0.0 + version: 1.0.1 platform: ruby authors: - Sven Fuchs @@ -13,7 +13,7 @@ autorequire: bindir: bin cert_chain: [] -date: 2018-02-14 00:00:00.000000000 Z +date: 2018-04-18 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: concurrent-ruby