From dd8713ccdc50bf841d1c0f8496314bc8298c07fe Mon Sep 17 00:00:00 2001 From: Bilka Date: Sun, 10 Dec 2023 14:03:00 +0100 Subject: [PATCH] Use ast_matchers for default_i18n_subject in config template --- .../scanners/ast_matchers/default_i18n_subject_matcher.rb | 1 + lib/i18n/tasks/scanners/ruby_ast_scanner.rb | 1 + templates/config/i18n-tasks.yml | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/i18n/tasks/scanners/ast_matchers/default_i18n_subject_matcher.rb b/lib/i18n/tasks/scanners/ast_matchers/default_i18n_subject_matcher.rb index a198a0e3..923fc24a 100644 --- a/lib/i18n/tasks/scanners/ast_matchers/default_i18n_subject_matcher.rb +++ b/lib/i18n/tasks/scanners/ast_matchers/default_i18n_subject_matcher.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require 'i18n/tasks/scanners/ast_matchers/base_matcher' require 'i18n/tasks/scanners/results/occurrence' module I18n::Tasks::Scanners::AstMatchers diff --git a/lib/i18n/tasks/scanners/ruby_ast_scanner.rb b/lib/i18n/tasks/scanners/ruby_ast_scanner.rb index a69d5319..734cce99 100644 --- a/lib/i18n/tasks/scanners/ruby_ast_scanner.rb +++ b/lib/i18n/tasks/scanners/ruby_ast_scanner.rb @@ -3,6 +3,7 @@ require 'i18n/tasks/scanners/file_scanner' require 'i18n/tasks/scanners/relative_keys' require 'i18n/tasks/scanners/ruby_ast_call_finder' +require 'i18n/tasks/scanners/ast_matchers/default_i18n_subject_matcher' require 'i18n/tasks/scanners/ast_matchers/message_receivers_matcher' require 'i18n/tasks/scanners/ast_matchers/rails_model_matcher' require 'parser/current' diff --git a/templates/config/i18n-tasks.yml b/templates/config/i18n-tasks.yml index 971f019e..10213ad7 100644 --- a/templates/config/i18n-tasks.yml +++ b/templates/config/i18n-tasks.yml @@ -96,8 +96,9 @@ search: ## Matches ActionMailer's default_i18n_subject method ## ## To implement your own, please see `I18n::Tasks::Scanners::AstMatchers::BaseMatcher`. - # <%# I18n::Tasks.add_ast_matcher('I18n::Tasks::Scanners::AstMatchers::RailsModelMatcher') %> - # <%# I18n::Tasks.add_ast_matcher('I18n::Tasks::Scanners::AstMatchers::DefaultI18nSubjectMatcher') %> + # ast_matchers: + # - 'I18n::Tasks::Scanners::AstMatchers::RailsModelMatcher' + # - 'I18n::Tasks::Scanners::AstMatchers::DefaultI18nSubjectMatcher' ## Multiple scanners can be used. Their results are merged. ## The options specified above are passed down to each scanner. Per-scanner options can be specified as well.