- Issue created by @Anybody
- 🇩🇪Germany Anybody Porta Westfalica
@Grevil: Any idea how to get the translated config per user?
// @todo: We need to get the config in the users language! $escalationStepConfig = $this->getEscalationStepConfig($escalationStep);
Currently, the mails are always sent in one language...
I was searching for a solution for half an hour without valid results. This MUST be possible? xD
- First commit to issue fork.
- 🇩🇪Germany Grevil
Alright, I implemented this similar how, the user module does it: https://git.drupalcode.org/project/drupal/-/blob/11.0.x/core/modules/use...
But it doesn't seem to work. Maybe there is some kind of caching issue? Assigning this to @anybody for further investigations.
NOTE @anybody. For some reason there is NO hook_mail() implementation anymore for 11.x !!!
I just stumbled upon this, while looking into the user module online. Maybe there is a cleaner way on how to do this now! Please have a look at https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/user/....
- Merge request !6Issue #3501968: Implement mail translation (by user preferred language) → (Merged) created by Grevil
- 🇩🇪Germany Anybody Porta Westfalica
NOTE @anybody. For some reason there is NO hook_mail() implementation anymore for 11.x !!!
The reason is:
https://www.drupal.org/node/3496786 →Thank you, I'll check why it doesn't work. Code looks correct to me, now we know that core does it the same way!
- 🇩🇪Germany Anybody Porta Westfalica
Okay seems I'm close to the reason why it doesn't work:
\Drupal::config('user_registration_reminder.settings')->get("reminder_escalations.0")
works as expected and returns the German string at the same place, while
$escalationStepConfig = $this->getEscalationStepConfig($escalationStep);
doesn't and returns the English string.
So I pretty much guess this is another reason why we shouldn't use this convenient anti-pattern:
$this->config = $configFactory->get('user_registration_reminder.settings');
- 🇩🇪Germany Anybody Porta Westfalica
@Grevil: That's it!!!!!! CRAZY. Interesting to see this heavy side-effect...