Sha256: 8120cb256ae0a94f38bba536d96fd04efe082bfae98331704124ec9b3b2a0830
Contents?: true
Size: 810 Bytes
Versions: 7
Compression:
Stored size: 810 Bytes
Contents
# coding: utf-8 require 'set' module I18n module Tasks module UnusedKeys # @return [Array<[String, String]>] all the unused translations as an array of [key, value] pairs def unused_keys(locale = base_locale) traverse_map_if data[locale] do |key, value| next if pattern_key?(key) || ignore_key?(key, :unused) key = depluralize_key(locale, key) [key, value] unless used_key?(key) end.uniq end def remove_unused!(locales = self.locales) exclude = unused_keys.map(&:first).to_set locales.each do |locale| data[locale] = list_to_tree traverse_map_if(data[locale]) { |key, value| [key, value] unless exclude.include?(depluralize_key(locale, key)) } end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems