Skip to content

Commit

Permalink
PatternScanner: Handles non \w characters
Browse files Browse the repository at this point in the history
- Fixes #526
  • Loading branch information
davidwessman authored and glebm committed Oct 23, 2023
1 parent 5d8775b commit e939d0e
Show file tree
Hide file tree
Showing 2 changed files with 4 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 @@ -12,7 +12,7 @@ class PatternScanner < FileScanner
include OccurrenceFromPosition
include RubyKeyLiterals

TRANSLATE_CALL_RE = /(?<=^|[^\w'\-.]|[^\w'-]I18n\.|I18n\.)t(?:!|ranslate!?)?/.freeze
TRANSLATE_CALL_RE = /(?<=^|[^\p{L}'\-.]|[^\p{L}'-]I18n\.|I18n\.)t(?:!|ranslate!?)?/.freeze
IGNORE_LINES = {
'coffee' => /^\s*#(?!\si18n-tasks-use)/,
'erb' => /^\s*<%\s*#(?!\si18n-tasks-use)/,
Expand Down
3 changes: 3 additions & 0 deletions spec/used_keys_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
h1 = t 'b'
h2 = t 'c.layer'
h3 = t 'c.layer.underneath_c'
// Do not match non \w characters before the t
// https://github.com/glebm/i18n-tasks/issues/526
| À bientôt !
SLIM
end

Expand Down

0 comments on commit e939d0e

Please sign in to comment.