Skip to content

Commit

Permalink
Ignorelist improved for vue/pug
Browse files Browse the repository at this point in the history
  • Loading branch information
zealot128 committed Jul 4, 2024
1 parent 7df68c1 commit 04b8c40
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/extract_i18n.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,18 @@ class << self
self.ignorelist = [
'_',
'::',
'v-else',
'v-else-if',
%r{^\| },
%r{^#[^ ]+$},
%r{^/}
]
self.html_fields_with_plaintext = %w[title placeholder alt label aria-label modal-title]

def self.ignore?(string)
ExtractI18n.ignorelist.any? { |item| string.to_s[item] }
end

def self.key(string, length: 25)
string.strip.
unicode_normalize(:nfkd).gsub(/(\p{Letter})\p{Mark}+/, '\\1').
Expand Down
3 changes: 3 additions & 0 deletions lib/extract_i18n/adapters/vue_pug_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ def process_line(old_line)
if change.nil? # nothing to do
return old_line
end
if ExtractI18n.ignore?(change.i18n_string)
return old_line
end

if @on_ask.call(change)
change.i18n_t
Expand Down

0 comments on commit 04b8c40

Please sign in to comment.