Send mail in correct language not working

Created on 25 April 2018, about 7 years ago
Updated 28 May 2025, 6 days ago

The current codebase 8.x1.x-dev is not capable of sending multilingual mails in the correct language.

There are two bugs in the module, that have to be fixe together:

Message Notify:

  public function view(EntityInterface $entity, $view_mode = 'full', $langcode = NULL) {
    $build = parent::view($entity, $view_mode, $langcode);

    if (!$langcode) {
      $langcode = \Drupal::languageManager()->getCurrentLanguage()->getId();
    }
    else {
      if (\Drupal::moduleHandler()->moduleExists('config_translation') && !isset($partials[$langcode])) {
        $langcode = \Drupal::languageManager()->getCurrentLanguage()->getId();
      }
    }

The variable $partials is in this context always undefined and the $langcode will always be set to the current language.

You will need 2 patches to make it work:

- First patch for message_notify
- Second patch for message
You can now create a message by setting the language code and then send it in the according language.

🐛 Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

🇨🇭Switzerland ayalon

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024