feat(webui): add Brazilian Portuguese (pt-BR) locale
Translate the WebUI common.json to pt-BR, register the locale in config.ts (with normalizeLocale rules for "pt", "pt-BR", "pt-PT", ...) and index.ts resources, and add a Brazilian Portuguese overview assertion in i18n.test.tsx. Notes: - Generic "pt" and any "pt-*" variant resolve to pt-BR. A future pt-PT locale can be added without affecting existing users. - Universally borrowed technical terms (nanobot, BYOK, MCP, JSON, URL, Web, Apps when used as a product name, Skills) are kept in English, matching the pattern used by es/fr/ja/ko/vi/id. - Empty-thread greetings, quick-action prompts, and slash command descriptions are translated; quick-action prompts are intentionally phrased so the agent still receives a clear task spec. Verified with bun run test (536 passing), bun run lint (clean), and bun run build (7.18s).
This commit is contained in:
committed by
chengyongru
parent
4a3818e03c
commit
1e7518a207
@@ -8,6 +8,7 @@ export const supportedLocales = [
|
||||
{ code: "ja", label: "Japanese", nativeLabel: "日本語" },
|
||||
{ code: "ko", label: "Korean", nativeLabel: "한국어" },
|
||||
{ code: "es", label: "Spanish", nativeLabel: "Español" },
|
||||
{ code: "pt-BR", label: "Portuguese (Brazil)", nativeLabel: "Português (Brasil)" },
|
||||
{ code: "vi", label: "Vietnamese", nativeLabel: "Tiếng Việt" },
|
||||
{ code: "id", label: "Indonesian", nativeLabel: "Bahasa Indonesia" },
|
||||
] as const;
|
||||
@@ -39,6 +40,9 @@ export function normalizeLocale(
|
||||
) {
|
||||
return "zh-TW";
|
||||
}
|
||||
if (lower === "pt" || lower.startsWith("pt-")) {
|
||||
return "pt-BR";
|
||||
}
|
||||
|
||||
const base = lower.split("-")[0];
|
||||
const baseMatch = supportedLocales.find(
|
||||
|
||||
@@ -19,6 +19,7 @@ import frCommon from "./locales/fr/common.json";
|
||||
import jaCommon from "./locales/ja/common.json";
|
||||
import koCommon from "./locales/ko/common.json";
|
||||
import esCommon from "./locales/es/common.json";
|
||||
import ptBRCommon from "./locales/pt-BR/common.json";
|
||||
import viCommon from "./locales/vi/common.json";
|
||||
import idCommon from "./locales/id/common.json";
|
||||
|
||||
@@ -30,6 +31,7 @@ export const resources = {
|
||||
ja: { common: jaCommon },
|
||||
ko: { common: koCommon },
|
||||
es: { common: esCommon },
|
||||
"pt-BR": { common: ptBRCommon },
|
||||
vi: { common: viCommon },
|
||||
id: { common: idCommon },
|
||||
} as const;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -311,4 +311,18 @@ describe("webui i18n", () => {
|
||||
expect(settings.overview.webSearch).toBe("网页搜索");
|
||||
expect(settings.overview.workspace).toBe("工作区");
|
||||
});
|
||||
|
||||
it("keeps Brazilian Portuguese settings overview copy localized", () => {
|
||||
const settings = resources["pt-BR"].common.settings;
|
||||
const sidebar = resources["pt-BR"].common.sidebar;
|
||||
const chat = resources["pt-BR"].common.chat;
|
||||
|
||||
expect(sidebar.settings).toBe("Configurações");
|
||||
expect(chat.newChat).toBe("Nova conversa");
|
||||
expect(settings.nav.browser).toBe("Web");
|
||||
expect(settings.sections.webSearch).toBe("Busca na web");
|
||||
expect(settings.byok.tabs.webSearch).toBe("Busca na web");
|
||||
expect(settings.overview.webSearch).toBe("Busca na web");
|
||||
expect(settings.overview.workspace).toBe("Workspace");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user