Backport User preferred language from 3372166

Created on 25 April 2025, 3 months ago

Problem/Motivation

After upgrading to 1.6.0-beta1 we found emails only send in the sites default language and translated emails do not get sent in the users preferred language.

I found this had been fixed in 2.0.0-alpha by @AdamPS

I also found @AdamPS has already fixed his issue here:
https://git.drupalcode.org/issue/symfony_mailer-3372166/-/compare/1.6.0-...

I pulled the code down and tested it and emails now send in the users preferred language and I could not find any other issues.

Steps to reproduce

- Set up translated emails
- Set the users preferred language to anything other than the site default
- Trigger an email

Proposed resolution

Merge @AdamPS code in to 1.6.0-beta

Remaining tasks

Merge @AdamPS code in to 1.6.0-beta

User interface changes

None

API changes

None

Data model changes

None

โœจ Feature request
Status

Active

Version

1.6

Component

Code

Created by

๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom moss.dev

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

Comments & Activities

  • Issue created by @moss.dev
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom moss.dev

    Hi @AdamPS,

    I saw your message that if someone wants this backported they should raise a working MR. But I found you had already done all the work and I have tested it and it seems to be working great.

    I didn't think it was right to make an MR from your work and I also wanted to know if you think it still needs work.

    I am happy to do anything to get this backported. Please let me know if you need anything.

    Thanks for your work here so far.

  • First commit to issue fork.
  • ๐Ÿ‡ซ๐Ÿ‡ฎFinland oakulm

    For what its worth this combination works:

    "drupal/symfony_mailer": "dev-1.x#089cbc1b51543b2495e6d3389cbd8f77d6da8da2"

    https://git.drupalcode.org/issue/symfony_mailer-3372166/-/compare/1.x......

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom adamps

    I'm confused๐Ÿ˜ƒ

    After upgrading to 1.6.0-beta1 we found emails only send in the sites default language and translated emails do not get sent in the users preferred language.

    So has 1.6 made things worse compared with 1.5?? That would be totally different from a backport.

    But I found you had already done all the work and I have tested it and it seems to be working great.

    For what its worth this combination works:

    I don't understand what you tested in #1 or what works in #4. The IS and #4 both have links to comparisons that are huge with 20 changed files.

    I am happy to do anything to get this backported. Please let me know if you need anything.

    The backport needs to do something similar to this, which is the original fix: https://git.drupalcode.org/project/symfony_mailer/-/merge_requests/107/d.... The key part is the addition of EmailAdjusterManager::build().

    However we need to be back-compatible, so we can't add functions to interfaces or add interfaces to classes. It's probably not even possible because EmailAdjusterInterface::setConfiguration() doesn't exist in 1.x. The best you could do is to make a patch for 1.x that is non-BC, and we leave it in this issue without commit. Sites could apply it if they made sure it didn't break anything for them.

Production build 0.71.5 2024