Skip to content

fix(i18n): fallback to server locale for "Default" user lang in notifs#3190

Merged
fallenbagel merged 1 commit into
developfrom
fix/i18n-default-locale-server-fallback
Jun 23, 2026
Merged

fix(i18n): fallback to server locale for "Default" user lang in notifs#3190
fallenbagel merged 1 commit into
developfrom
fix/i18n-default-locale-server-fallback

Conversation

@fallenbagel

@fallenbagel fallenbagel commented Jun 22, 2026

Copy link
Copy Markdown
Member

Description

When a user's display language is set to "Default", their stored locale is
an empty string, ignoring the server's configured application language.

Affects all per-user agents (email, Telegram, Pushbullet, Pushover,
webpush, Discord with useUserLocale: true). Channel agents (Slack,
Gotify, ntfy, Discord with useUserLocale: false) pass an explicit locale
and are unaffected, though they now also correctly fall back to the server
default if their configured locale is somehow empty.

How Has This Been Tested?

(no need)

Screenshots / Logs (if applicable)

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

  • Chores
    • Updated default locale resolution to use server-configured settings instead of hardcoded fallback values.

`getIntl` used `??` which doesn't catch empty string which is the value stored when a user sets
their display language to "Default". Falsy locales now resolve to the server's main locale before
en.

fix #3151
@fallenbagel fallenbagel requested a review from Copilot June 22, 2026 12:08
@fallenbagel fallenbagel requested a review from a team as a code owner June 22, 2026 12:08
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

server/i18n/index.ts imports getSettings and updates getIntl() to read getSettings().main.locale as the default locale when no locale argument is supplied, falling back to 'en' only if that setting is also absent. The previous locale ?? 'en' direct fallback is removed.

Server i18n locale default

Layer / File(s) Summary
getIntl() locale resolution from server settings
server/i18n/index.ts
Adds getSettings import; replaces locale ?? 'en' with a serverLocale derived from getSettings().main.locale, so getIntl() without an explicit locale argument now uses the server-configured language before falling back to 'en'.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐇 A hop through the settings, a peek at the config,
No more English-by-default, that old sneaky trick!
serverLocale now leads the email parade,
In whatever fine language the admin has made.
The rabbit cheers loudly — correct tongues at last! 🌍

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing i18n fallback to use server locale for users with 'Default' language setting.
Linked Issues check ✅ Passed The PR directly addresses issue #3151 by modifying locale resolution in getIntl() to fall back to server settings when no explicit locale is provided.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the i18n locale fallback issue described in #3151; no out-of-scope modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes notification localization when a user’s display language is set to “Default” (stored as an empty string), by falling back to the server’s configured application language and then to English.

Changes:

  • Update server-side getIntl locale resolution to treat falsy/empty user locale as “use server locale”.
  • Ensure agent-provided locales also fall back to English if an unexpected empty value is encountered.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread server/i18n/index.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@server/i18n/index.ts`:
- Around line 42-45: The issue is that getSettings().main.locale is being cast
to AvailableLocale without validation, and the MainSettings interface declares
locale as a plain string instead of constraining it to valid locale values. To
fix this, update the MainSettings interface to declare the locale property as
type AvailableLocale instead of string, ensuring type safety at compile time.
Additionally, add validation logic at the points where locale values are
assigned (such as API endpoints or settings forms) to verify that only valid
AvailableLocale values are stored in the settings, preventing invalid data from
being persisted in the first place.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1f15d04a-23e6-4b5f-b848-68b45a678f36

📥 Commits

Reviewing files that changed from the base of the PR and between 0a1f703 and 3759e1e.

📒 Files selected for processing (1)
  • server/i18n/index.ts

Comment thread server/i18n/index.ts
@fallenbagel fallenbagel added the bug Something isn't working label Jun 22, 2026
@seerr-automation-bot seerr-automation-bot added this to the v3.4.0 milestone Jun 22, 2026

@0xSysR3ll 0xSysR3ll left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fallenbagel fallenbagel merged commit ef9edc8 into develop Jun 23, 2026
20 checks passed
@fallenbagel fallenbagel deleted the fix/i18n-default-locale-server-fallback branch June 23, 2026 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Email notifications use English instead of server default language when user's display language is set to "Default"

5 participants