From 48f4c83cc8fbd2e257e5ced98087a388cd852d25 Mon Sep 17 00:00:00 2001 From: yiling Date: Fri, 26 Jun 2026 10:39:32 +0800 Subject: [PATCH 01/25] feat(webui): add i18n support using paraglide-js --- README.md | 13 ++-- bun.lock | 70 +++++++++++++++---- eslint.config.js | 1 + package.json | 2 + packages/webui/messages/en.json | 11 +++ packages/webui/messages/zh.json | 11 +++ packages/webui/package.json | 6 ++ packages/webui/project.inlang/settings.json | 12 ++++ packages/webui/routes/__root.tsx | 31 +++++++- .../webui/routes/teams/$teamId/settings.tsx | 46 ++++++++++++ 10 files changed, 179 insertions(+), 24 deletions(-) create mode 100644 packages/webui/messages/en.json create mode 100644 packages/webui/messages/zh.json create mode 100644 packages/webui/project.inlang/settings.json diff --git a/README.md b/README.md index cb278139..638d57a4 100644 --- a/README.md +++ b/README.md @@ -50,17 +50,16 @@ Docker Compose is the fastest way to get Shumai running. You do not need to clon curl -o docker-compose.yaml https://raw.githubusercontent.com/shumaiOne/shumai/main/docker-compose/local/docker-compose.yaml ``` 3. Configure environment variables (optional): - - * `SHUMAI_SERVER_PORT` controls the port the Shumai server listens on. The default is `3000`. - * By default, Shumai uses the bundled local storage service in this Docker Compose setup. To use an external S3-compatible storage instead, set `AWS_ENDPOINT_URL_S3` to the provider's endpoint URL and configure the corresponding AWS credentials and bucket settings as needed. + - `SHUMAI_SERVER_PORT` controls the port the Shumai server listens on. The default is `3000`. + - By default, Shumai uses the bundled local storage service in this Docker Compose setup. To use an external S3-compatible storage instead, set `AWS_ENDPOINT_URL_S3` to the provider's endpoint URL and configure the corresponding AWS credentials and bucket settings as needed. ``` AWS_ENDPOINT_URL_S3: S3_ENDPOINT_URL S3_REGION: S3_REGION S3_BUCKET: BUCKET_NAME S3_ACCESS_KEY_ID: ID S3_SECRET_ACCESS_KEY: KEY - ``` - * By default, `AWS_ENDPOINT_URL_S3` is set to: `http://localhost:{SHUMAI_SERVER_PORT}`, if you use local storage and expose Shumai on a custom host/port combination, set `AWS_ENDPOINT_URL_S3` to the external URL that browsers will use to upload files. + ``` + - By default, `AWS_ENDPOINT_URL_S3` is set to: `http://localhost:{SHUMAI_SERVER_PORT}`, if you use local storage and expose Shumai on a custom host/port combination, set `AWS_ENDPOINT_URL_S3` to the external URL that browsers will use to upload files. For example, if you change the port mapping in `docker-compose.yaml` from `3000:3000` to `12345:3000` and deploy on a server with IP address `12.34.56.78`, set: @@ -70,11 +69,11 @@ Docker Compose is the fastest way to get Shumai running. You do not need to clon This value must be reachable from client browsers and should include the externally exposed port. -5. Start the services in detached mode: +4. Start the services in detached mode: ```bash docker compose up -d ``` -6. Open your browser and access Shumai at `http://localhost:3000` (or `http://:3000` for remote deployments). +5. Open your browser and access Shumai at `http://localhost:3000` (or `http://:3000` for remote deployments). ### Option 2: Install via NPM / Package Manager diff --git a/bun.lock b/bun.lock index d898157a..080c63dd 100644 --- a/bun.lock +++ b/bun.lock @@ -32,7 +32,7 @@ }, "apps/agent": { "name": "@shumai/agent-app", - "version": "0.0.10", + "version": "0.1.2", "bin": { "shumai-agent": "./src/index.ts", }, @@ -44,7 +44,7 @@ }, "apps/cli": { "name": "@shumai/cli", - "version": "0.0.10", + "version": "0.1.2", "bin": { "shumai-cli": "./src/index.ts", }, @@ -59,7 +59,7 @@ }, "apps/transcode": { "name": "@shumai/transcode-app", - "version": "0.0.10", + "version": "0.1.2", "bin": { "shumai-transcode": "./src/index.ts", }, @@ -71,7 +71,7 @@ }, "apps/web": { "name": "@shumai/web-app", - "version": "0.0.10", + "version": "0.1.2", "dependencies": { "@shumai/agent": "workspace:*", "@shumai/api": "workspace:*", @@ -86,7 +86,7 @@ }, "packages/agent": { "name": "@shumai/agent", - "version": "0.0.10", + "version": "0.1.2", "dependencies": { "@anthropic-ai/sandbox-runtime": "0.0.52", "@earendil-works/pi-agent-core": "0.78.0", @@ -110,7 +110,7 @@ }, "packages/api": { "name": "@shumai/api", - "version": "0.0.10", + "version": "0.1.2", "dependencies": { "@hono/zod-validator": "0.7.6", "@shumai/core": "workspace:*", @@ -124,7 +124,7 @@ }, "packages/core": { "name": "@shumai/core", - "version": "0.0.10", + "version": "0.1.2", "dependencies": { "@shumai/db": "workspace:*", "@shumai/dtos": "workspace:*", @@ -151,7 +151,7 @@ }, "packages/db": { "name": "@shumai/db", - "version": "0.0.10", + "version": "0.1.2", "dependencies": { "@earendil-works/pi-agent-core": "0.78.0", "@prisma/adapter-pg": "7.8.0", @@ -167,18 +167,18 @@ }, "packages/dtos": { "name": "@shumai/dtos", - "version": "0.0.10", + "version": "0.1.2", "dependencies": { "zod": "4.4.3", }, }, "packages/tableprinter": { "name": "@shumai/tableprinter", - "version": "0.0.10", + "version": "0.1.2", }, "packages/transcode": { "name": "@shumai/transcode", - "version": "0.0.10", + "version": "0.1.2", "dependencies": { "@shumai/core": "workspace:*", "@shumai/db": "workspace:*", @@ -192,7 +192,7 @@ }, "packages/webui": { "name": "@shumai/webui", - "version": "0.0.10", + "version": "0.1.2", "dependencies": { "@base-ui/react": "1.5.0", "@dnd-kit/abstract": "0.4.0", @@ -275,6 +275,7 @@ "zustand": "5.0.14", }, "devDependencies": { + "@inlang/paraglide-js": "^2.20.0", "@tailwindcss/postcss": "4.3.0", "@tailwindcss/vite": "4.3.0", "@tanstack/router-cli": "1.167.13", @@ -286,13 +287,14 @@ "postcss": "8.5.15", "tailwindcss": "4.3.0", "tw-animate-css": "1.3.3", + "typescript": "6.0.3", "vite": "7.3.5", "vite-tsconfig-paths": "6.1.1", }, }, "packages/workflow-core": { "name": "@shumai/workflow-core", - "version": "0.0.10", + "version": "0.1.2", "dependencies": { "@shumai/core": "workspace:*", "@shumai/db": "workspace:*", @@ -605,6 +607,12 @@ "@img/sharp-win32-x64": ["@img/sharp-win32-x64@0.34.5", "", { "os": "win32", "cpu": "x64" }, "sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw=="], + "@inlang/paraglide-js": ["@inlang/paraglide-js@2.20.0", "", { "dependencies": { "@inlang/recommend-sherlock": "^0.2.1", "@inlang/sdk": "^2.10.0", "commander": "11.1.0", "consola": "3.4.0", "json5": "2.2.3", "unplugin": "^2.1.2", "urlpattern-polyfill": "^10.0.0" }, "peerDependencies": { "typescript": ">=5.6" }, "optionalPeers": ["typescript"], "bin": { "paraglide-js": "bin/run.js" } }, "sha512-vI8PdPVZSnpYnpagjvm+nWSa3nMDRJKVM/2eLAtUHFrNcZZadxVdmP79r4W95+dkMLDFGEyzSSY9sFxvjdkkyQ=="], + + "@inlang/recommend-sherlock": ["@inlang/recommend-sherlock@0.2.1", "", { "dependencies": { "comment-json": "^4.2.3" } }, "sha512-ckv8HvHy/iTqaVAEKrr+gnl+p3XFNwe5D2+6w6wJk2ORV2XkcRkKOJ/XsTUJbPSiyi4PI+p+T3bqbmNx/rDUlg=="], + + "@inlang/sdk": ["@inlang/sdk@2.10.2", "", { "dependencies": { "@lix-js/sdk": "0.4.10", "@sinclair/typebox": "^0.31.17", "kysely": "^0.28.12", "sqlite-wasm-kysely": "0.3.0", "uuid": "^14.0.0" } }, "sha512-O1ki72SNK6LPagaGrvlioBb1mWKvump7cO7P85hfGZjdFTmDdn3icI0A6MvaBsB3P9KQHAjzyubnN1OslGufTw=="], + "@isaacs/cliui": ["@isaacs/cliui@8.0.2", "", { "dependencies": { "string-width": "^5.1.2", "string-width-cjs": "npm:string-width@^4.2.0", "strip-ansi": "^7.0.1", "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", "wrap-ansi": "^8.1.0", "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" } }, "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA=="], "@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.13", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA=="], @@ -701,6 +709,10 @@ "@lexical/yjs": ["@lexical/yjs@0.42.0", "", { "dependencies": { "@lexical/offset": "0.42.0", "@lexical/selection": "0.42.0", "lexical": "0.42.0" }, "peerDependencies": { "yjs": ">=13.5.22" } }, "sha512-DplzWnYhfFceGPR+UyDFpZdB287wF/vNOHFuDsBF/nGDdTezvr0Gf60opzyBEF3oXym6p3xTmGygxvO97LZ+vw=="], + "@lix-js/sdk": ["@lix-js/sdk@0.4.10", "", { "dependencies": { "@lix-js/server-protocol-schema": "0.1.1", "dedent": "1.5.1", "human-id": "^4.1.1", "js-sha256": "^0.11.0", "kysely": "^0.28.12", "sqlite-wasm-kysely": "0.3.0", "uuid": "^14.0.0" } }, "sha512-0dMInAJK/67guTG5rRZaCEhvzC5cCXENOjaePA5AqMXrCE97kaY7SRor9e2vnoGsFIiGqXKlT0MCIoZj36G0gg=="], + + "@lix-js/server-protocol-schema": ["@lix-js/server-protocol-schema@0.1.1", "", {}, "sha512-jBeALB6prAbtr5q4vTuxnRZZv1M2rKe8iNqRQhFJ4Tv7150unEa0vKyz0hs8Gl3fUGsWaNJBh3J8++fpbrpRBQ=="], + "@mistralai/mistralai": ["@mistralai/mistralai@2.2.1", "", { "dependencies": { "ws": "^8.18.0", "zod": "^3.25.0 || ^4.0.0", "zod-to-json-schema": "^3.25.0" } }, "sha512-uKU8CZmL2RzYKmplsU01hii4p3pe4HqJefpWNRWXm1Tcm0Sm4xXfwSLIy4k7ZCPlbETCGcp69E7hZs+WOJ5itQ=="], "@noble/ciphers": ["@noble/ciphers@2.2.0", "", {}, "sha512-Z6pjIZ/8IJcCGzb2S/0Px5J81yij85xASuk1teLNeg75bfT07MV3a/O2Mtn1I2se43k3lkVEcFaR10N4cgQcZA=="], @@ -1027,6 +1039,8 @@ "@smithy/util-utf8": ["@smithy/util-utf8@2.3.0", "", { "dependencies": { "@smithy/util-buffer-from": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A=="], + "@sqlite.org/sqlite-wasm": ["@sqlite.org/sqlite-wasm@3.48.0-build4", "", { "bin": { "sqlite-wasm": "bin/index.js" } }, "sha512-hI6twvUkzOmyGZhQMza1gpfqErZxXRw6JEsiVjUbo7tFanVD+8Oil0Ih3l2nGzHdxPI41zFmfUQG7GHqhciKZQ=="], + "@standard-schema/spec": ["@standard-schema/spec@1.1.0", "", {}, "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w=="], "@standard-schema/utils": ["@standard-schema/utils@0.3.0", "", {}, "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g=="], @@ -1345,6 +1359,8 @@ "array-includes": ["array-includes@3.1.9", "", { "dependencies": { "call-bind": "^1.0.8", "call-bound": "^1.0.4", "define-properties": "^1.2.1", "es-abstract": "^1.24.0", "es-object-atoms": "^1.1.1", "get-intrinsic": "^1.3.0", "is-string": "^1.1.1", "math-intrinsics": "^1.1.0" } }, "sha512-FmeCCAenzH0KH381SPT5FZmiA/TmpndpcaShhfgEN9eCVjnFBqq3l1xrI42y8+PPLI6hypzou4GXw00WHmPBLQ=="], + "array-timsort": ["array-timsort@1.0.3", "", {}, "sha512-/+3GRL7dDAGEfM6TseQk/U+mi18TU2Ms9I3UlLdUMhz2hbvGNTKdj9xniwXfUqgYhHxRx0+8UnKkvlNwVU+cWQ=="], + "array.prototype.findlast": ["array.prototype.findlast@1.2.5", "", { "dependencies": { "call-bind": "^1.0.7", "define-properties": "^1.2.1", "es-abstract": "^1.23.2", "es-errors": "^1.3.0", "es-object-atoms": "^1.0.0", "es-shim-unscopables": "^1.0.2" } }, "sha512-CVvd6FHg1Z3POpBLxO6E6zr+rSKEQ9L6rZHAaY7lLfhKsWYUBBOuMs0e9o24oopj6H+geRCX0YJ+TJLBK2eHyQ=="], "array.prototype.flat": ["array.prototype.flat@1.3.3", "", { "dependencies": { "call-bind": "^1.0.8", "define-properties": "^1.2.1", "es-abstract": "^1.23.5", "es-shim-unscopables": "^1.0.2" } }, "sha512-rwG/ja1neyLqCuGZ5YYrznA62D4mZXg0i1cIskIUKSiqF3Cje9/wXAls9B9s1Wa2fomMsIv8czB8jZcPmxCXFg=="], @@ -1483,12 +1499,16 @@ "commander": ["commander@12.1.0", "", {}, "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA=="], + "comment-json": ["comment-json@4.6.2", "", { "dependencies": { "array-timsort": "^1.0.3", "esprima": "^4.0.1" } }, "sha512-R2rze/hDX30uul4NZoIZ76ImSJLFxn/1/ZxtKC1L77y2X1k+yYu1joKbAtMA2Fg3hZrTOiw0I5mwVMo0cf250w=="], + "compress-commons": ["compress-commons@6.0.2", "", { "dependencies": { "crc-32": "^1.2.0", "crc32-stream": "^6.0.0", "is-stream": "^2.0.1", "normalize-path": "^3.0.0", "readable-stream": "^4.0.0" } }, "sha512-6FqVXeETqWPoGcfzrXb37E50NP0LXT8kAMu5ooZayhWWdgEY4lBEEcbQNXtkuKQsGduxiIcI4gOTsxTmuq/bSg=="], "concat-map": ["concat-map@0.0.1", "", {}, "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="], "confbox": ["confbox@0.2.4", "", {}, "sha512-ysOGlgTFbN2/Y6Cg3Iye8YKulHw+R2fNXHrgSmXISQdMnomY6eNDprVdW9R5xBguEqI954+S6709UyiO7B+6OQ=="], + "consola": ["consola@3.4.0", "", {}, "sha512-EiPU8G6dQG0GFHNR8ljnZFki/8a+cQwEQ+7wpxdChl02Q8HXlwEZWD5lqAF8vC2sEC3Tehr8hy7vErz88LHyUA=="], + "convert-source-map": ["convert-source-map@2.0.0", "", {}, "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg=="], "cookie-es": ["cookie-es@3.1.1", "", {}, "sha512-UaXxwISYJPTr9hwQxMFYZ7kNhSXboMXP+Z3TRX6f1/NyaGPfuNUZOWP1pUEb75B2HjfklIYLVRfWiFZJyC6Npg=="], @@ -1545,6 +1565,8 @@ "decode-named-character-reference": ["decode-named-character-reference@1.3.0", "", { "dependencies": { "character-entities": "^2.0.0" } }, "sha512-GtpQYB283KrPp6nRw50q3U9/VfOutZOe103qlN7BPP6Ad27xYnOIWv4lPzo8HCAL+mMZofJ9KEy30fq6MfaK6Q=="], + "dedent": ["dedent@1.5.1", "", { "peerDependencies": { "babel-plugin-macros": "^3.1.0" }, "optionalPeers": ["babel-plugin-macros"] }, "sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg=="], + "deep-is": ["deep-is@0.1.4", "", {}, "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ=="], "deepmerge-ts": ["deepmerge-ts@7.1.5", "", {}, "sha512-HOJkrhaYsweh+W+e74Yn7YStZOilkoPb6fycpwNLKzSPtruFs48nYis0zy5yJz1+ktUhHxoRDJ27RQAWLIJVJw=="], @@ -1649,6 +1671,8 @@ "espree": ["espree@11.2.0", "", { "dependencies": { "acorn": "^8.16.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^5.0.1" } }, "sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw=="], + "esprima": ["esprima@4.0.1", "", { "bin": { "esparse": "./bin/esparse.js", "esvalidate": "./bin/esvalidate.js" } }, "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="], + "esquery": ["esquery@1.7.0", "", { "dependencies": { "estraverse": "^5.1.0" } }, "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g=="], "esrecurse": ["esrecurse@4.3.0", "", { "dependencies": { "estraverse": "^5.2.0" } }, "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag=="], @@ -1823,6 +1847,8 @@ "https-proxy-agent": ["https-proxy-agent@7.0.6", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "4" } }, "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw=="], + "human-id": ["human-id@4.2.0", "", { "bin": { "human-id": "dist/cli.js" } }, "sha512-K3GbkIWqyvvlpfhBPlbEvD97TtqBpAYA4kt+cn2lD2x2HuohzZCibcA2nOlnJT6exqvJLggoB5nv2dNf192nEA=="], + "hyperdyperid": ["hyperdyperid@1.2.0", "", {}, "sha512-Y93lCzHYgGWdrJ66yIktxiaGULYc6oGiABxhcO5AufBeOyoIdZF7bIfLaOrbM0iGIOXQQgxxRrFEnb+Y6w1n4A=="], "iconv-lite": ["iconv-lite@0.7.2", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw=="], @@ -1935,6 +1961,8 @@ "joycon": ["joycon@3.1.1", "", {}, "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw=="], + "js-sha256": ["js-sha256@0.11.1", "", {}, "sha512-o6WSo/LUvY2uC4j7mO50a2ms7E/EAdbP0swigLV+nzHKTTaYnaLIWJ02VdXrsJX0vGedDESQnLsOekr94ryfjg=="], + "js-tokens": ["js-tokens@4.0.0", "", {}, "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="], "jsesc": ["jsesc@3.1.0", "", { "bin": { "jsesc": "bin/jsesc" } }, "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA=="], @@ -2423,6 +2451,8 @@ "split2": ["split2@4.2.0", "", {}, "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg=="], + "sqlite-wasm-kysely": ["sqlite-wasm-kysely@0.3.0", "", { "dependencies": { "@sqlite.org/sqlite-wasm": "^3.48.0-build2" }, "peerDependencies": { "kysely": "*" } }, "sha512-TzjBNv7KwRw6E3pdKdlRyZiTmUIE0UttT/Sl56MVwVARl/u5gp978KepazCJZewFUnlWHz9i3NQd4kOtP/Afdg=="], + "sqlstring": ["sqlstring@2.3.3", "", {}, "sha512-qC9iz2FlN7DQl3+wjwn3802RTyjCx7sDvfQEXchwa6CWOx07/WVfh91gBmQ9fahw8snwGEWU3xGzOt4tFyHLxg=="], "ssh-remote-port-forward": ["ssh-remote-port-forward@1.0.4", "", { "dependencies": { "@types/ssh2": "^0.5.48", "ssh2": "^1.4.0" } }, "sha512-x0LV1eVDwjf1gmG7TTnfqIzf+3VPRz7vrNIjX6oYLbeCrf/PeVY6hkT68Mg+q02qXxQhrLjB0jfgvhevoCRmLQ=="], @@ -2573,12 +2603,14 @@ "unist-util-visit-parents": ["unist-util-visit-parents@6.0.2", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-is": "^6.0.0" } }, "sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ=="], - "unplugin": ["unplugin@3.0.0", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "picomatch": "^4.0.3", "webpack-virtual-modules": "^0.6.2" } }, "sha512-0Mqk3AT2TZCXWKdcoaufeXNukv2mTrEZExeXlHIOZXdqYoHHr4n51pymnwV8x2BOVxwXbK2HLlI7usrqMpycdg=="], + "unplugin": ["unplugin@2.3.11", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "acorn": "^8.15.0", "picomatch": "^4.0.3", "webpack-virtual-modules": "^0.6.2" } }, "sha512-5uKD0nqiYVzlmCRs01Fhs2BdkEgBS3SAVP6ndrBsuK42iC2+JHyxM05Rm9G8+5mkmRtzMZGY8Ct5+mliZxU/Ww=="], "update-browserslist-db": ["update-browserslist-db@1.2.3", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w=="], "uri-js": ["uri-js@4.4.1", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg=="], + "urlpattern-polyfill": ["urlpattern-polyfill@10.1.0", "", {}, "sha512-IGjKp/o0NL3Bso1PymYURCJxMPNAf/ILOpendP9f5B6e1rTJgdgiOvgfoT8VxCAdY+Wisb9uhGaJJf3yZ2V9nw=="], + "use-callback-ref": ["use-callback-ref@1.3.3", "", { "dependencies": { "tslib": "^2.0.0" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-jQL3lRnocaFtu3V00JToYz/4QkNWswxijDaCVNZRiRTO3HQDLsdu1ZtmIUvV4yPp+rvWm5j0y0TG/S61cuijTg=="], "use-image": ["use-image@1.1.4", "", { "peerDependencies": { "react": ">=16.8.0", "react-dom": ">=16.8.0" } }, "sha512-P+swhszzHHgEb2X2yQ+vQNPCq/8Ks3hyfdXAVN133pvnvK7UK++bUaZUa5E+A3S02Mw8xOCBr9O6CLhk2fjrWA=="], @@ -2697,6 +2729,12 @@ "@grpc/grpc-js/@grpc/proto-loader": ["@grpc/proto-loader@0.8.1", "", { "dependencies": { "lodash.camelcase": "^4.3.0", "long": "^5.0.0", "protobufjs": "^7.5.5", "yargs": "^17.7.2" }, "bin": { "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js" } }, "sha512-wtF6h+DY6M3YaDBPAmvuuA6jV8Sif9MjtOI5euKFWRgCDl5PeDpPsHR9u2l6St5ceY8AZgoNDww5+HvEsXFsGg=="], + "@inlang/paraglide-js/commander": ["commander@11.1.0", "", {}, "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ=="], + + "@inlang/sdk/@sinclair/typebox": ["@sinclair/typebox@0.31.28", "", {}, "sha512-/s55Jujywdw/Jpan+vsy6JZs1z2ZTGxTmbZTPiuSL2wz9mfzA2gN1zzaqmvfi4pq+uOt7Du85fkiwv5ymW84aQ=="], + + "@inlang/sdk/uuid": ["uuid@14.0.0", "", { "bin": { "uuid": "dist-node/bin/uuid" } }, "sha512-Qo+uWgilfSmAhXCMav1uYFynlQO7fMFiMVZsQqZRMIXp0O7rR7qjkj+cPvBHLgBqi960QCoo/PH2/6ZtVqKvrg=="], + "@isaacs/cliui/string-width": ["string-width@5.1.2", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA=="], "@isaacs/cliui/strip-ansi": ["strip-ansi@7.2.0", "", { "dependencies": { "ansi-regex": "^6.2.2" } }, "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w=="], @@ -2711,6 +2749,8 @@ "@jsonjoy.com/util/@jsonjoy.com/buffers": ["@jsonjoy.com/buffers@1.2.1", "", { "peerDependencies": { "tslib": "2" } }, "sha512-12cdlDwX4RUM3QxmUbVJWqZ/mrK6dFQH4Zxq6+r1YXKXYBNgZXndx2qbCJwh3+WWkCSn67IjnlG3XYTvmvYtgA=="], + "@lix-js/sdk/uuid": ["uuid@14.0.0", "", { "bin": { "uuid": "dist-node/bin/uuid" } }, "sha512-Qo+uWgilfSmAhXCMav1uYFynlQO7fMFiMVZsQqZRMIXp0O7rR7qjkj+cPvBHLgBqi960QCoo/PH2/6ZtVqKvrg=="], + "@prisma/dev/std-env": ["std-env@3.10.0", "", {}, "sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg=="], "@prisma/engines/@prisma/get-platform": ["@prisma/get-platform@7.8.0", "", { "dependencies": { "@prisma/debug": "7.8.0" } }, "sha512-WlxgRGnolL8VH2EmkH1R/DkKNr/mVdS3G2h42IZFFZ3eUrH9OT6t73kIOSlkkrv50wG123Iq8d96ufv5LlZktw=="], @@ -2915,6 +2955,8 @@ "@tanstack/react-router/@tanstack/react-store": ["@tanstack/react-store@0.9.3", "", { "dependencies": { "@tanstack/store": "0.9.3", "use-sync-external-store": "^1.6.0" }, "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-y2iHd/N9OkoQbFJLUX1T9vbc2O9tjH0pQRgTcx1/Nz4IlwLvkgpuglXUx+mXt0g5ZDFrEeDnONPqkbfxXJKwRg=="], + "@tanstack/router-plugin/unplugin": ["unplugin@3.0.0", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "picomatch": "^4.0.3", "webpack-virtual-modules": "^0.6.2" } }, "sha512-0Mqk3AT2TZCXWKdcoaufeXNukv2mTrEZExeXlHIOZXdqYoHHr4n51pymnwV8x2BOVxwXbK2HLlI7usrqMpycdg=="], + "@temporalio/common/ms": ["ms@3.0.0-canary.1", "", {}, "sha512-kh8ARjh8rMN7Du2igDRO9QJnqCb2xYTJxyQYK7vJJS4TvLLmsbyhiKpSW+t+y26gyOyMd0riphX0GeWKU3ky5g=="], "@temporalio/proto/protobufjs": ["protobufjs@7.5.5", "", { "dependencies": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", "@protobufjs/codegen": "^2.0.4", "@protobufjs/eventemitter": "^1.1.0", "@protobufjs/fetch": "^1.1.0", "@protobufjs/float": "^1.0.2", "@protobufjs/inquire": "^1.1.0", "@protobufjs/path": "^1.1.2", "@protobufjs/pool": "^1.1.0", "@protobufjs/utf8": "^1.1.0", "@types/node": ">=13.7.0", "long": "^5.0.0" } }, "sha512-3wY1AxV+VBNW8Yypfd1yQY9pXnqTAN+KwQxL8iYm3/BjKYMNg4i0owhEe26PWDOMaIrzeeF98Lqd5NGz4omiIg=="], diff --git a/eslint.config.js b/eslint.config.js index 9e0fd0f9..33f5d070 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -75,6 +75,7 @@ export default tseslint.config( '**/packages/core/src/generated/**', '**/data/**', '**/packages/webui/components/ui/**', + '**/packages/webui/src/paraglide/**', ], }, js.configs.recommended, diff --git a/package.json b/package.json index 14774544..6e42b710 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,8 @@ ], "scripts": { "dev": "bun run --hot apps/web/src/index.ts", + "i18n:compile": "paraglide-js compile --project ./packages/webui/project.inlang --outdir ./packages/webui/src/paraglide --emit-ts-declarations", + "i18n:watch": "paraglide-js compile --project ./packages/webui/project.inlang --outdir ./packages/webui/src/paraglide --watch --emit-ts-declarations", "typecheck": "tsc --noEmit", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "test": "bun --bun vitest run", diff --git a/packages/webui/messages/en.json b/packages/webui/messages/en.json new file mode 100644 index 00000000..8a4dc29c --- /dev/null +++ b/packages/webui/messages/en.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://inlang.com/schema/inlang-message-format", + "dashboard": "Dashboard", + "notifications": "Notifications", + "uploads": "Uploads", + "language": "Language", + "personal_info": "Personal Info", + "language_settings": "Language Settings", + "select_preferred_language": "Select your preferred display language.", + "settings": "Settings" +} diff --git a/packages/webui/messages/zh.json b/packages/webui/messages/zh.json new file mode 100644 index 00000000..a2077d99 --- /dev/null +++ b/packages/webui/messages/zh.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://inlang.com/schema/inlang-message-format", + "dashboard": "控制台", + "notifications": "通知中心", + "uploads": "上传管理", + "language": "语言", + "personal_info": "个人信息", + "language_settings": "语言设置", + "select_preferred_language": "选择您首选的显示语言。", + "settings": "设置" +} diff --git a/packages/webui/package.json b/packages/webui/package.json index 36d02283..30b32a9a 100644 --- a/packages/webui/package.json +++ b/packages/webui/package.json @@ -85,7 +85,13 @@ "@shumai/dtos": "workspace:*", "ulid": "3.0.2" }, + "scripts": { + "i18n:compile": "paraglide-js compile --project ./project.inlang --outdir ./src/paraglide --emit-ts-declarations", + "i18n:watch": "paraglide-js compile --project ./project.inlang --outdir ./src/paraglide --watch --emit-ts-declarations" + }, "devDependencies": { + "typescript": "6.0.3", + "@inlang/paraglide-js": "^2.20.0", "@tailwindcss/postcss": "4.3.0", "@tailwindcss/vite": "4.3.0", "@tanstack/router-cli": "1.167.13", diff --git a/packages/webui/project.inlang/settings.json b/packages/webui/project.inlang/settings.json new file mode 100644 index 00000000..92243f17 --- /dev/null +++ b/packages/webui/project.inlang/settings.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://inlang.com/schema/project-settings", + "baseLocale": "en", + "locales": ["en", "zh"], + "modules": [ + "https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@4/dist/index.js", + "https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@2/dist/index.js" + ], + "plugin.inlang.messageFormat": { + "pathPattern": "./messages/{locale}.json" + } +} diff --git a/packages/webui/routes/__root.tsx b/packages/webui/routes/__root.tsx index af088cb5..f68f77af 100644 --- a/packages/webui/routes/__root.tsx +++ b/packages/webui/routes/__root.tsx @@ -16,6 +16,9 @@ import { useRouterState, } from '@tanstack/react-router' import { useEffect } from 'react' +import { getLocale, setLocale } from '@/ui/src/paraglide/runtime.js' +import { m } from '@/ui/src/paraglide/messages.js' +import { useUserMetadataStore } from '@/ui/stores/user-metadata' function RootComponent() { const user = useAuthStore((state) => state.user) @@ -75,7 +78,7 @@ function RootComponent() { } - label="Dashboard" + label={m.dashboard()} onItemClick={() => { if (storedTeamId) { navigate({ @@ -85,7 +88,7 @@ function RootComponent() { } }} /> - } label="Notifications" badge={badge}> + } label={m.notifications()} badge={badge}> 0 ? 'text-blue-500' : ''} /> } - label="Uploads" + label={m.uploads()} > @@ -117,5 +120,27 @@ interface MyRouterContext { } export const Route = createRootRouteWithContext()({ + beforeLoad: async () => { + if (typeof window !== 'undefined') { + const pathname = window.location.pathname + const teamIdMatch = pathname.match(/^\/teams\/([^/]+)/) + const teamId = teamIdMatch ? teamIdMatch[1] : null + + if (teamId) { + const { fetchMetadata, getMetadata } = useUserMetadataStore.getState() + try { + await fetchMetadata(teamId) + const savedLocale = getMetadata('locale') + if ((savedLocale === 'en' || savedLocale === 'zh') && savedLocale !== getLocale()) { + setLocale(savedLocale, { reload: false }) + } + } catch (e) { + console.error('Failed to load user locale metadata:', e) + } + } + + document.documentElement.setAttribute('lang', getLocale()) + } + }, component: RootComponent, }) diff --git a/packages/webui/routes/teams/$teamId/settings.tsx b/packages/webui/routes/teams/$teamId/settings.tsx index eeacf912..dd9c96dd 100644 --- a/packages/webui/routes/teams/$teamId/settings.tsx +++ b/packages/webui/routes/teams/$teamId/settings.tsx @@ -17,6 +17,16 @@ import { Input } from '@/ui/components/ui/input' import { Button } from '@/ui/components/ui/button' import { AvatarCropDialog } from '@/ui/components/settings/AvatarCropDialog' import { toast } from 'sonner' +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from '@/ui/components/ui/select' +import { useUserMetadataStore } from '@/ui/stores/user-metadata' +import { getLocale, setLocale } from '@/ui/src/paraglide/runtime.js' +import { m } from '@/ui/src/paraglide/messages.js' type SettingsTab = | 'general' @@ -38,6 +48,22 @@ function TeamSettingsPage() { const fileInputRef = useRef(null) const [isUpdatingProfile, setIsUpdatingProfile] = useState(false) + const { setMetadata, getMetadata } = useUserMetadataStore() + const currentLocale = getMetadata('locale') || getLocale() + + const handleLanguageChange = async (newLocale: string) => { + if (newLocale === 'en' || newLocale === 'zh') { + try { + await setMetadata(teamId, 'locale', newLocale) + setLocale(newLocale) + toast.success('Language updated successfully') + } catch (e) { + console.error(e) + toast.error('Failed to update language') + } + } + } + const { data: settings, isLoading: isSettingsLoading, @@ -492,6 +518,26 @@ function TeamSettingsPage() { + + + {m.language_settings()} + {m.select_preferred_language()} + + +
+ +
+
+
+ setIsCropOpen(false)} From b6ff60f8b8cf24487ea0b2cf40d8f91711d54eee Mon Sep 17 00:00:00 2001 From: yiling Date: Fri, 26 Jun 2026 10:44:49 +0800 Subject: [PATCH 02/25] docs: add paraglide-js i18n rules and usage guide to AGENTS.md --- AGENTS.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index d8645e43..42232d0d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -408,3 +408,51 @@ We use **pino** for logging. Always use **structured logging** to ensure logs ar logger.info({ userId: user.id, projectId }, 'Project deleted successfully') ``` - **Levels**: Use appropriate levels: `debug`, `info`, `warn`, `error`. + +## Internationalization (i18n) + +All user-facing text in the WebUI (`packages/webui`) MUST be internationalized using **Paraglide JS**. Hardcoded text in UI components is strictly forbidden. + +### Message Definition + +1. Define your English message strings in [packages/webui/messages/en.json](file:///Users/yiling/Projects/shumai/packages/webui/messages/en.json). +2. Define the corresponding Chinese translation strings in [packages/webui/messages/zh.json](file:///Users/yiling/Projects/shumai/packages/webui/messages/zh.json). +3. Keys should use `snake_case`. + +Example (`en.json`): + +```json +{ + "my_key": "My English Text" +} +``` + +### Compilation + +When you add or update translation keys, you must compile them to regenerate the type-safe functions: + +```bash +# Compile once (generates type-safe TS/JS functions on disk) +bun run i18n:compile + +# Watch and recompile on change during development +bun run i18n:watch +``` + +### Usage in Components + +Import the compiled message namespace `m` and call it as a function: + +```typescript +import { m } from '@/ui/src/paraglide/messages.js' + +export function MyComponent() { + return ( +
+

{m.my_key()}

+
+ ) +} +``` + +Always use the absolute workspace alias path `@/ui/src/paraglide/messages.js` (or `runtime.js` for runtime features) when importing Paraglide outputs. From 6e2e5bdbc28a97daad493e78a89e2e2a07a016a9 Mon Sep 17 00:00:00 2001 From: yiling Date: Fri, 26 Jun 2026 11:18:09 +0800 Subject: [PATCH 03/25] refactor(webui): extract shared resolveTeamIdFromPath function for root route and component --- packages/webui/routes/__root.tsx | 40 ++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/packages/webui/routes/__root.tsx b/packages/webui/routes/__root.tsx index f68f77af..75cf9236 100644 --- a/packages/webui/routes/__root.tsx +++ b/packages/webui/routes/__root.tsx @@ -20,6 +20,21 @@ import { getLocale, setLocale } from '@/ui/src/paraglide/runtime.js' import { m } from '@/ui/src/paraglide/messages.js' import { useUserMetadataStore } from '@/ui/stores/user-metadata' +async function resolveTeamIdFromPath(pathname: string): Promise { + const teamIdMatch = pathname.match(/^\/teams\/([^/]+)/) + const teamId = teamIdMatch ? teamIdMatch[1] : null + if (teamId) return teamId + + const projectIdMatch = pathname.match(/^\/projects\/([^/]+)/) + const projectId = projectIdMatch ? projectIdMatch[1] : null + if (projectId) { + const { ensureTeamIdForProject } = useTeamContextStore.getState() + return await ensureTeamIdForProject(projectId) + } + + return null +} + function RootComponent() { const user = useAuthStore((state) => state.user) const { uploading } = useUploadStore() @@ -32,23 +47,15 @@ function RootComponent() { return } - // Extract teamId from pathname if possible - // Matches /teams/:teamId - const teamIdMatch = pathname.match(/^\/teams\/([^/]+)/) - const teamId = teamIdMatch ? teamIdMatch[1] : null - - const projectIdMatch = pathname.match(/^\/projects\/([^/]+)/) - const projectId = projectIdMatch ? projectIdMatch[1] : null - - const { teamId: storedTeamId, setTeamId, ensureTeamIdForProject } = useTeamContextStore() + const { teamId: storedTeamId, setTeamId } = useTeamContextStore() useEffect(() => { - if (teamId) { - setTeamId(teamId) - } else if (projectId) { - ensureTeamIdForProject(projectId) - } - }, [teamId, projectId, setTeamId, ensureTeamIdForProject]) + resolveTeamIdFromPath(pathname).then((resolvedTeamId) => { + if (resolvedTeamId && resolvedTeamId !== storedTeamId) { + setTeamId(resolvedTeamId) + } + }) + }, [pathname, storedTeamId, setTeamId]) const { data: me } = useQuery({ queryKey: ['teams', storedTeamId, 'me'], @@ -123,8 +130,7 @@ export const Route = createRootRouteWithContext()({ beforeLoad: async () => { if (typeof window !== 'undefined') { const pathname = window.location.pathname - const teamIdMatch = pathname.match(/^\/teams\/([^/]+)/) - const teamId = teamIdMatch ? teamIdMatch[1] : null + const teamId = await resolveTeamIdFromPath(pathname) if (teamId) { const { fetchMetadata, getMetadata } = useUserMetadataStore.getState() From 4fd27ab147e23bbd2b86eee6c2f5e26dae81223f Mon Sep 17 00:00:00 2001 From: yiling Date: Fri, 26 Jun 2026 11:24:32 +0800 Subject: [PATCH 04/25] feat(webui): add i18n text keys and translate one static text element per page for verification --- .../webui/components/file-browser/file-browser.tsx | 3 ++- packages/webui/components/file-system-manager.tsx | 3 ++- packages/webui/components/public-share-manager.tsx | 3 ++- .../webui/components/share-settings-sidebar.tsx | 3 ++- packages/webui/components/team-selector.tsx | 3 ++- packages/webui/messages/en.json | 13 ++++++++++++- packages/webui/messages/zh.json | 13 ++++++++++++- packages/webui/routes/login.tsx | 3 ++- .../projects/$projectId/collections/index.tsx | 3 ++- .../routes/projects/$projectId/files/$fileId.tsx | 3 ++- .../routes/projects/$projectId/shares/index.tsx | 3 ++- packages/webui/routes/signup.tsx | 3 ++- packages/webui/routes/teams/$teamId/index.tsx | 3 ++- packages/webui/routes/teams/$teamId/settings.tsx | 2 +- 14 files changed, 47 insertions(+), 14 deletions(-) diff --git a/packages/webui/components/file-browser/file-browser.tsx b/packages/webui/components/file-browser/file-browser.tsx index 2793c2c0..e25fceab 100644 --- a/packages/webui/components/file-browser/file-browser.tsx +++ b/packages/webui/components/file-browser/file-browser.tsx @@ -1,6 +1,7 @@ 'use client' import { client } from '@/ui/api/client' import type { InferRequestType, InferResponseType } from 'hono/client' +import { m } from '@/ui/src/paraglide/messages.js' import { usePermissions } from '@/ui/hooks/use-permissions' import { getAllFilesFromEntries } from '@/ui/lib/dnd-utils' @@ -972,7 +973,7 @@ export function FileBrowser({
- Items are automatically deleted after 30 days. + {m.recently_deleted_notice()}
{canAdmin && (
diff --git a/packages/webui/components/public-share-manager.tsx b/packages/webui/components/public-share-manager.tsx index 7a1295f9..0537d044 100644 --- a/packages/webui/components/public-share-manager.tsx +++ b/packages/webui/components/public-share-manager.tsx @@ -2,6 +2,7 @@ import { client } from '@/ui/api/client' import { useTopNavStore } from '@/ui/stores/top-nav' +import { m } from '@/ui/src/paraglide/messages.js' import { useInfiniteQuery, useQuery } from '@tanstack/react-query' import { useEffect, useState, useMemo, useRef } from 'react' import { TopNav } from './top-nav' @@ -386,7 +387,7 @@ export function PublicShareManager({
- Password Protected + {m.password_protected()}
diff --git a/packages/webui/components/share-settings-sidebar.tsx b/packages/webui/components/share-settings-sidebar.tsx index 6e6d4ac0..27ff7b6b 100644 --- a/packages/webui/components/share-settings-sidebar.tsx +++ b/packages/webui/components/share-settings-sidebar.tsx @@ -1,5 +1,6 @@ import { ShareLinkInfo, UpdateShareLinkRequest } from '@shumai/dtos' import { type FieldInfo as MetadataFieldInfo } from '@shumai/dtos' +import { m } from '@/ui/src/paraglide/messages.js' import { client } from '@/ui/api/client' import { Button } from '@/ui/components/ui/button' import { Input } from '@/ui/components/ui/input' @@ -113,7 +114,7 @@ export function ShareSettingsSidebar({
-

Link Visibility

+

{m.link_visibility()}

updateShare({ isDisabled: !checked })} diff --git a/packages/webui/components/team-selector.tsx b/packages/webui/components/team-selector.tsx index 70639d8d..8aa10804 100644 --- a/packages/webui/components/team-selector.tsx +++ b/packages/webui/components/team-selector.tsx @@ -8,6 +8,7 @@ import { } from '@/ui/components/ui/dialog' import { useQuery } from '@tanstack/react-query' import { useNavigate } from '@tanstack/react-router' +import { m } from '@/ui/src/paraglide/messages.js' export function TeamSelector() { const navigate = useNavigate() @@ -37,7 +38,7 @@ export function TeamSelector() { - Select a Team + {m.select_a_team()} You are a member of multiple teams. Please select one to continue. diff --git a/packages/webui/messages/en.json b/packages/webui/messages/en.json index 8a4dc29c..69ce95b1 100644 --- a/packages/webui/messages/en.json +++ b/packages/webui/messages/en.json @@ -7,5 +7,16 @@ "personal_info": "Personal Info", "language_settings": "Language Settings", "select_preferred_language": "Select your preferred display language.", - "settings": "Settings" + "settings": "Settings", + "welcome_back": "Welcome Back", + "create_account": "Create Account", + "select_a_team": "Select a Team", + "projects": "Projects", + "select_asset_to_view_details": "Select an asset to view details", + "all_collections": "All Collections", + "file_not_found": "File not found.", + "recently_deleted_notice": "Items are automatically deleted after 30 days.", + "all_share_links": "All Share Links", + "link_visibility": "Link Visibility", + "password_protected": "Password Protected" } diff --git a/packages/webui/messages/zh.json b/packages/webui/messages/zh.json index a2077d99..2a0e69b1 100644 --- a/packages/webui/messages/zh.json +++ b/packages/webui/messages/zh.json @@ -7,5 +7,16 @@ "personal_info": "个人信息", "language_settings": "语言设置", "select_preferred_language": "选择您首选的显示语言。", - "settings": "设置" + "settings": "设置", + "welcome_back": "欢迎回来", + "create_account": "创建账户", + "select_a_team": "选择团队", + "projects": "项目", + "select_asset_to_view_details": "选择资产查看详情", + "all_collections": "所有收藏", + "file_not_found": "文件未找到。", + "recently_deleted_notice": "项目将在 30 天后自动删除。", + "all_share_links": "所有分享链接", + "link_visibility": "链接可见性", + "password_protected": "密码保护" } diff --git a/packages/webui/routes/login.tsx b/packages/webui/routes/login.tsx index 38ecedcb..b77c292d 100644 --- a/packages/webui/routes/login.tsx +++ b/packages/webui/routes/login.tsx @@ -13,6 +13,7 @@ import { ArrowRight, Loader2, Lock, LogIn, Mail } from 'lucide-react' import { useEffect, useState } from 'react' import { useForm } from 'react-hook-form' import { z } from 'zod' +import { m } from '@/ui/src/paraglide/messages.js' const loginSchema = z.object({ email: z.string().email('Invalid email address'), @@ -83,7 +84,7 @@ function LoginPage() {

- Welcome Back + {m.welcome_back()}

Enter your credentials to access your account. diff --git a/packages/webui/routes/projects/$projectId/collections/index.tsx b/packages/webui/routes/projects/$projectId/collections/index.tsx index c41fea8c..e0645e28 100644 --- a/packages/webui/routes/projects/$projectId/collections/index.tsx +++ b/packages/webui/routes/projects/$projectId/collections/index.tsx @@ -1,6 +1,7 @@ import { client } from '@/ui/api/client' import { FolderTree } from '@/ui/components/folder-tree' import { ResizeHandle } from '@/ui/components/resize-handle' +import { m } from '@/ui/src/paraglide/messages.js' import { Table, TableBody, @@ -135,7 +136,7 @@ function CollectionsPage() {

-

All Collections

+

{m.all_collections()}

diff --git a/packages/webui/routes/projects/$projectId/files/$fileId.tsx b/packages/webui/routes/projects/$projectId/files/$fileId.tsx index 4673bce9..8be58a37 100644 --- a/packages/webui/routes/projects/$projectId/files/$fileId.tsx +++ b/packages/webui/routes/projects/$projectId/files/$fileId.tsx @@ -1,6 +1,7 @@ import { client } from '@/ui/api/client' import { FileViewer } from '@/ui/components/file-viewer' import { FileViewerLeftSidebar } from '@/ui/components/file-viewer-left-sidebar' +import { m } from '@/ui/src/paraglide/messages.js' import { FileViewerRightSidebar } from '@/ui/components/file-viewer-right-sidebar' import { ResizeHandle } from '@/ui/components/resize-handle' import { FileDetailSkeleton } from '@/ui/components/loading-skeletons' @@ -268,7 +269,7 @@ function FileViewPage() { } if (isError || !fileData || !projectInfo || !teamId) { - return
File not found.
+ return
{m.file_not_found()}
} const handleSaveField = (fieldId: string, value: unknown) => { diff --git a/packages/webui/routes/projects/$projectId/shares/index.tsx b/packages/webui/routes/projects/$projectId/shares/index.tsx index b2f83e29..1ffd5db9 100644 --- a/packages/webui/routes/projects/$projectId/shares/index.tsx +++ b/packages/webui/routes/projects/$projectId/shares/index.tsx @@ -1,6 +1,7 @@ import { client } from '@/ui/api/client' import { FolderTree } from '@/ui/components/folder-tree' import { ResizeHandle } from '@/ui/components/resize-handle' +import { m } from '@/ui/src/paraglide/messages.js' import { Switch } from '@/ui/components/ui/switch' import { Button } from '@/ui/components/ui/button' import { @@ -165,7 +166,7 @@ function SharesPage() {
-

All Share Links

+

{m.all_share_links()}

diff --git a/packages/webui/routes/signup.tsx b/packages/webui/routes/signup.tsx index cf3b8f71..b5a260f9 100644 --- a/packages/webui/routes/signup.tsx +++ b/packages/webui/routes/signup.tsx @@ -14,6 +14,7 @@ import { signUp } from '@/ui/lib/auth-client' import { useState } from 'react' import { ShumaiLogo } from '@/ui/components/ui/icons' import { AuthLayout } from '@/ui/components/auth-layout' +import { m } from '@/ui/src/paraglide/messages.js' const signupSchema = z.object({ email: z.string().email('Invalid email address'), @@ -139,7 +140,7 @@ function SignupPage() {

- Create Account + {m.create_account()}

Start building and organizing your space. diff --git a/packages/webui/routes/teams/$teamId/index.tsx b/packages/webui/routes/teams/$teamId/index.tsx index 7b1795b8..8675f626 100644 --- a/packages/webui/routes/teams/$teamId/index.tsx +++ b/packages/webui/routes/teams/$teamId/index.tsx @@ -4,6 +4,7 @@ import { client } from '@/ui/api/client' import { MembersDialog } from '@/ui/components/members-dialog' import { ProjectDialog } from '@/ui/components/project-dialog' import { SortDropdown } from '@/ui/components/sort-dropdown' +import { m } from '@/ui/src/paraglide/messages.js' import { AlertDialog, AlertDialogAction, @@ -256,7 +257,7 @@ function TeamPage() { return (

-

Projects

+

{m.projects()}

diff --git a/packages/webui/components/settings/AgentFormDialog.tsx b/packages/webui/components/settings/AgentFormDialog.tsx index 5bb06243..b6729993 100644 --- a/packages/webui/components/settings/AgentFormDialog.tsx +++ b/packages/webui/components/settings/AgentFormDialog.tsx @@ -23,6 +23,7 @@ import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query' import { useForm, useStore } from '@tanstack/react-form' import { Loader2, Puzzle } from 'lucide-react' import { useEffect, useMemo } from 'react' +import { m } from '@/ui/paraglide/messages.js' import { toast } from 'sonner' import { AgentInfo, AgentType, ThinkingLevel, thinkingLevelSchema } from '@shumai/dtos' import { Textarea } from '@/ui/components/ui/textarea' @@ -41,7 +42,7 @@ interface AgentFormDialogProps { } const agentFormSchema = z.object({ - name: z.string().min(1, 'Name is required'), + name: z.string().min(1, m.name_is_required()), type: z.enum(['chat', 'autofill', 'embedding']), avatar: z.string().optional(), providerId: z.string().optional(), @@ -98,14 +99,14 @@ export function AgentFormDialog({ if (!data.providerId) { ctx.addIssue({ code: z.ZodIssueCode.custom, - message: 'Provider is required', + message: m.provider_is_required(), path: ['providerId'], }) } if (!data.modelId) { ctx.addIssue({ code: z.ZodIssueCode.custom, - message: 'Model is required', + message: m.model_is_required(), path: ['modelId'], }) } @@ -167,10 +168,10 @@ export function AgentFormDialog({ onSuccess: () => { onClose() queryClient.invalidateQueries({ queryKey: ['agents', teamId] }) - toast.success('Agent created successfully') + toast.success(m.agent_created_successfully()) }, onError: (error) => { - toast.error(`Error: ${error.message}`) + toast.error(m.error_message({ message: error.message })) }, }) @@ -186,10 +187,10 @@ export function AgentFormDialog({ onSuccess: () => { onClose() queryClient.invalidateQueries({ queryKey: ['agents', teamId] }) - toast.success('Agent updated successfully') + toast.success(m.agent_updated_successfully()) }, onError: (error) => { - toast.error(`Error: ${error.message}`) + toast.error(m.error_message({ message: error.message })) }, }) @@ -217,9 +218,7 @@ export function AgentFormDialog({ {title} - - Configure your AI agent's personality and capabilities. - + {m.configure_agent_description()} - Agent Name + {m.agent_name()} field.handleChange(e.target.value)} - placeholder="e.g., Support Assistant" + placeholder={m.agent_name_placeholder()} aria-invalid={isInvalid} /> {isInvalid && } @@ -257,7 +256,7 @@ export function AgentFormDialog({ name="type" children={(field) => ( - Agent Type + {m.agent_type()} @@ -280,7 +279,7 @@ export function AgentFormDialog({ name="avatar" children={(field) => ( - Agent Avatar + {m.agent_avatar()}
{AVAILABLE_AVATARS.map((avatarPath) => { const isSelected = field.state.value === avatarPath @@ -299,7 +298,7 @@ export function AgentFormDialog({ Preset Avatar Option ) @@ -312,7 +311,7 @@ export function AgentFormDialog({ Current Custom Avatar )} @@ -332,7 +331,7 @@ export function AgentFormDialog({ !!field.state.meta.errors.length && field.state.meta.isTouched return ( - Provider + {m.provider()} - + {models?.map((m) => ( @@ -397,26 +396,34 @@ export function AgentFormDialog({
( - - Thinking Level - - - )} + children={(field) => { + const thinkingLabels: Record = { + off: m.thinking_disable(), + low: m.thinking_low(), + medium: m.thinking_medium(), + high: m.thinking_high(), + } + return ( + + {m.thinking_level()} + + + ) + }} />
@@ -425,12 +432,12 @@ export function AgentFormDialog({ name="soul" children={(field) => ( - Agent Soul (Personality) + {m.agent_soul()}