i18n-tasks
i18n-tasks copied to clipboard
Feature: Rails mailer subject finding used keys
trafficstars
Rails automatically grabs email the email subject from I18n files without needing to be explicitly referenced in code. However, i18n-tasks reports it as an unused translation:
Unused keys (1) | i18n-tasks v1.0.12
+--------+----------------------------------------------+----------------------------------------+
| Locale | Key | Value |
+--------+----------------------------------------------+----------------------------------------+
| en | campaign_mailer.verification_message.subject | Verification Code for %{campaign_name} |
+--------+----------------------------------------------+----------------------------------------+
We would need to write a custom scanner or matcher, something like: https://github.com/glebm/i18n-tasks/blob/main/lib/i18n/tasks/scanners/ast_matchers/rails_model_matcher.rb
and add it only for certain files, like:
I18n::Tasks.add_scanner "MailerScanner", only: %w[*_mailer.rb]