lib/i18n/tasks/scanners/pattern_scanner.rb in i18n-tasks-0.5.1 vs lib/i18n/tasks/scanners/pattern_scanner.rb in i18n-tasks-0.5.2
- old
+ new
@@ -11,11 +11,14 @@
keys = []
text.scan(pattern) do |match|
src_pos = Regexp.last_match.offset(0).first
key = match_to_key(match, path)
next unless valid_key?(key)
- keys << [key, data: src_location(path, text, src_pos)]
+ location = src_location(path, text, src_pos)
+ unless exclude_line?(location[:line])
+ keys << [key, data: location]
+ end
end
keys
end
def default_pattern
@@ -42,10 +45,10 @@
def pattern
@pattern ||= config[:pattern].present? ? Regexp.new(config[:pattern]) : default_pattern
end
def translate_call_re
- /\bt(?:ranslate)?/
+ /(?<=^|[^\w'\-])t(?:ranslate)?/
end
# Match literals:
# * String: '', "#{}"
# * Symbol: :sym, :'', :"#{}"