Email types not translated

סיכום מבוסס בינה מלאכותית

In the discussion titled “Email types not translated” under the Translations category, claas reports that email types listed under Administration → E-Mails are not translated, and provides a technical breakdown tracing the source of these types to the EmailLog model and various jobs like UserEmail and NotifyMailingListSubscribers. The email types are often hardcoded in multiple locations across the codebase, including controllers and helpers. dandv adds that they’re researching possible email types to help disable certain ones, noting examples like signup, forgot_password, mailing_list, and test_message, and even referencing an unusual test value blah. Falco contributes a comprehensive list of 40+ known email types, including both user-facing (e.g., user_mentioned, digest, invite) and system/administrative types (e.g., email_reject_reply_user_not_matching, admin_login, account_suspended). The thread highlights a gap in i18n support for these email type labels and suggests that making them translatable would require refactoring hardcoded strings into translation keys.

I have noticed that email types in Administration → E-Mails are not translated:

This one is a bit trickier, but here’s what I found out.

  1. The displayed email type comes from this line in the template (for the Sent page):
  2. The list shows EmailLog records, which have an email_type field defined here:
  3. EmailLog records are created in the jobs NotifyMailingListSubscribers and UserEmail.
  4. UserEmail jobs (and CriticalUserEmail jobs, which are a subtype) are queued at different locations with mostly hardcoded email types (found via grep -R "user_email" .):

(This should be it.)

In general, it would be a good idea to collect the complete list of valid email types (not to be confused with the email template types) at a central place and make these translatable (even though plugins may send emails as well, I suppose, therefore we probably cannot reject email keys that are not in this list, which would assert that this list is to be kept complete).

3 לייקים

I’m also curious about all possible email_types, because I’m looking into disabling certain email types.

So far, I’ve seen:

signup
forgot_password
mailing_list
test_message

But the code also shows more unusual ones like blah.

List of types:

  • email_reject_reply_user_not_matching
  • email_reject_old_destination
  • email_reject_inactive_user
  • email_login
  • user_quoted
  • user_mentioned
  • email_reject_screened_email
  • user_invited_to_private_message
  • confirm_old_email
  • email_reject_invalid_post_specified
  • mailing_list
  • admin_confirmation_message
  • download_backup_message
  • user_private_message
  • forgot_password
  • admin_login
  • email_reject_topic_not_found
  • notify_old_email
  • invite
  • user_replied
  • suspicious_login
  • email_reject_empty
  • confirm_new_email
  • user_invited_to_topic
  • activation_reminder
  • account_suspended
  • email_reject_post_too_short
  • group_mentioned
  • account_second_factor_disabled
  • test_message
  • signup
  • user_watching_first_post
  • email_reject_topic_closed
  • email_reject_bad_destination_address
  • user_posted
  • digest
  • user_linked
3 לייקים