By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.
Language preference was only stored in a short-lived cookie, causing the dashboard to forget the selected language after about a day. This fix persists the user's locale to the database and restores it on login across devices.
Changes:
Added locale column to the user table (SQLite + PostgreSQL)
Added POST /user/locale endpoint to save locale preference
GET /user now returns the saved locale field
Locale switcher calls the API to persist on change (fire-and-forget)
On page load with no cookie, locale is restored from the user's DB record
Cookie expiry extended to 1 year as fallback
How to test?
Log in and change the language via the locale switcher (profile menu)
Verify the language changes immediately
Clear the NEXT_LOCALE cookie from browser dev tools
Refresh the page — the language should be restored from the database
Open a private/incognito window, log in with the same account — the saved language should apply automatically
🔄 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/fosrl/pangolin/pull/2627
**Author:** [@shreyaspapi](https://github.com/shreyaspapi)
**Created:** 3/10/2026
**Status:** ✅ Merged
**Merged:** 3/30/2026
**Merged by:** [@oschwartz10612](https://github.com/oschwartz10612)
**Base:** `main` ← **Head:** `fix/1547-persist-user-locale`
---
### 📝 Commits (2)
- [`ae39084`](https://github.com/fosrl/pangolin/commit/ae39084a75564738efa059f40152f6725d83fc81) fix: persist user locale preference to database (#1547)
- [`5455d1c`](https://github.com/fosrl/pangolin/commit/5455d1c118f65ec9e9bfc869c0e5748166085e20) fix: add locale to myDevice user query to fix type error
### 📊 Changes
**9 files changed** (+103 additions, -5 deletions)
<details>
<summary>View changed files</summary>
📝 `server/db/pg/schema/schema.ts` (+2 -1)
📝 `server/db/sqlite/schema/schema.ts` (+2 -1)
📝 `server/routers/external.ts` (+5 -0)
📝 `server/routers/user/getUser.ts` (+2 -1)
📝 `server/routers/user/index.ts` (+1 -0)
📝 `server/routers/user/myDevice.ts` (+2 -1)
➕ `server/routers/user/updateUserLocale.ts` (+57 -0)
📝 `src/components/LocaleSwitcherSelect.tsx` (+7 -0)
📝 `src/services/locale.ts` (+25 -1)
</details>
### 📄 Description
## Community Contribution License Agreement
By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.
## Description
Fixes #1547
Language preference was only stored in a short-lived cookie, causing the dashboard to forget the selected language after about a day. This fix persists the user's locale to the database and restores it on login across devices.
**Changes:**
- Added `locale` column to the user table (SQLite + PostgreSQL)
- Added `POST /user/locale` endpoint to save locale preference
- `GET /user` now returns the saved `locale` field
- Locale switcher calls the API to persist on change (fire-and-forget)
- On page load with no cookie, locale is restored from the user's DB record
- Cookie expiry extended to 1 year as fallback
## How to test?
1. Log in and change the language via the locale switcher (profile menu)
2. Verify the language changes immediately
3. Clear the `NEXT_LOCALE` cookie from browser dev tools
4. Refresh the page — the language should be restored from the database
5. Open a private/incognito window, log in with the same account — the saved language should apply automatically
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/fosrl/pangolin/pull/2627
Author: @shreyaspapi
Created: 3/10/2026
Status: ✅ Merged
Merged: 3/30/2026
Merged by: @oschwartz10612
Base:
main← Head:fix/1547-persist-user-locale📝 Commits (2)
ae39084fix: persist user locale preference to database (#1547)5455d1cfix: add locale to myDevice user query to fix type error📊 Changes
9 files changed (+103 additions, -5 deletions)
View changed files
📝
server/db/pg/schema/schema.ts(+2 -1)📝
server/db/sqlite/schema/schema.ts(+2 -1)📝
server/routers/external.ts(+5 -0)📝
server/routers/user/getUser.ts(+2 -1)📝
server/routers/user/index.ts(+1 -0)📝
server/routers/user/myDevice.ts(+2 -1)➕
server/routers/user/updateUserLocale.ts(+57 -0)📝
src/components/LocaleSwitcherSelect.tsx(+7 -0)📝
src/services/locale.ts(+25 -1)📄 Description
Community Contribution License Agreement
By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.
Description
Fixes #1547
Language preference was only stored in a short-lived cookie, causing the dashboard to forget the selected language after about a day. This fix persists the user's locale to the database and restores it on login across devices.
Changes:
localecolumn to the user table (SQLite + PostgreSQL)POST /user/localeendpoint to save locale preferenceGET /usernow returns the savedlocalefieldHow to test?
NEXT_LOCALEcookie from browser dev tools🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.