Skip to content

Localize registration/reset email to the recipient's language - #3657

Merged
OzzieIsaacs merged 1 commit into
janeczku:Developfrom
benoitperrin:fix/registration-email-locale
Aug 1, 2026
Merged

Localize registration/reset email to the recipient's language#3657
OzzieIsaacs merged 1 commit into
janeczku:Developfrom
benoitperrin:fix/registration-email-locale

Conversation

@benoitperrin

@benoitperrin benoitperrin commented Jun 17, 2026

Copy link
Copy Markdown

Problem

send_registration_mail builds the welcome / password-reset email with a hardcoded English body (never passed through _()), and its subject is translated using the triggering user's locale (usually an admin). A user whose account language is e.g. French therefore receives this email in English.

Fix

  • Make the body translatable and wrap subject + body composition in flask_babel.force_locale(recipient_locale), so the email follows the recipient account's language.
  • Thread the recipient locale from the two call sites (reset_password, /register); the self-service and admin reset paths need no change.
  • Add the new strings to messages.pot and the French catalog. Other languages fall back to the English msgid until translated.

Scope is intentionally limited to the registration/reset email: the SMTP test email targets the admin themselves, and send-to-eReader has no recipient locale (the sender's locale, already used, is the right one there).

Testing

Verified that a reset/welcome triggered for a French-locale account renders subject and body in French ("Bien démarrer avec Calibre-Web" + translated body), while an English-locale account is unchanged.

I kept the .pot change minimal (manual append) to avoid a noisy full regeneration — happy to regenerate it the canonical way if you prefer.

The 'Get Started with Calibre-Web' email had a hardcoded English body and a
subject translated in the triggering user's locale (typically the admin), so a
French user received it in English. Wrap subject+body composition in
flask_babel.force_locale(recipient_locale), make the body translatable, and
thread the recipient locale from reset_password and /register. French
translations added; other languages fall back to English until translated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@benoitperrin
benoitperrin force-pushed the fix/registration-email-locale branch from 3892d78 to 7c16cfa Compare June 17, 2026 17:49
@benoitperrin
benoitperrin marked this pull request as ready for review June 17, 2026 18:10
@OzzieIsaacs
OzzieIsaacs merged commit 1ec5a38 into janeczku:Develop Aug 1, 2026
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.

2 participants