Skip to content

feat(notifications): localize the event line of notifications - #3518

Closed
natinho68 wants to merge 1 commit into
seerr-team:developfrom
natinho68:feat/localize-notification-event
Closed

natinho68 wants to merge 1 commit into
seerr-team:developfrom
natinho68:feat/localize-notification-event

Conversation

@natinho68

@natinho68 natinho68 commented Sep 15, 2026 •

Copy link
Copy Markdown

Description

The event line of a notification — "New Movie Request", "Movie Request Now
Available", "New Video Issue Reported" — was built as a hardcoded English
string by the notification producers (MediaRequest.sendNotification,
MediaRequestSubscriber, IssueSubscriber, IssueCommentSubscriber).

Every agent then printed that string as-is, so a user with a non-English
locale got a notification whose first line was English while the fields right
below it ("Requested By", "Request Status", "Pending Approval") were already
translated through intl.formatMessage. On Telegram it looks like this, with
the title and overview coming from TMDB in the user's language:

*New Movie Request - Le Titre Français*
Le synopsis en français…

*Demandé par:* Michel
*État de la demande:* En attente de validation

Producers now record which message applies plus the raw values it needs
(is4k, media type, issue type) in a new eventMessage field, and each agent
renders that line with its own recipient's locale. This is the same approach
webpush.ts already uses to build its body, so it introduces no new pattern.

The webhook payload is unchanged: NotificationManager.sendNotification
derives event from the new message in English before handing the payload to
the agents, so anything parsing {{event}} keeps receiving the exact strings
it received before.

Only en.json is updated here — the other locales are left to Weblate.

No linked issue.

How Has This Been Tested?

Tested on Node 22.23.2 / pnpm 10.24.0, against develop at 6fa7473.

  • pnpm test — 205/205 passing, including 16 new tests in
    server/i18n/eventMessages.test.ts. 14 of those assert the exact English
    wording of every event, case by case ("4K Series Now Available",
    "New Video Issue Reported", "New Comment on Audio Issue", …), so the strings
    the webhook has always exposed are locked down against regressions.
  • pnpm typecheck:server — clean.
  • pnpm lint — no errors (19 pre-existing warnings, untouched).
  • pnpm build — successful.
  • pnpm i18n:extract — regenerates server/i18n/locale/en.json with the 16
    new notifications.events.* keys; re-running it produces no further diff.

No database migration is required, and no documentation references the event
strings.

Screenshots / Logs (if applicable)

N/A

Checklist:

  • I have read and followed the contribution guidelines.
  • Disclosed any use of AI (see our policy)
  • I have updated the documentation accordingly.
  • All new and existing tests passed.
  • Successful build pnpm build
  • Translation keys pnpm i18n:extract
  • Database migration (if required)

Summary by CodeRabbit

  • New Features

    • Notification events now support localized text across email, push, chat, and webhook integrations.
    • Media requests and issue updates display translated event labels, media types, quality indicators, and issue types.
    • Notification formatting adapts to each configured locale while retaining English fallback text when translations are unavailable.
  • Bug Fixes

    • Improved consistency of event titles and messages across notification channels.
    • Preserved compatibility for integrations that rely on English event fields.

The event line ("New Movie Request", "Movie Request Now Available", ...)
was built as a hardcoded English string by the notification producers, so
every agent printed it in English no matter the recipient's locale, right
next to fields that were already translated.

Producers now record which message applies, along with the raw values it
needs (is4k, media type, issue type), and each agent renders that line in
its own recipient's locale, the same way webpush already builds its body.

The webhook payload keeps the English wording it has always exposed: the
notification manager derives `event` from the new message before handing
the payload to the agents.
@natinho68
natinho68 requested a review from a team as a code owner September 15, 2026 19:29
@coderabbitai

coderabbitai Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 2b76c63b-eff3-4636-b9b4-66e0ef8183cc

📥 Commits

Reviewing files that changed from the base of the PR and between 6fa7473 and 7c1c252.

📒 Files selected for processing (17)
  • server/entity/MediaRequest.ts
  • server/i18n/eventMessages.test.ts
  • server/i18n/eventMessages.ts
  • server/i18n/locale/en.json
  • server/lib/notifications/agents/agent.ts
  • server/lib/notifications/agents/discord.ts
  • server/lib/notifications/agents/email.ts
  • server/lib/notifications/agents/gotify.ts
  • server/lib/notifications/agents/ntfy.ts
  • server/lib/notifications/agents/pushbullet.ts
  • server/lib/notifications/agents/pushover.ts
  • server/lib/notifications/agents/slack.ts
  • server/lib/notifications/agents/telegram.ts
  • server/lib/notifications/index.ts
  • server/subscriber/IssueCommentSubscriber.ts
  • server/subscriber/IssueSubscriber.ts
  • server/subscriber/MediaRequestSubscriber.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Notification events now use structured i18n descriptors. Producers pass event metadata, dispatch preserves English webhook text, and notification agents render localized messages with fallbacks.

Changes

Localized notification events

Layer / File(s) Summary
Event message contract and formatting
server/i18n/eventMessages.ts, server/i18n/locale/en.json, server/i18n/eventMessages.test.ts, server/lib/notifications/agents/agent.ts
Adds event descriptors, formatting logic, English translations, typed payload metadata, and formatter tests.
Structured event message producers
server/entity/MediaRequest.ts, server/subscriber/MediaRequestSubscriber.ts, server/subscriber/IssueSubscriber.ts, server/subscriber/IssueCommentSubscriber.ts
Replaces constructed event strings with descriptors and metadata for media request and issue notifications.
Dispatch and localized agent output
server/lib/notifications/index.ts, server/lib/notifications/agents/*
Derives English fallback events for dispatch and formats structured events for configured notification locales.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Subscriber
  participant sendNotification
  participant NotificationAgent
  Subscriber->>sendNotification: send eventMessage descriptor and metadata
  sendNotification->>sendNotification: derive English event fallback
  sendNotification->>NotificationAgent: dispatch payload
  NotificationAgent->>NotificationAgent: format event for configured locale
  NotificationAgent-->>Subscriber: render localized notification
Loading

Suggested reviewers: fallenbagel, thecatlady

Merge Risk: ⚪ Minimal · up to 7c1c2

Localized event lines safely fall back to English until Weblate translations are available, so no actionable merge risk remains.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: localizing notification event lines for recipients.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit tunes the message bell,
With 4K words to tell it well.
Descriptors hop from queue to queue,
Localized greetings bloom anew.
English waits as fallback bright,
While every channel speaks just right.

Comment @coderabbitai help to get the list of available commands.

@fallenbagel

fallenbagel commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

Please do not create duplicate PRs.

Also this doesn't follow the contributing guidelines properly. Please read the guidelines properly before creating a PR in the future.

@fallenbagel

fallenbagel commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

#3421

@fallenbagel fallenbagel added the duplicate This issue or pull request already exists label Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants