Add manually authored Simplified Chinese viewer and tutorial catalog
This commit is contained in:
parent
0c59dab3d1
commit
a64194deb6
5 changed files with 1335 additions and 3 deletions
|
|
@ -11,6 +11,7 @@ export const languages = {
|
|||
"pt-BR": "Português (Brasil)",
|
||||
ko: "한국어",
|
||||
"zh-TW": "繁體中文",
|
||||
"zh-CN": "简体中文",
|
||||
vi: "Tiếng Việt",
|
||||
it: "Italiano",
|
||||
nl: "Nederlands",
|
||||
|
|
@ -32,6 +33,7 @@ export function resolveLocale(value) {
|
|||
if (/^zh-(?:tw|hk|mo|hant)(?:-|$)/.test(tag)) {
|
||||
return "zh-TW";
|
||||
}
|
||||
if (/^zh(?:-|$)/.test(tag)) return "zh-CN";
|
||||
return Object.keys(languages).find((locale) => locale === tag.split("-")[0]) ?? "en";
|
||||
}
|
||||
|
||||
|
|
|
|||
1292
packages/viewer/src/localization/zh-CN.json
Normal file
1292
packages/viewer/src/localization/zh-CN.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -7,7 +7,25 @@ if (!directory) {
|
|||
}
|
||||
const source = JSON.parse(await readFile(join(directory, "en.json"), "utf8"));
|
||||
const placeholders = (text) => [...text.matchAll(/\{\w+\}/g)].map((match) => match[0]).sort();
|
||||
const locales = ["en", "de", "fr", "pl", "ro", "el", "hi", "ru", "da", "pt-BR", "ko", "zh-TW", "vi", "it", "nl", "fa"];
|
||||
const locales = [
|
||||
"en",
|
||||
"de",
|
||||
"fr",
|
||||
"pl",
|
||||
"ro",
|
||||
"el",
|
||||
"hi",
|
||||
"ru",
|
||||
"da",
|
||||
"pt-BR",
|
||||
"ko",
|
||||
"zh-TW",
|
||||
"zh-CN",
|
||||
"vi",
|
||||
"it",
|
||||
"nl",
|
||||
"fa",
|
||||
];
|
||||
for (const locale of locales) {
|
||||
const catalog = JSON.parse(await readFile(join(directory, `${locale}.json`), "utf8"));
|
||||
assert.deepEqual(Object.keys(catalog).sort(), Object.keys(source).sort(), `${locale}: missing or extra strings`);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,11 @@ test("regional language preferences select supported catalogues", () => {
|
|||
assert.equal(resolveLocale("nl-BE"), "nl");
|
||||
assert.equal(resolveLocale("pt-PT"), "pt-BR");
|
||||
assert.equal(resolveLocale("zh-Hant-TW"), "zh-TW");
|
||||
assert.equal(resolveLocale("zh-CN"), "en");
|
||||
assert.equal(resolveLocale("zh-CN"), "zh-CN");
|
||||
assert.equal(resolveLocale("zh"), "zh-CN");
|
||||
assert.equal(resolveLocale("ZH_hans_SG"), "zh-CN");
|
||||
assert.equal(resolveLocale("zh-SG"), "zh-CN");
|
||||
assert.equal(resolveLocale("zh-HK"), "zh-TW");
|
||||
assert.equal(resolveLocale(undefined), "en");
|
||||
});
|
||||
test("dynamic values are reordered while player names stay unchanged", () => {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,23 @@ const server = createServer(async (req, res) => {
|
|||
await new Promise((r) => server.listen(0, "127.0.0.1", r));
|
||||
const browser = await chromium.launch({ headless: true, executablePath: process.env.FUJI_CHROMIUM_EXECUTABLE });
|
||||
try {
|
||||
for (const locale of ["fr", "de", "nl", "da", "it", "ro", "pt-BR", "pl", "ru", "el", "hi", "ko", "zh-TW", "vi"]) {
|
||||
for (const locale of [
|
||||
"fr",
|
||||
"de",
|
||||
"nl",
|
||||
"da",
|
||||
"it",
|
||||
"ro",
|
||||
"pt-BR",
|
||||
"pl",
|
||||
"ru",
|
||||
"el",
|
||||
"hi",
|
||||
"ko",
|
||||
"zh-TW",
|
||||
"zh-CN",
|
||||
"vi",
|
||||
]) {
|
||||
const page = await browser.newPage({ viewport: { width: 390, height: 844 } });
|
||||
const errors = [];
|
||||
page.on("pageerror", (e) => errors.push(e.message));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue