Sha256: 1f1d16a4214395a779b0a06e51a7a61fb8a6f5388274a2239e00dddcbee1b5d4

Contents?: true

Size: 794 Bytes

Versions: 41

Compression:

Stored size: 794 Bytes

Contents

# frozen_string_literal: true

require 'set'

module I18n
  module Tasks
    module UnusedKeys
      def unused_keys(locales: nil, strict: nil)
        locales = Array(locales).presence || self.locales
        locales.map { |locale| unused_tree(locale: locale, strict: strict) }.compact.reduce(:merge!)
      end

      # @param [String] locale
      # @param [Boolean] strict if true, do not match dynamic keys
      def unused_tree(locale: base_locale, strict: nil)
        used_key_names = used_tree(strict: true).key_names
        collapse_plural_nodes!(data[locale].select_keys do |key, _node|
          !ignore_key?(key, :unused) &&
            (strict || !used_in_expr?(key)) &&
            !used_key_names.include?(depluralize_key(key, locale))
        end)
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 3 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/i18n-tasks-1.0.14/lib/i18n/tasks/unused_keys.rb
i18n-tasks-1.0.13 lib/i18n/tasks/unused_keys.rb
i18n-tasks-1.0.12 lib/i18n/tasks/unused_keys.rb
i18n-tasks-1.0.11 lib/i18n/tasks/unused_keys.rb
i18n-tasks-1.0.10 lib/i18n/tasks/unused_keys.rb
i18n-tasks-1.0.9 lib/i18n/tasks/unused_keys.rb
i18n-tasks-1.0.8 lib/i18n/tasks/unused_keys.rb
i18n-tasks-1.0.7 lib/i18n/tasks/unused_keys.rb
i18n-tasks-1.0.6 lib/i18n/tasks/unused_keys.rb
i18n-tasks-1.0.5 lib/i18n/tasks/unused_keys.rb
i18n-tasks-1.0.4 lib/i18n/tasks/unused_keys.rb
i18n-tasks-1.0.3 lib/i18n/tasks/unused_keys.rb
i18n-tasks-1.0.2 lib/i18n/tasks/unused_keys.rb
i18n-tasks-1.0.1 lib/i18n/tasks/unused_keys.rb
i18n-tasks-1.0.0 lib/i18n/tasks/unused_keys.rb
i18n-youdao-tasks-0.9.37 lib/i18n/tasks/unused_keys.rb
i18n-tasks-0.9.37 lib/i18n/tasks/unused_keys.rb
i18n-tasks-0.9.36 lib/i18n/tasks/unused_keys.rb
i18n-tasks-0.9.35 lib/i18n/tasks/unused_keys.rb
i18n-tasks-0.9.34 lib/i18n/tasks/unused_keys.rb