Default sender address should take langcode into account

Created on 9 October 2023, 9 months ago
Updated 14 February 2024, 5 months ago

Problem/Motivation

Currently the Sender address creation hardcodes the default language as site default language: https://git.drupalcode.org/project/symfony_mailer/-/blob/1.x/src/Address...

Steps to reproduce

-

Proposed resolution

Use something code like this to get the to get translated display name.
$config_translation = \Drupal::languageManager()->getLanguageConfigOverride($langcode, $config_name);

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇫🇮Finland sokru

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

Comments & Activities

  • Issue created by @sokru
  • 🇬🇧United Kingdom AdamPS

    Thanks for the report.

    getLanguageConfigOverride() needs a $langcode and Address::create() doesn't have one.

    I would say that the code in Address.php uses the current language rather than the default language. The solution is to ensure that the current language is correct.

    The default sender is set in DefaultsEmailAdjuster::build(). This runs too soon, before the language switch in Mailer::doSend(). We should move the code to set sender into the pre or post render phase - inside an if test that there isn't already a value set.

  • 🇦🇺Australia Mingsong 🇦🇺

    I think it is related to 🐛 Mails not being send in user preferred language. Active

Production build 0.69.0 2024