Newsletter “Reason” field does not appear translated for multilingual subscribers

Created on 11 July 2025, 16 days ago

Problem/Motivation

When using Simplenews on a multilingual Drupal site, the email content is expected to be sent in the language of the subscriber (based on the language used during the subscription process). While most of the newsletter content is correctly translated — including the title and the article body — the Reason field from the newsletter configuration remains untranslated and always appears in the original language (e.g., English).

Steps to reproduce

  1. Create a Drupal site with multilingual support (e.g., English and French).
  2. Enable the Simplenews module and configure it to send newsletters using the Article content type.
  3. Navigate to Web Services > Simplenews and create a Newsletter.
  4. Fill in the Reason field with text in English.
  5. Use the "Translate" operation for the Newsletter and add a French translation for the Reason field.
  6. Add the Simplenews subscription block to both English and French versions of the site.
  7. As an anonymous user, subscribe to the newsletter using the French version of the page.
  8. Create a new Article and select the Newsletter you created.
  9. Go to the Newsletter tab on the article node and click Send now.
  10. Run cron or use drush sn-ss to process the newsletter queue.

Expected result

The email is sent to the subscriber in French, and all translatable fields (including Reason) appear in French.

Actual result

The Article title and body appear translated correctly. However, the Reason field still appears in the original language (English), regardless of the subscriber's language.

Dump of the newsletter variable on the Twig template.

Proposed resolution

Ensure that the reason field is fetched in the subscriber's preferred language during the rendering of the newsletter message(template_preprocess_simplenews_newsletter_body()), just like other translated elements.

🐛 Bug report
Status

Active

Version

4.1

Component

Code

Created by

🇧🇷Brazil andre.bonon

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @andre.bonon
  • 🇧🇷Brazil andre.bonon

    Unfortunately, the Newsletter (ConfigEntityType) doesn’t provide hasTranslation() or getTranslation() methods like ContentEntityType does.
    As a result, I had to use the language manager service and manually fetch each translation—for both the Reason and the Subject—in different files.

    This works for now, but further improvements will be needed to support translations more robustly in the future.
    It might be worth considering adding translation-handling methods directly to the Newsletter class.

  • Pipeline finished with Failed
    16 days ago
    Total: 1177s
    #545553
  • Pipeline finished with Canceled
    13 days ago
    #547206
  • Pipeline finished with Failed
    13 days ago
    #547207
Production build 0.71.5 2024