Complete client UI i18n migration

Adds client-side i18n support, language settings, translated UI copy, and locale parity coverage.
This commit is contained in:
chyendongnhanh338
2026-06-11 14:15:35 +08:00
committed by GitHub
parent 41cf070fd8
commit 08ebe5e7e1
199 changed files with 16426 additions and 1821 deletions
+29 -1
View File
@@ -1,5 +1,6 @@
import { describe, expect, it } from "vitest";
import { afterEach, describe, expect, it } from "vitest";
import { CheckoutPrStatusSchema } from "@getpaseo/protocol/messages";
import { i18n } from "@/i18n/i18next";
import { buildGitActions, type BuildGitActionsInput } from "./policy";
@@ -132,6 +133,10 @@ function createInput(overrides: Partial<BuildGitActionsInput> = {}): BuildGitAct
}
describe("git-actions-policy", () => {
afterEach(async () => {
await i18n.changeLanguage("en");
});
it("shows only remote sync actions on the base branch", () => {
const actions = buildGitActions(createInput({ hasRemote: true }));
@@ -599,6 +604,29 @@ describe("git-actions-policy", () => {
expect(action).toMatchObject({ label: "Merge locally" });
});
it("uses the active language for policy-owned action labels and unavailable messages", async () => {
await i18n.changeLanguage("zh-CN");
const actions = buildGitActions(
createInput({
hasRemote: true,
behindOfOrigin: 1,
isOnBaseBranch: false,
aheadCount: 0,
}),
);
expect(actions.primary).toMatchObject({
id: "pull",
label: "Pull",
pendingLabel: "正在 pull...",
successLabel: "已 pull",
});
expect(actions.secondary.find((entry) => entry.id === "pr")).toMatchObject({
label: "创建 PR",
unavailableMessage: "无法创建 PR,因为此分支还没有新的 commit",
});
});
it.each([
["draft", { pullRequestIsDraft: true }],
["merged", { pullRequestIsMerged: true }],