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
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
Comment #3
simonbaeseComment #5
d34dman commented