Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/i18n/locales/zh/dataLoading.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"rowLimit": "行数限制",
"loadSelected": "加载选中的表",
"loadedCount": "✓ 已加载 {{count}} 张表",
"loadedCount_plural": "✓ 已加载 {{count}} 张表",
"preview": "预览",
"hidePreview": "收起",
"previewing": "正在预览...",
Expand Down
30 changes: 30 additions & 0 deletions tests/frontend/unit/app/i18nLocales.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { describe, expect, it } from "vitest";

import en from "../../../../src/i18n/locales/en";
import zh from "../../../../src/i18n/locales/zh";

type TranslationValue = string | Record<string, TranslationValue>;
type TranslationMap = Record<string, TranslationValue>;

function collectKeys(value: TranslationMap, prefix = ""): Set<string> {
const keys = new Set<string>();

for (const [key, child] of Object.entries(value)) {
const nextPrefix = prefix ? `${prefix}.${key}` : key;
if (typeof child === "string") {
keys.add(nextPrefix);
} else {
for (const childKey of collectKeys(child, nextPrefix)) {
keys.add(childKey);
}
}
}

return keys;
}

describe("i18n locale bundles", () => {
it("keeps Simplified Chinese translation keys aligned with English", () => {
expect(collectKeys(zh)).toEqual(collectKeys(en));
});
});