refactor: remove LocaleSwitcher component and update locale handling

- Removed LocaleSwitcher from NavUser, SiteHeader, and WorkbenchHeader components.
- Updated tests to reflect the removal of LocaleSwitcher.
- Changed default locale from "en-US" to "zh-CN" in i18n configuration.
- Refactored locale resolution logic to read configured locale without relying on browser language detection.
- Updated AgentDesk SDK to support language configuration from public API.
- Cleaned up unused auth options fetching in the auth API.
This commit is contained in:
mlogclub
2026-06-26 14:46:01 +08:00
parent 12d188fc7e
commit f827a7471c
32 changed files with 215 additions and 268 deletions
+17 -9
View File
@@ -50,14 +50,21 @@ async function loadSdk(config) {
const sandbox = {
URL,
console,
fetch: async () => ({
json: async () => ({
success: true,
data: {
title: "\u5728\u7ebf\u5ba2\u670d",
themeColor: "#2563eb",
},
}),
fetch: async (url) => ({
json: async () =>
String(url).endsWith("/api/config")
? {
success: true,
data: {
language: "en-US",
},
}
: {
success: true,
data: {
themeColor: "#2563eb",
},
},
}),
document: {
body,
@@ -95,7 +102,7 @@ async function loadSdk(config) {
return sandbox
}
async function flushPromises(count = 5) {
async function flushPromises(count = 10) {
for (let i = 0; i < count; i += 1) {
await Promise.resolve()
}
@@ -133,6 +140,7 @@ test("launcher click creates chat iframe with a freshly resolved userToken", asy
)
assert.ok(launcher)
assert.equal(launcher.children.at(-1)?.textContent, "Support")
launcher.click()
await flushPromises()