Sha256: 17d821d30f65893820940192726f7415f1c1d63f225398357baf192f0b756c81
Contents?: true
Size: 790 Bytes
Versions: 2
Compression:
Stored size: 790 Bytes
Contents
# coding: utf-8 require 'i18n/tasks/base_task' module I18n module Tasks class Unused < BaseTask DESC = 'Unused i18n keys' def perform unused = find_unused STDERR.puts bold cyan("= #{DESC} (#{unused.length}) =") unused.each do |(key, value)| puts " #{magenta(key).ljust(60)}\t#{cyan value}" end end def find_unused used_keys = find_source_keys.to_set r = [] ignore_re = ignore_pattern(:unused) pattern_re = compile_start_with_re find_source_pattern_prefixes traverse base[base_locale] do |key, value| unless used_keys.include?(key) || key =~ pattern_re || key =~ ignore_re r << [key, value] end end r end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
i18n-tasks-0.1.1 | lib/i18n/tasks/unused.rb |
i18n-tasks-0.1.0 | lib/i18n/tasks/unused.rb |