Translation of "Unsubscribe…" impossible

Created on 19 May 2023, over 1 year ago
Updated 13 September 2023, about 1 year ago

Problem/Motivation

Trying to translate the "Unsubscribe …" message in the footer of the mail sent using the Drupal GUI, saving the translation is denied because not allowed HTML.

Steps to reproduce

  1. Navigate to /admin/config/regional/translate
  2. Search for "Unsubscribe from this newsletter"
  3. Translate this string
  4. <div class="clearfix"> {{ body }} </div> {% if not opt_out_hidden %} <p class="simplenews-unsubscribe"><a href="[simplenews-subscriber:unsubscribe-url]">Dieses Abonnement kündigen</a></p> {% endif %} {% if test %} <p class="simplenews-test-message">Dies ist eine Test-Version des Rundschreibens.</p> {% endif %}
  5. Save

An error will be shown …

Proposed resolution

Isolate the translatable part from the code.

💬 Support request
Status

Fixed

Version

3.0

Component

Miscellaneous

Created by

🇦🇹Austria nofue

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

Comments & Activities

  • Issue created by @nofue
  • 🇬🇧United Kingdom adamps

    I haven't ever used multiple languages in Drupal, so my ability to help is limited. What I can do is search the code...

    In simplenews.module we have the message you describe perfectly isolated:
    $variables['unsubscribe_text'] = t('Unsubscribe from this newsletter', [], ['langcode' => $variables['language']]);

    The longer message with complex syntax comes from simplenews-newsletter-body.html.twig and it has no text that needs translating:

    {% if not opt_out_hidden %}
        {% if format == 'html' %}
            <p class="newsletter-footer"><a
                        href="[simplenews-subscriber:unsubscribe-url]">{{ unsubscribe_text }}</a>
            </p>
        {% else %}
            -- {{ unsubscribe_text }} : [simplenews-subscriber:unsubscribe-url]
        {% endif %}
    {% endif %}
    

    So everything seems correct in the code. I believe you don't need to translate the part that has a red line around it in your screenshot. The translation system has somehow combined together two things and asked you to provide a translation. One of them you already translated, the other has no translatable text.

  • 🇦🇹Austria nofue

    Sounds reasonable -- I cannot see the second field in other installations. Gremlins …

  • Status changed to Fixed over 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Status changed to Fixed about 1 year ago
  • 🇫🇷France zorax Monoblet

    I have the same problem in french. Impossible to have the translation....

Production build 0.71.5 2024