[PR #6394] [MERGED] fix(frontend): isolate subscription language preference #6247

Closed
opened 2026-11-02 04:07:22 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6394
Author: @dawNotPoi
Created: 9/3/2026
Status: ✅ Merged
Merged: 9/3/2026
Merged by: @MHSanaei

Base: main ← Head: fix/6386-subscription-language-cookie


📝 Commits (2)

  • bda80c4 fix(frontend): isolate subscription language preference
  • 3b1f1bd fix(frontend): defer date locale resolution

📊 Changes

5 files changed (+95 additions, -23 deletions)

View changed files

📝 frontend/src/entries/subpage.tsx (+1 -1)
📝 frontend/src/i18n/react.ts (+9 -8)
📝 frontend/src/pages/sub/SubPage.tsx (+7 -5)
➕ frontend/src/test/language-scope.test.ts (+52 -0)
📝 frontend/src/utils/index.ts (+26 -9)

📄 Description

Summary

Keep the public subscription page's language preference separate from the panel and login preference.

  • Preserve the existing lang cookie for panel and login pages.
  • Store the subscription SPA preference in subLang, with a one-time migration from a valid existing lang value.
  • Initialize i18n lazily for the requested language scope and format subscription dates with that same locale.
  • Add focused regression coverage for initialization, migration, independent writes, and date locale selection.

Closes #6386

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Refactor

Areas affected

  • Frontend
  • Subscription page

How has this been tested?

  • npx vitest run --project unit src/test/language-scope.test.ts
  • Mutation check: restoring the shared-cookie write makes the regression test fail
  • npm run typecheck
  • Changed-file oxlint and oxfmt --check
  • npx vite build
  • Manual browser check: set login/panel to English and the subscription page to Persian, then reload both pages; each page retains its own language

Screenshots / recordings

N/A — this changes preference persistence only and does not change layout or styling.

Breaking changes

None.

Checklist

  • I have performed a self-review of my code.
  • I have added tests that prove the fix is effective.
  • New and existing unit tests pass locally with my changes.
  • My changes generate no new warnings in the affected frontend files.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6394 **Author:** [@dawNotPoi](https://github.com/dawNotPoi) **Created:** 9/3/2026 **Status:** ✅ Merged **Merged:** 9/3/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix/6386-subscription-language-cookie` --- ### 📝 Commits (2) - [`bda80c4`](https://github.com/MHSanaei/3x-ui/commit/bda80c45e769cd1a3d1197411b6f91cf3bda6725) fix(frontend): isolate subscription language preference - [`3b1f1bd`](https://github.com/MHSanaei/3x-ui/commit/3b1f1bd75ff6a01297a09d63cdc7c7d739c3edca) fix(frontend): defer date locale resolution ### 📊 Changes **5 files changed** (+95 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/entries/subpage.tsx` (+1 -1) 📝 `frontend/src/i18n/react.ts` (+9 -8) 📝 `frontend/src/pages/sub/SubPage.tsx` (+7 -5) ➕ `frontend/src/test/language-scope.test.ts` (+52 -0) 📝 `frontend/src/utils/index.ts` (+26 -9) </details> ### 📄 Description ## Summary Keep the public subscription page's language preference separate from the panel and login preference. - Preserve the existing `lang` cookie for panel and login pages. - Store the subscription SPA preference in `subLang`, with a one-time migration from a valid existing `lang` value. - Initialize i18n lazily for the requested language scope and format subscription dates with that same locale. - Add focused regression coverage for initialization, migration, independent writes, and date locale selection. Closes #6386 ## Type of change - [x] Bug fix - [ ] New feature - [ ] Breaking change - [ ] Refactor ## Areas affected - Frontend - Subscription page ## How has this been tested? - `npx vitest run --project unit src/test/language-scope.test.ts` - Mutation check: restoring the shared-cookie write makes the regression test fail - `npm run typecheck` - Changed-file `oxlint` and `oxfmt --check` - `npx vite build` - Manual browser check: set login/panel to English and the subscription page to Persian, then reload both pages; each page retains its own language ## Screenshots / recordings N/A — this changes preference persistence only and does not change layout or styling. ## Breaking changes None. ## Checklist - [x] I have performed a self-review of my code. - [x] I have added tests that prove the fix is effective. - [x] New and existing unit tests pass locally with my changes. - [x] My changes generate no new warnings in the affected frontend files. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:07:22 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#6247
No description provided.