iachat/app/views/devise/mailer/confirmation_instructions.html.erb
Gabriel Jablonski 053e684261
feat(mailer): add i18n support for transactional emails with pt-BR (#255)
* feat(mailer): add i18n support for all transactional emails with pt-BR translations

- Create Liquid i18n filter (LiquidFilters::I18nFilter) exposing I18n.t() as `t` filter
  with interpolation support via positional args
- Replace hardcoded English strings in all 26 Liquid email templates with i18n keys
- Replace hardcoded English strings in all 5 Devise ERB email templates (OSS + enterprise)
  with t() calls, using raw output (<%==) to prevent HTML-encoding of apostrophes
- Translate all mailer subjects to use I18n.t() for locale-aware rendering
- Add comprehensive pt-BR translations for all transactional emails
- Add SSO-specific i18n keys for enterprise confirmation instructions
- Fix ApplicationRecord#to_drop to walk STI hierarchy (e.g. SuperAdmin -> UserDrop)

* fix: address CodeRabbit review feedback

- Use _html suffix for Devise translation keys to prevent XSS while
  keeping apostrophes unencoded (Rails escapes interpolations automatically)
- Replace hardcoded English in SLA templates with full_body i18n keys
- Fix _target="blank" typo to target="_blank" in attachment links
- Add i18n for tiktok_disconnect subject and create liquid template
- Extract brand_name to private method in AccountNotificationMailer

* fix: address round 2 review feedback

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 15:48:52 -03:00

31 lines
1.5 KiB
Plaintext

<p><%= t('mailer.common.hi', name: @resource.name) %>,</p>
<% account_user = @resource&.account_users&.first %>
<% brand_name = global_config['BRAND_NAME'] || 'Chatwoot' %>
<% if account_user&.inviter.present? && @resource.unconfirmed_email.blank? %>
<p><%= t('mailer.devise.confirmation_instructions.invited_html', inviter_name: account_user.inviter.name, account_name: account_user.account.name, brand_name: brand_name) %></p>
<% end %>
<% if @resource.confirmed? %>
<p><%= t('mailer.devise.confirmation_instructions.login_message_html', brand_name: brand_name) %></p>
<% else %>
<% if account_user&.inviter.blank? %>
<p>
<%= t('mailer.devise.confirmation_instructions.welcome_html', brand_name: brand_name) %>
</p>
<% end %>
<p><%= t('mailer.devise.confirmation_instructions.activate_html') %></p>
<% end %>
<% if @resource.unconfirmed_email.present? %>
<p><%= link_to t('mailer.devise.confirmation_instructions.confirm_account'), frontend_url('auth/confirmation', confirmation_token: @token) %></p>
<% elsif @resource.confirmed? %>
<p><%= link_to t('mailer.devise.confirmation_instructions.login_account'), frontend_url('auth/sign_in') %></p>
<% elsif account_user&.inviter.present? %>
<p><%= link_to t('mailer.devise.confirmation_instructions.confirm_account'), frontend_url('auth/password/edit', reset_password_token: @resource.send(:set_reset_password_token)) %></p>
<% else %>
<p><%= link_to t('mailer.devise.confirmation_instructions.confirm_account'), frontend_url('auth/confirmation', confirmation_token: @token) %></p>
<% end %>