Sha256: c3c67b0e47f2bdbc65e01a07285abe1950b96e927a3aa8a1766e5b0f088010ba
Contents?: true
Size: 719 Bytes
Versions: 32
Compression:
Stored size: 719 Bytes
Contents
# lib/my_custom_scanner.rb require 'i18n/tasks/scanners/file_scanner' class Card module Set class I18nScanner < ::I18n::Tasks::Scanners::FileScanner include ::I18n::Tasks::Scanners::RelativeKeys include ::I18n::Tasks::Scanners::OccurrenceFromPosition # @return [Array<[absolute key, Results::Occurrence]>] def scan_file(path) text = read_file(path) text.scan(/[^\w._-]tr[( ]\s*["':](\w+)/).map do |_match| occurrence = occurrence_from_position( path, text, Regexp.last_match.offset(0).first) [absolute_key(".#{_match[0]}", path), occurrence] end end end ::I18n::Tasks.add_scanner 'Card::Set::I18nScanner' end end
Version data entries
32 entries across 32 versions & 1 rubygems