Skip to content

Localize server-generated email notifications and confirmation emails#139

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/implement-i18n-for-email
Draft

Localize server-generated email notifications and confirmation emails#139
Copilot wants to merge 3 commits into
mainfrom
copilot/implement-i18n-for-email

Conversation

Copy link
Copy Markdown

Copilot AI commented May 13, 2026

Email subjects and bodies were still hard-coded in English, so recipients always received English emails regardless of the plugin locale setup. This change moves email content into the existing locale files and carries the subscriber’s language through the subscription flow so later notifications use the same locale.

  • Email i18n

    • Added locale-backed strings for:
      • subscription confirmation emails
      • unsubscription confirmation emails
      • edit-start notifications
      • edit-end notifications
      • shared email footer text
    • Reused the existing locales/*.json structure instead of introducing a separate translation path.
  • Server-side template resolution

    • Added emailTemplates.js to resolve locale, apply fallback to en, and interpolate dynamic values such as padId, padUrl, and confirmation links.
    • Updated handleMessage.js and update.js to build email subject/body from localized templates rather than inline strings.
  • Persist recipient locale

    • Captured the client language during subscribe/unsubscribe requests.
    • Stored the resolved locale alongside subscription metadata so follow-up edit notifications are sent in the recipient’s selected language.
  • Fallback behavior

    • Normalized locale values such as fr-CA / de-DE to supported plugin locales.
    • Defaulted unsupported locales to English.
const localizedEmail = getConfirmationEmail({
  action: 'subscribe',
  locale: getUserLocale(userInfo),
  padId,
  padUrl: padUrl(padId),
  token: subscribeId,
});

await server.send({
  text: localizedEmail.text,
  subject: localizedEmail.subject,
  from: `${fromName} <${fromEmail}>`,
  to: userInfo.email,
});

Copilot AI linked an issue May 13, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits May 13, 2026 10:19
Copilot AI changed the title [WIP] Add i18n support for email translations Localize server-generated email notifications and confirmation emails May 13, 2026
Copilot AI requested a review from JohnMcLear May 13, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement i18n for the email itself

2 participants