Support email translations

Created on 12 April 2019, almost 6 years ago
Updated 14 February 2024, 11 months ago

Problem/Motivation

This was brought up by someone after the presentation at DrupalCon, but I've never done a multilingual project, so I need someone else to take the lead on this issue. I'm not sure what changes are needed.

Proposed resolution

  • Allow email type configuration to be translated properly when the config_translation module is installed.
  • Discuss what translation means for the Email entity. At the moment it is set up to be translatable. But does this make sense. I'm not sure it does because this is more of a log of what was sent to the user and therefore it shouldn't be translated - it probably should have a field that reflects language that the email was sent it but the entity and it's fields should not be translatable.
  • Add support to \Drupal\easy_email\Service\EmailHandler::sendEmail() for loading the correct language depending on what's in params - I think there'll be a language property in there.
  • Add test coverage

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States zengenuity

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.

  • πŸ‡«πŸ‡·France Toki Caen, Normandy

    Here is a case where email templates translation is important: I am using ECA and Easy Email to send HTML email to an user who has just created their account on a bilingual site and I need the email to be in the interface language during registration.
    If I activate content translation for emails, I can see the list of template fields (To, BC, Body...) but if I go to the translation tab of my template, I can only translate the title of the template (which is visible only for admin).
    Is there a configuration that I'm missing or will I be forced to create two templates (one for each language) and create two paths of actions on my ECA model, with a condition based on the interface language during registration?

  • Status changed to Active 12 months ago
  • πŸ‡ΊπŸ‡ΈUnited States zengenuity

    I've included some of the work that was done here in this issue in the 3.0.x branch.

    Note that it requires a special upgrade process due to the changing of the entity type. I've described the process in the release notes here: https://www.drupal.org/project/easy_email/releases/3.0.0-beta3 β†’

    I did some limited testing with adding a second language to my site and translating an email template. It appeared to work. But, I'm not an expert in multilingual sites, so it would be great if others could report back about the multilingual functionality of the 3.0.x branch when test it out.

    Setting the status back to active here because the patch no longer needs to be reviewed. If there are additional updates needed to the 3.0.x branch, post them and change the status back to needs review.

  • πŸ‡«πŸ‡·France Toki Caen, Normandy

    Thank you for this big update.
    I tested on a fresh website with ECA and the change made for the translation fulfills exactly the role I expected. I was able to create a template then translate it in full (subject, title, etc.) and when I add a Send Easy Email action on ECA, if the event triggers from the English version, the email sent is the one translated into English. If the event triggers from the French version, it is the email in French which arrives in the targeted mailbox. No more need to create 2 different email templates and add a test on the language of the site to send translated emails from ECA. The model is considerably simplified and pragmatic. Thanks again!

  • Status changed to Fixed 12 months ago
  • πŸ‡ΊπŸ‡ΈUnited States zengenuity

    Okay, I'm going to mark this issue as fixed, since I believe it's now possible to send translated emails from the 3.0.x branch.

    I've added a follow-up issue to improve the UI for translation: ✨ Improve Translation User Interface Active

    I don't have an immediate need for that improvement, since I don't have a multilingual site I'm supporting. That means I'm not going to get to it anytime soon. If someone else who is using translations wants to take that on, it would be much appreciated.

    Thanks to everyone who helped on this issue!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024