Skip to content

Commit

Permalink
Only match I18n or nil receivers in PatternScanner
Browse files Browse the repository at this point in the history
Fixes a bug discovered by @rposborne and reported in
the chat room (https://gitter.im/glebm/i18n-tasks)
  • Loading branch information
glebm committed Oct 28, 2015
1 parent d6b706f commit f15d762
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/i18n/tasks/scanners/pattern_scanner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def closest_method(occurrence)
end

def translate_call_re
/(?<=^|[^\w'\-])t(?:ranslate)?/
/(?<=^|[^\w'\-.]|[^\w'\-]I18n\.|I18n\.)t(?:ranslate)?/
end

# Match literals:
Expand Down
2 changes: 2 additions & 0 deletions spec/fixtures/app/views/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ p #{t :"missing_symbol.key_two"} #{t :'missing_symbol.key_three'}
= t 'present_in_es_but_not_en.a'
= t 'latin_extra.çüéö'
= page_title

p = Spree.t 'not_a_key'

0 comments on commit f15d762

Please sign in to comment.