Problem/Motivation

Third-party modules may call reset() on the string translation translator plugins. This also affects the StringTranslationDefaults plugin. The parent implementation in Drupal\Core\StringTranslation\Translator\StaticTranslation sets the translations property of the class to an empty array.

Since the StringTranslationDefaults plugin should be constructed with the default translations, the same should apply when the translator is reset.

Steps to reproduce

We encountered the issue when sending multiple emails using the Symfony Mailer Plus module. During the email delivery, the language context is switched to reflect the environment in which the email was sent. See Drupal\symfony_mailer\Mailer::changeActiveLanguage(). After the first email, the default translations are lost and not initiated again.

Proposed resolution

Set the default translations on reset.

Issue fork string-3550780

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

simonbaese created an issue. See original summary.

simonbaese’s picture

Assigned: simonbaese » Unassigned
Status: Active » Needs review

  • d48a6503 committed on 2.x
    Issue #3550780: Restore defaults when String default translator is reset
    
d34dman’s picture

Status: Needs review » Fixed

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.