Address::create should take langcode into account

Created on 9 October 2023, about 1 year 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

  • Status changed to Postponed: needs info 3 months ago
  • 🇬🇧United Kingdom adamps

    This should now be fixed by 📌 Change to the phases Active - please can anyone confirm?

Production build 0.71.5 2024