Merge pull request #1699 from bilawalsidhu/german/zh-hant-generated

i18n: generate zh-Hant from zh-CN
This commit is contained in:
German Khokhlov authored and GitHub committed 2026-11-18 01:14:16 +04:00
commit c08bd1103d
11 files changed
+536 -133

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
- Generate the Traditional Chinese catalog instead of translating it:
`npm run i18n -- --zh-hant` writes `zh-Hant` from `zh-CN` with OpenCC `s2tw`
and its character corrections, and `npm test` fails, naming the key, when
`zh-Hant` is edited by hand (German, @gekh, #1699).
+3 -1
View File
@@ -5781,7 +5781,9 @@ Shipped locales: **en** (source and fallback), **ar**, **de**, **es**, **fr**, *
- **Gate.** `npm run i18n` (and `src/i18n/catalog.test.mjs` under `npm test`)
extracts every message and fails on missing, empty, unused,
placeholder-mismatched, still-English (plural forms included) or
wrongly-shaped plural entries.
wrongly-shaped plural entries. `zh-Hant` is generated from `zh-CN`
(`npm run i18n -- --zh-hant`: OpenCC `s2tw` through `opencc-js`, then a
fixed list of character corrections), and the gate fails when it differs.
- **Not translated by design:** layer ids, share-link and hash parameters, API
fields, voice tool schemas, provider names, feed data (callsigns, vessel and
station names) and attribution.
+2
View File
@@ -120,6 +120,8 @@ npm run i18n -- --prune # drop entries whose English no longer exists
Changing the English changes the key: the old translation goes unused and the new text shows as missing. Add the translation to every `src/i18n/locales/<code>.json` (or ask a translator), prune, and run `npm test`; it fails until every language is complete.
Do not translate `zh-Hant`: it is generated. After `zh-CN`, run `npm run i18n -- --zh-hant` (see [zh-Hant.md](./translations/zh-Hant.md)).
To see a language, open the app with `?lang=ru`, or use the language picker (the globe button in the bottom-right corner).
An empty translation is reported, and so is one left as the English, plural forms included. When English is right on purpose (a code such as CRT, a product name), list it under the language in `src/i18n/same-as-english.json`.
+2
View File
@@ -36,6 +36,8 @@ npm run i18n -- --prune # drop entries the code no longer uses
Changing English text changes its key: the old translation becomes unused and the new text shows as missing. Translate it and prune.
Do not translate `zh-Hant`: it is generated. Translate `zh-CN`, then run `npm run i18n -- --zh-hant` (see [zh-Hant.md](./translations/zh-Hant.md)).
## Fixing a translation
Edit `src/i18n/locales/<code>.json` and run `npm run i18n`. To see your change, open the app with `?lang=<code>`.
+12 -4
View File
@@ -2,16 +2,24 @@
Catalog: `src/i18n/locales/zh-Hant.json`. General rules: [TRANSLATORS.md](../TRANSLATORS.md).
`zh-Hant` is the Simplified Chinese catalog (`zh-CN`, credited to abiyeenzo, #914, and EDIT-Aeterna, #979) written in Traditional characters with OpenCC character conversion. Wording and terminology are the same as in `zh-CN`: change a term in [zh-CN.md](./zh-CN.md) and the `zh-CN` catalog first, then convert. Only the script differs.
**Do not translate or edit this catalog: it is generated.** `zh-Hant` is the Simplified Chinese catalog (`zh-CN`, credited to abiyeenzo, #914, and EDIT-Aeterna, #979) written in Traditional characters. Wording and terminology are the same as in `zh-CN`; only the script differs. To add or change an entry, edit [zh-CN.md](./zh-CN.md) and the `zh-CN` catalog, then run:
After `s2tw` conversion, fix the characters OpenCC picks wrongly: 年曆史 → 年歷史, 下遊 → 下游, 並道 → 併道, 發佈 → 發布, 公佈 → 公布, 控制檯 → 控制台, and 周 → 週 where it means a week (1 週/秒).
```sh
npm run i18n -- --zh-hant # rewrite zh-Hant.json from zh-CN.json
```
`npm test` fails when `zh-Hant.json` differs from the conversion of `zh-CN.json`, naming the entry, and `npm run i18n -- --missing zh-Hant` points to this command instead of printing a template.
The command converts with OpenCC `s2tw` ([opencc-js](https://github.com/nk2028/opencc-js), `cn` → `tw`), which changes characters only. Never `s2twp`: it also swaps in Taiwan vocabulary (影片, 伺服器, 載入, 圖示), which this catalog does not use. After the conversion it fixes the characters OpenCC picks wrongly here: 年曆史 → 年歷史, 下遊 → 下游, 並道 → 併道 (only in entries whose English key says merge), 發佈 → 發布, 公佈 → 公布, 宣佈 → 宣布, 控制檯 → 控制台, 箇中 → 個中 (全部 {n} 個中), and 周 → 週 in ` 周/秒` (1 週/秒, weeks per second). OpenCC writes 週 itself in 每週, 本週, 上週, 一週 and 兩週, but not after a number (過去 2 周, {count} 周前): a new string like that needs its own pair. The list is `ZH_HANT_CORRECTIONS` in `scripts/i18n.mjs`; when the conversion picks another wrong character, add the pair there (with a key pattern if it is right only in some entries) and run the command.
An entry `zh-CN` keeps in English on purpose needs the same line under `zh-Hant` in `src/i18n/same-as-english.json`.
## Style
- Follow [zh-CN.md](./zh-CN.md) for wording, punctuation, spacing, units and the glossary, written in Traditional characters.
- Wording, punctuation, spacing, units and the glossary are those of [zh-CN.md](./zh-CN.md), written in Traditional characters.
- Relative-time placeholders may already include 前. In `LIVE · updated {age}`, the caller supplies the complete relative age; do not append another 前.
- The picker displays 中文(繁體) / Chinese (Traditional); explicit Hans tags select Simplified Chinese.
## Plurals
`Intl.PluralRules('zh-Hant')` uses only `other`. Keep the measure words of the `zh-CN` entry: 「{count} 架飛機」、「{count} 艘船」.
`Intl.PluralRules('zh-Hant')` uses only `other`. The measure words come from the `zh-CN` entry: 「{count} 架飛機」、「{count} 艘船」.
+8
View File
@@ -34,6 +34,7 @@
"@vue/test-utils": "^2.5.1",
"flag-icons": "7.5.0",
"happy-dom": "^20.14.6",
"opencc-js": "1.4.2",
"prettier": "3.9.6",
"puppeteer": "^25.16.0",
"sharp": "^0.35.4",
@@ -2990,6 +2991,13 @@
"node": ">= 0.8"
}
},
"node_modules/opencc-js": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/opencc-js/-/opencc-js-1.4.2.tgz",
"integrity": "sha512-EdcspgdROiCCZDM+jZR6Pa670xW+EW2QhctPBQ8gRjg6lrx4IHEl+2s+kt5izk/TkxVRgdWuFgaGkaEdIUfdaw==",
"dev": true,
"license": "MIT AND Apache-2.0"
},
"node_modules/pako": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz",
+1
View File
@@ -90,6 +90,7 @@
"@vue/test-utils": "^2.5.1",
"flag-icons": "7.5.0",
"happy-dom": "^20.14.6",
"opencc-js": "1.4.2",
"prettier": "3.9.6",
"puppeteer": "^25.16.0",
"sharp": "^0.35.4",
+151 -12
View File
@@ -3,17 +3,21 @@
// npm run i18n check every catalog and find unmarked UI text
// npm run i18n -- --prune also drop entries the code no longer uses
// npm run i18n -- --missing ru print what ru lacks, as JSON to translate
// npm run i18n -- --zh-hant rewrite zh-Hant from zh-CN (see toZhHant)
//
// A translation left as the English fails unless src/i18n/same-as-english.json
// lists it.
// lists it. zh-Hant is not translated: it is generated from zh-CN, and the
// check fails when it differs.
//
// Messages are the English literals passed to t(), tn() and msg() in src/,
// plus the markup opted in with data-i18n* in index.html and the Vue views.
// It also lists UI text that is not marked at all (see findUnmarked).
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
import { execFileSync } from 'node:child_process';
import { createRequire } from 'node:module';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { isDeepStrictEqual } from 'node:util';
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const LOCALES_DIR = path.join(ROOT, 'src/i18n/locales');
@@ -510,10 +514,11 @@ export function readCatalog(locale) {
return JSON.parse(readFileSync(catalogPath(locale), 'utf8'));
}
/** Sorted: git lists untracked files first, and main needs zh-CN before zh-Hant. */
export function shippedLocales() {
return trackedFiles('src/i18n/locales/*.json').map((file) =>
path.basename(file, '.json'),
);
return trackedFiles('src/i18n/locales/*.json')
.map((file) => path.basename(file, '.json'))
.sort();
}
/** Messages a locale keeps exactly as in English, on purpose. */
@@ -532,7 +537,9 @@ const blank = (value) => value.trim() === '';
const hasLetters = (value) => /\p{L}{2}/u.test(value.replace(/\{[^}]*\}/g, ''));
const STILL_ENGLISH = (text, locale) =>
`"${text}" is still English: translate it, or list it under "${locale}" in src/i18n/same-as-english.json`;
locale === ZH_HANT
? `"${text}" is still English: translate it in ${ZH_HANT_SOURCE} and run ${ZH_HANT_COMMAND}, or list it under "${ZH_HANT}" in src/i18n/same-as-english.json as under "${ZH_HANT_SOURCE}"`
: `"${text}" is still English: translate it, or list it under "${locale}" in src/i18n/same-as-english.json`;
/**
* Compare one catalog with the extracted messages.
@@ -619,16 +626,138 @@ export function missingTemplate(locale, catalog, messages) {
return out;
}
// zh-Hant is zh-CN in Traditional characters (docs/translations/zh-Hant.md):
// the same wording, only the script differs. OpenCC s2tw (opencc-js, cn → tw)
// converts characters only; s2twp would also swap in Taiwan vocabulary
// (影片, 伺服器, 載入), which the catalog does not use.
const ZH_HANT = 'zh-Hant';
const ZH_HANT_SOURCE = 'zh-CN';
const ZH_HANT_COMMAND = 'npm run i18n -- --zh-hant';
// Characters s2tw picks wrongly in this text, replaced after the conversion.
// A pair with a third item applies only to entries whose English key matches it.
const ZH_HANT_CORRECTIONS = [
['年曆史', '年歷史'],
['下遊', '下游'],
// 併道 is merging lanes; elsewhere 並 (and) stays before 道路, 道謝 and the like.
['並道', '併道', /\bmerge\b/i],
['發佈', '發布'],
['公佈', '公布'],
['宣佈', '宣布'],
['控制檯', '控制台'],
// 個 after a count ({n} 个中, of {n}), not the literary 箇中.
['箇中', '個中'],
// 周 as a week: the time-lapse speed in weeks per second.
[' 周/秒', ' 週/秒'],
];
let s2tw;
// Loaded on first use, so extracting messages needs no node_modules
// (stale-index.test.mjs); main reports a missing package as a zh-Hant error.
function converter() {
try {
s2tw ??= createRequire(import.meta.url)('opencc-js/cn2t').Converter({
from: 'cn',
to: 'tw',
});
} catch (error) {
if (error.code !== 'MODULE_NOT_FOUND') throw error;
throw new Error('opencc-js is not installed: run npm ci', { cause: error });
}
return s2tw;
}
export function toZhHant(text, key = '') {
return ZH_HANT_CORRECTIONS.reduce(
(out, [wrong, right, keys]) =>
!keys || keys.test(key) ? out.replaceAll(wrong, right) : out,
converter()(text),
);
}
/** The zh-Hant catalog for a zh-CN catalog: the same keys in the same order. */
export function zhHantCatalog(zhCN) {
const convert = (entry, text) => {
if (typeof entry === 'string') return toZhHant(entry, text);
if (entry && typeof entry === 'object')
return Object.fromEntries(
Object.entries(entry).map(([category, form]) => [
category,
convert(form, text),
]),
);
return entry;
};
return Object.fromEntries(
Object.entries(zhCN).map(([text, entry]) => [text, convert(entry, text)]),
);
}
/**
* Where a zh-Hant catalog is not the conversion of the zh-CN one.
* @param {Set<string>} [reported] Keys already reported missing from zh-Hant.
* @returns {string[]} One error per entry, naming its key.
*/
export function checkZhHant(zhCN, zhHant, reported = new Set()) {
const expected = zhHantCatalog(zhCN);
const fix = `zh-Hant is generated: edit ${ZH_HANT_SOURCE}, then run ${ZH_HANT_COMMAND}`;
const errors = [];
for (const [text, entry] of Object.entries(expected)) {
if (!Object.hasOwn(zhHant, text)) {
if (!reported.has(text))
errors.push(`"${text}" is in ${ZH_HANT_SOURCE} but not here. ${fix}`);
} else if (!isDeepStrictEqual(zhHant[text], entry))
errors.push(
`"${text}" is ${JSON.stringify(zhHant[text])}, not ${ZH_HANT_SOURCE} converted (${JSON.stringify(entry)}). ${fix}`,
);
}
for (const text of Object.keys(zhHant)) {
if (!Object.hasOwn(expected, text))
errors.push(`"${text}" is not in ${ZH_HANT_SOURCE}. ${fix}`);
}
const order = Object.keys(expected);
const keys = Object.keys(zhHant);
if (!errors.length && keys.length === order.length) {
const at = order.findIndex((text, i) => keys[i] !== text);
if (at >= 0)
errors.push(
`entries leave the ${ZH_HANT_SOURCE} order at "${order[at]}": run ${ZH_HANT_COMMAND}`,
);
}
return errors;
}
const serialize = (catalog) => `${JSON.stringify(catalog, null, 2)}\n`;
export function writeZhHant() {
const catalog = zhHantCatalog(readCatalog(ZH_HANT_SOURCE));
writeFileSync(catalogPath(ZH_HANT), serialize(catalog));
return Object.keys(catalog).length;
}
function main(args) {
const messages = extractMessages();
const missingFor = args.includes('--missing')
? args[args.indexOf('--missing') + 1]
: null;
if (missingFor?.toLowerCase() === ZH_HANT.toLowerCase()) {
console.error(
`${ZH_HANT} is generated, not translated: add the entries to ${ZH_HANT_SOURCE} (npm run i18n -- --missing ${ZH_HANT_SOURCE}), then run ${ZH_HANT_COMMAND}`,
);
return 1;
}
if (missingFor) {
const out = missingTemplate(missingFor, readCatalog(missingFor), messages);
console.log(JSON.stringify(out, null, 2));
return 0;
}
if (args.includes('--zh-hant')) {
const count = writeZhHant();
console.log(
`${ZH_HANT}: wrote ${count} entries converted from ${ZH_HANT_SOURCE}`,
);
}
let failed = false;
for (const locale of shippedLocales()) {
let catalog = readCatalog(locale);
@@ -637,10 +766,7 @@ function main(args) {
catalog = Object.fromEntries(
Object.entries(catalog).filter(([text]) => messages.has(text)),
);
writeFileSync(
catalogPath(locale),
`${JSON.stringify(catalog, null, 2)}\n`,
);
writeFileSync(catalogPath(locale), serialize(catalog));
console.log(`${locale}: pruned ${stale.length} unused entries`);
} else if (stale.length) {
failed = true;
@@ -649,11 +775,24 @@ function main(args) {
);
for (const text of stale) console.log(` ${JSON.stringify(text)}`);
}
// shippedLocales() is sorted, so --prune has already pruned zh-CN.
const zhCN = locale === ZH_HANT ? readCatalog(ZH_HANT_SOURCE) : null;
if (zhCN) {
try {
errors.push(...checkZhHant(zhCN, catalog, new Set(missing)));
} catch (error) {
if (error.cause?.code !== 'MODULE_NOT_FOUND') throw error;
errors.push(error.message);
}
}
if (missing.length) {
failed = true;
console.log(
`${locale}: ${missing.length} missing (npm run i18n -- --missing ${locale}):`,
);
const fill = !zhCN
? `npm run i18n -- --missing ${locale}`
: missing.every((text) => Object.hasOwn(zhCN, text))
? `run ${ZH_HANT_COMMAND}`
: `add them to ${ZH_HANT_SOURCE}, then ${ZH_HANT_COMMAND}`;
console.log(`${locale}: ${missing.length} missing (${fill}):`);
for (const text of missing)
console.log(` ${JSON.stringify(text)} ${messages.get(text).where}`);
}
+92
View File
@@ -3,13 +3,16 @@ import assert from 'node:assert/strict';
import {
checkCatalog,
checkZhHant,
extractMessages,
findUnmarked,
markedTemplate,
readCatalog,
shippedLocales,
toZhHant,
unmarkedMarkup,
unmarkedScript,
zhHantCatalog,
} from '../../scripts/i18n.mjs';
import { LOCALES } from './locale.js';
@@ -36,6 +39,95 @@ for (const locale of shippedLocales()) {
});
}
test('zh-Hant is zh-CN converted to Traditional characters (npm run i18n -- --zh-hant)', () => {
assert.deepEqual(
checkZhHant(readCatalog('zh-CN'), readCatalog('zh-Hant')),
[],
);
});
test('toZhHant converts characters, not vocabulary, and fixes what s2tw picks wrongly', () => {
// s2twp would write 影片, 伺服器 and 載入; zh-Hant keeps the zh-CN words.
assert.equal(toZhHant('视频'), '視頻');
assert.equal(toZhHant('服务器'), '服務器');
assert.equal(toZhHant('加载'), '加載');
assert.equal(toZhHant('50 年历史'), '50 年歷史');
assert.equal(toZhHant('发布于 {date}'), '發布於 {date}');
assert.equal(toZhHant('1 周/秒'), '1 週/秒');
assert.equal(toZhHant('已宣布紧急情况'), '已宣布緊急情況');
assert.equal(toZhHant('全部 {n} 个中'), '全部 {n} 個中');
// 併道 only where the English key is about merging.
assert.equal(toZhHant('前方并道路段', 'Merge ahead'), '前方併道路段');
assert.equal(
toZhHant('事故并道路封闭', 'Crash, road closed'),
'事故並道路封閉',
);
assert.equal(toZhHant('挥手并道谢', 'Waved and thanked'), '揮手並道謝');
assert.deepEqual(
zhHantCatalog({
'Merge {direction} onto {road}': '{direction}并道,进入 {road}',
'maneuver|Merge': '并道',
'Closed and apologized': '已关闭并道歉',
}),
{
'Merge {direction} onto {road}': '{direction}併道,進入 {road}',
'maneuver|Merge': '併道',
'Closed and apologized': '已關閉並道歉',
},
);
});
test('checkZhHant names each entry that is not the conversion of zh-CN', () => {
const zhCN = {
Video: '视频',
Server: '服务器',
'{count} ships': { other: '{count} 艘船' },
};
const generated = zhHantCatalog(zhCN);
assert.deepEqual(generated, {
Video: '視頻',
Server: '服務器',
'{count} ships': { other: '{count} 艘船' },
});
assert.deepEqual(checkZhHant(zhCN, generated), []);
const fix =
'zh-Hant is generated: edit zh-CN, then run npm run i18n -- --zh-hant';
const { Server, ...withoutServer } = generated;
assert.deepEqual(
checkZhHant(zhCN, {
...withoutServer,
Video: '影片',
'{count} ships': { other: '{count} 艘船隻' },
Extra: '多餘',
}),
[
`"Video" is "影片", not zh-CN converted ("視頻"). ${fix}`,
`"Server" is in zh-CN but not here. ${fix}`,
`"{count} ships" is {"other":"{count} 艘船隻"}, not zh-CN converted ({"other":"{count} 艘船"}). ${fix}`,
`"Extra" is not in zh-CN. ${fix}`,
],
);
assert.deepEqual(checkZhHant(zhCN, { Server, ...withoutServer }), [
'entries leave the zh-CN order at "Video": run npm run i18n -- --zh-hant',
]);
// A key checkCatalog already lists as missing is not reported twice.
assert.deepEqual(checkZhHant(zhCN, withoutServer, new Set(['Server'])), []);
});
test('a zh-Hant entry still in English points to zh-CN and its same-as-English line', () => {
const fixture = new Map([['Bloom', { plural: false }]]);
const errors = (locale) =>
checkCatalog(locale, { Bloom: 'Bloom' }, fixture, new Set()).errors;
assert.deepEqual(errors('zh-Hant'), [
'"Bloom" is still English: translate it in zh-CN and run npm run i18n -- --zh-hant, or list it under "zh-Hant" in src/i18n/same-as-english.json as under "zh-CN"',
]);
assert.match(
errors('zh-CN')[0],
/^"Bloom" is still English: translate it, or/,
);
});
test('every UI string is marked for translation or kept on purpose (npm run i18n)', () => {
assert.deepEqual(
findUnmarked().map(({ where, text }) => `${where} ${text}`),
+116 -116
View File
@@ -617,6 +617,7 @@
"Cyclone advisories unavailable": "氣旋公告不可用",
"Cyclone data unavailable": "氣旋數據不可用",
"Potential tropical cyclone": "潛在熱帶氣旋",
"Post-tropical cyclone": "後熱帶氣旋",
"Hurricane": "颶風",
"Tropical storm": "熱帶風暴",
"Tropical depression": "熱帶低壓",
@@ -714,11 +715,15 @@
"Merge onto {road}": "併入 {road}",
"maneuver|Merge": "併道",
"Take the ramp on the {direction} onto {road}": "{direction}駛入匝道,進入 {road}",
"Take the ramp {direction} onto {road}": "{direction}駛入匝道,進入 {road}",
"Take the ramp on the {direction}": "{direction}駛入匝道",
"Take the ramp {direction}": "{direction}駛入匝道",
"Take the ramp onto {road}": "駛入匝道,進入 {road}",
"Take the ramp": "駛入匝道",
"Take the exit on the {direction} onto {road}": "從出口{direction}駛出,進入 {road}",
"Take the exit {direction} onto {road}": "從出口{direction}駛出,進入 {road}",
"Take the exit on the {direction}": "從出口{direction}駛出",
"Take the exit {direction}": "從出口{direction}駛出",
"Take the exit onto {road}": "從出口駛出,進入 {road}",
"Take the exit": "從出口駛出",
"At the roundabout, take the {exit} exit onto {road}": "在環島從{exit}出口駛出,進入 {road}",
@@ -1604,6 +1609,9 @@
"LIVE SIGNALS": "實時信號",
"CCTV layer unavailable": "CCTV 圖層不可用",
"Link copied!": "鏈接已複製!",
"Link shared": "鏈接已分享",
"This share link can't be opened": "無法打開此分享鏈接",
"Shared vessel is unavailable": "分享的船舶不可用",
"Copy failed": "複製失敗",
"Return map to straight-down view": "將地圖恢復為垂直俯視",
"Tilt map to oblique view": "將地圖傾斜至斜視角",
@@ -1960,6 +1968,8 @@
"ORBIT": "環繞",
"Location not found": "未找到位置",
"Search failed": "搜索失敗",
"Check the spelling and press Enter to search again.": "請檢查拼寫,然後按 Enter 重新搜索。",
"Press Enter to try again.": "按 Enter 重試。",
"Detailed outline unavailable": "無法獲取詳細輪廓",
"Fly to a POI first": "請先飛往一個 POI",
"Reset to full globe view": "重置為完整地球視圖",
@@ -2335,7 +2345,7 @@
"Release Space to send": "鬆開空格鍵發送",
"Hold Space to talk": "按住空格鍵說話",
"Ask or command": "提問或下達指令",
"Voice is disabled in Stories.": "故事模式下語音控制已停用。",
"Voice is disabled in Stories.": "故事模式下語音控制已禁用。",
"Voice off": "語音已關閉",
"VOICE UNAVAILABLE": "語音不可用",
"VOICE ACTIVE": "語音已啟用",
@@ -2982,16 +2992,6 @@
"Search": "搜索",
"More": "更多",
"Panels": "面板",
"Post-tropical cyclone": "後熱帶氣旋",
"Take the ramp {direction} onto {road}": "{direction}駛入匝道,進入 {road}",
"Take the ramp {direction}": "{direction}駛入匝道",
"Take the exit {direction} onto {road}": "從出口{direction}駛出,進入 {road}",
"Take the exit {direction}": "從出口{direction}駛出",
"Link shared": "鏈接已分享",
"This share link can't be opened": "無法打開此分享鏈接",
"Shared vessel is unavailable": "分享的船舶不可用",
"Check the spelling and press Enter to search again.": "請檢查拼寫,然後按 Enter 重新搜索。",
"Press Enter to try again.": "按 Enter 重試。",
"Recent speech": "最近語音",
"Voice Settings": "語音設置",
"Preview": "預覽",
@@ -3030,8 +3030,19 @@
"other": "{count} 個地標"
},
"S2 Underground publishes these KMZ products to GitHub. New uploads are detected within seconds and replace the previous edition automatically. Click a marker for its report.": "S2 Underground 在 GitHub 發布這些 KMZ 產品。新上傳的內容會在數秒內被檢測到,並自動替換舊版本。點擊標記查看報告。",
"routing busy — too many routes at once": "路線服務繁忙:同時請求的路線過多",
"route proxy error": "路線代理出錯",
"fire confidence filter|All": "全部",
"fire confidence filter|Nominal+": "中+",
"fire confidence filter|High": "高",
"Every detection — many of the strongest fires are rated low confidence": "所有火點探測——許多強度最高的火點被評為低置信度",
"Nominal and high confidence detections": "中、高置信度的火點探測",
"High confidence detections only": "僅高置信度的火點探測",
"Fire intensity (FRP)": "火勢強度(FRP)",
"≥ {value} MW": "≥ {value} MW",
"Confidence": "置信度",
"Minimum fire radiative power, megawatts": "最小火輻射功率(兆瓦)",
"fire intensity filter|All": "全部",
"Detection confidence": "探測置信度",
"{shown} of {total} shown": "顯示 {shown} / {total}",
"{lower} to {upper}": "{lower} 至 {upper}",
"Up to {upper}": "最高 {upper}",
"From {lower}": "最低 {lower}",
@@ -3044,6 +3055,8 @@
"Prohibited": "禁區",
"Restricted": "限制區",
"Prohibited & Restricted Airspace": "禁區與限制區空域",
"routing busy — too many routes at once": "路線服務繁忙:同時請求的路線過多",
"route proxy error": "路線代理出錯",
"AUTHORING": "創作",
"Create and edit scenes": "創建和編輯場景",
"SCENE": "場景",
@@ -3069,19 +3082,6 @@
"Download this scene as JSON or an asset bundle": "將此場景下載為 JSON 或資源包",
"Left panels": "左側面板",
"Right panels": "右側面板",
"fire confidence filter|All": "全部",
"fire confidence filter|Nominal+": "中+",
"fire confidence filter|High": "高",
"Every detection — many of the strongest fires are rated low confidence": "所有火點探測——許多強度最高的火點被評為低置信度",
"Nominal and high confidence detections": "中、高置信度的火點探測",
"High confidence detections only": "僅高置信度的火點探測",
"Fire intensity (FRP)": "火勢強度(FRP)",
"≥ {value} MW": "≥ {value} MW",
"Confidence": "置信度",
"Minimum fire radiative power, megawatts": "最小火輻射功率(兆瓦)",
"fire intensity filter|All": "全部",
"Detection confidence": "探測置信度",
"{shown} of {total} shown": "顯示 {shown} / {total}",
"UTILITIES": "工具",
"Exit cockpit to fly to a drawing": "請先退出座艙,再飛往已繪製的形狀",
"Directions, drawing and your own files": "路線導航、繪製和你自己的文件",
@@ -3544,7 +3544,7 @@
"The globe stopped drawing": "地球已停止繪製",
"The browser took back the globe's 3D graphics. Layers and controls still work, but the map cannot draw until the page reloads.": "瀏覽器收回了地球的 3D 圖形。圖層和控件仍可使用,但在重新加載頁面之前地圖無法繪製。",
"Rendering stopped after an error. Layers and controls still work, but the map is not updating.": "渲染因錯誤而停止。圖層和控件仍可使用,但地圖不再更新。",
"Reset view reloads the app without the view restored from the address bar.": "「重置視圖」會重新加載應用,不使用從地址欄恢復的視圖。",
"Reset view reloads the app without the view restored from the address bar.": "“重置視圖”會重新加載應用,不使用從地址欄恢復的視圖。",
"Reload": "重新加載",
"Retry": "重試",
"Reset view": "重置視圖",
@@ -3554,26 +3554,26 @@
"Funicular": "纜索鐵路",
"Gondola": "纜車",
"Move panels back beside the rail": "將面板移回側欄旁",
"Move panels over the rail, to the edge": "將面板移到側欄上方,貼齊邊緣",
"Move panels over the rail, to the edge": "將面板移到側欄上方,貼靠邊緣",
"panel|VISUAL": "視覺",
"Look": "外觀",
"Overlay": "疊加層",
"Effects": "效果",
"Scope opacity": "視域不透明度",
"How dark the scope shades the view outside the keyhole": "視域遮罩使視域之外的畫面變暗的程度",
"Reset to default": "還原預設",
"Reset Visual to its defaults: Normal look, HUD, scope, labels and effects": "將視覺還原為預設設定:常規外觀、HUD、視域、標籤和效果",
"Reset to default": "恢復默認",
"Reset Visual to its defaults: Normal look, HUD, scope, labels and effects": "將視覺恢復為默認設置:常規外觀、HUD、視域、標籤和效果",
"All layers": "全部圖層",
"On": "已開啟",
"Off": "已關閉",
"Search layers": "搜尋圖層",
"Search layers": "搜索圖層",
"Filter layers": "篩選圖層",
"Status": "狀態",
"Search layers…": "搜尋圖層…",
"Search layers…": "搜索圖層…",
"Layer groups": "圖層分組",
"Jump to {name}": "跳至{name}",
"No layers match": "沒有符合的圖層",
"A GEV scene, played on the live globe.": "在即時地球上播放的 GEV 場景。",
"Jump to {name}": "跳轉到{name}",
"No layers match": "沒有匹配的圖層",
"A GEV scene, played on the live globe.": "在實時地球上播放的 GEV 場景。",
"Drag the map to explore · Resume any time": "拖動地圖進行探索 · 隨時可繼續",
"Region": "地區",
"Europe": "歐洲",
@@ -3609,13 +3609,13 @@
"Filters": "篩選",
"Search stories": "搜索故事",
"Search stories, places, creators": "搜索故事、地點、創作者",
"Clear search": "清除搜尋",
"Clear search": "清除搜索",
"Topics": "主題",
"Filter stories": "篩選故事",
"Show {count} stories": {
"other": "顯示 {count} 個故事"
},
"No stories match": "沒有符合的故事",
"No stories match": "沒有匹配的故事",
"Try another word or clear the filters.": "請換個關鍵詞或清除篩選。",
"Clear all": "全部清除",
"STORY": "故事",
@@ -3636,12 +3636,12 @@
"Share": "分享",
"Back to GEV": "返回 GEV",
"Chapter {n}": "第 {n} 章",
"Context. Swipe up or press to open": "背景資訊。上滑或按下以打開",
"Context. Swipe down or press to close": "背景資訊。下滑或按下以關閉",
"Context. Swipe up or press to open": "背景信息。上滑或按下以打開",
"Context. Swipe down or press to close": "背景信息。下滑或按下以關閉",
"Search this story": "在此故事中搜索",
"Voice search (not in this build)": "語音搜索 (此版本不支援)",
"Voice search (not in this build)": "語音搜索 (此版本不支持)",
"Search results": "搜索結果",
"Nothing in this story matches.": "此故事中沒有符合項目。",
"Nothing in this story matches.": "此故事中沒有匹配項。",
"Chapters": "章節",
"now": "現在",
"About": "簡介",
@@ -3665,25 +3665,25 @@
"Minimise card": "最小化卡片",
"Expand card": "展開卡片",
"Card pages": "卡片頁面",
"Resize context panel": "調整背景資訊面板大小",
"Swipe up for context": "上滑查看背景資訊",
"Resize context panel": "調整背景信息面板大小",
"Swipe up for context": "上滑查看背景信息",
"Chapter start": "章節開始",
"Story time": "故事時間",
"chapter": "章節",
"Key moment: {label}": "關鍵時刻:{label}",
"Exit expanded map": "退出放大地圖",
"Expand map": "放大地圖",
"Exit cockpit to open Stories": "請先退出座艙,再開啟故事",
"Stories could not load. Check the connection and try again.": "無法載入故事。請檢查網路連線後重試。",
"Exit cockpit to open Stories": "請先退出座艙,再打開故事",
"Stories could not load. Check the connection and try again.": "無法加載故事。請檢查網絡連接後重試。",
"Shot {n} of {total}": "鏡頭 {n}/{total}",
"GEV scene": "GEV 場景",
"SAVE TO STORIES": "儲存到 STORIES",
"SAVE TO STORIES": "保存到 STORIES",
"REMOVE FROM STORIES": "從 STORIES 移除",
"Show this scene on the Stories page": "在 Stories 頁面顯示此場景",
"Take this scene off the Stories page": "將此場景從 Stories 頁面移除",
"Saved to Stories": "已儲存到 Stories",
"Saved to Stories": "已保存到 Stories",
"Removed from Stories": "已從 Stories 移除",
"A scene you made in GEV, played on the live globe.": "你在 GEV 中製作的場景,在即時地球上播放。",
"A scene you made in GEV, played on the live globe.": "你在 GEV 中製作的場景,在實時地球上播放。",
"Floods": "洪水",
"Wildfires": "山火",
"Storms": "風暴",
@@ -3692,20 +3692,20 @@
"Space": "太空",
"Conflict": "衝突",
"Climate": "氣候",
"Switch to Esri World Imagery to capture a thumbnail": "請切換至 Esri World Imagery 以擷取縮圖",
"Thumbnail could not be captured": "無法擷取縮圖",
"Thumbnail captured": "已擷取縮圖",
"Switch to Esri World Imagery to capture a thumbnail": "請切換至 Esri World Imagery 以截取縮略圖",
"Thumbnail could not be captured": "無法截取縮略圖",
"Thumbnail captured": "已截取縮略圖",
"Stories tags": "故事標籤",
"Story thumbnail": "故事縮圖",
"Use the current view as the Stories card image": "將目前檢視用作故事卡片圖片",
"Aircraft positions come from ADS-B: the OpenSky Network’s worldwide snapshot, with adsb.lol where OpenSky has none.": "飛機位置來自 ADS-B:OpenSky Network 的全球快照,OpenSky 沒有資料的地方由 adsb.lol 補充。",
"Live-flight fallback (ODbL 1.0)": "即時航班備用來源 (ODbL 1.0)",
"Satellite orbits are propagated from CelesTrak’s current element sets.": "衛星軌道根據 CelesTrak 目前的軌道根數推算。",
"Earthquakes come from the U.S. Geological Survey’s live feed.": "地震資料來自美國地質調查局 (USGS) 的即時資料流。",
"Story thumbnail": "故事縮略圖",
"Use the current view as the Stories card image": "將當前視圖用作故事卡片圖片",
"Aircraft positions come from ADS-B: the OpenSky Network’s worldwide snapshot, with adsb.lol where OpenSky has none.": "飛機位置來自 ADS-B:OpenSky Network 的全球快照,OpenSky 沒有數據的地方由 adsb.lol 補充。",
"Live-flight fallback (ODbL 1.0)": "實時航班備用來源 (ODbL 1.0)",
"Satellite orbits are propagated from CelesTrak’s current element sets.": "衛星軌道根據 CelesTrak 當前的軌道根數推算。",
"Earthquakes come from the U.S. Geological Survey’s live feed.": "地震數據來自美國地質調查局 (USGS) 的實時數據流。",
"Traffic": "交通",
"Road traffic; live congestion needs your own TomTom key.": "道路交通;即時壅塞需要你自己的 TomTom 金鑰。",
"Live traffic flow, with your own key": "即時交通流量,需使用你自己的金鑰",
"Live air traffic around the world: the Atlantic, Europe, Japan and San Francisco.": "全球即時空中交通:大西洋、歐洲、日本和舊金山。",
"Road traffic; live congestion needs your own TomTom key.": "道路交通;實時擁堵需要你自己的 TomTom 密鑰。",
"Live traffic flow, with your own key": "實時交通流量,需使用你自己的密鑰",
"Live air traffic around the world: the Atlantic, Europe, Japan and San Francisco.": "全球實時空中交通:大西洋、歐洲、日本和舊金山。",
"The Atlantic": "大西洋",
"Western Europe": "西歐",
"Japan": "日本",
@@ -3716,30 +3716,30 @@
"Over Africa": "非洲上空",
"Over Tokyo": "東京上空",
"Over Paris": "巴黎上空",
"Recent earthquakes in the thermal look: California, Japan, New Zealand and off Portugal.": "熱成像風格下的近期地震:加利福尼亞、日本、紐西蘭和葡萄牙外海。",
"Recent earthquakes in the thermal look: California, Japan, New Zealand and off Portugal.": "熱成像風格下的近期地震:加利福尼亞、日本、新西蘭和葡萄牙近海。",
"California": "加利福尼亞",
"New Zealand": "紐西蘭",
"Off Portugal": "葡萄牙外海",
"New Zealand": "新西蘭",
"Off Portugal": "葡萄牙近海",
"Flights, satellites and traffic together over New York, Los Angeles and London.": "紐約、洛杉磯和倫敦上空的航班、衛星與交通。",
"New York, closer": "紐約,更近",
"New York, closer still": "紐約,再近一些",
"Every live layer at once, pulling back from Tokyo to the whole planet.": "同時顯示所有即時圖層,從東京拉遠到整個地球。",
"Every live layer at once, pulling back from Tokyo to the whole planet.": "同時顯示所有實時圖層,從東京拉遠到整個地球。",
"Tokyo, pulling back": "東京,拉遠",
"Japan and East Asia": "日本與東亞",
"South China Sea": "南海",
"The whole globe": "整個地球",
"The 26 August 2026 Bhote Koshi outburst flood in Nepal, followed down the valley to Trishuli.": "2026 年 8 月 26 日尼泊爾 Bhote Koshi 潰決洪水,沿河谷而下追蹤至 Trishuli。",
"Reconstructed flood path (CC BY-NC 4.0)": "重建的洪水路徑 (CC BY-NC 4.0)",
"THUMBNAIL": "縮圖",
"Worldwide live-flight snapshot (non-commercial research and education licence)": "全球即時航班快照(非商業研究與教育授權)",
"Satellite element sets and catalogue (U.S. government data)": "衛星軌道根數與目錄(美國政府資料)",
"Satellite operators, owners and purposes": "衛星營運者、擁有者與用途",
"Earthquake feed (U.S. public domain)": "地震資料流(美國公有領域)",
"THUMBNAIL": "縮略圖",
"Worldwide live-flight snapshot (non-commercial research and education licence)": "全球實時航班快照(非商業研究與教育許可)",
"Satellite element sets and catalogue (U.S. government data)": "衛星軌道根數與目錄(美國政府數據)",
"Satellite operators, owners and purposes": "衛星運營者、所有者與用途",
"Earthquake feed (U.S. public domain)": "地震數據流(美國公有領域)",
"Historical and post-event satellite imagery (CC BY-NC 4.0)": "歷史與事件後衛星影像 (CC BY-NC 4.0)",
"A visualization of the 26 August 2026 Bhote Koshi outburst flood, not an official hazard model. The historical (2021) and post-event views are Vantor WorldView imagery; the river’s path is GeoPera’s reconstruction. Witness clips link to their original posts, and their capture times are unverified.": "這是 2026 年 8 月 26 日 Bhote Koshi 潰決洪水的視覺化,並非官方災害模型。歷史(2021 年)與事件後畫面為 Vantor WorldView 影像;河流路徑為 GeoPera 的重建結果。目擊者影片連結到其原始貼文,拍攝時間未經核實。",
"That story is not available here": "該故事在此處無法使用",
"A visualization of the 26 August 2026 Bhote Koshi outburst flood, not an official hazard model. The historical (2021) and post-event views are Vantor WorldView imagery; the river’s path is GeoPera’s reconstruction. Witness clips link to their original posts, and their capture times are unverified.": "這是 2026 年 8 月 26 日 Bhote Koshi 潰決洪水的可視化,並非官方災害模型。歷史(2021 年)與事件後視圖為 Vantor WorldView 影像;河流路徑為 GeoPera 的重建結果。目擊者視頻鏈接到其原始帖子,拍攝時間未經核實。",
"That story is not available here": "該故事在此處不可用",
"DRAFT": "草稿",
"A draft, not saved as a story yet. Use SAVE TO STORIES in AUTHORING to save it.": "尚未儲存為故事的草稿。在「創作」中使用「儲存到 STORIES」即可儲存。",
"A draft, not saved as a story yet. Use SAVE TO STORIES in AUTHORING to save it.": "尚未保存為故事的草稿。在“創作”中使用“保存到 STORIES”即可保存。",
"Heading to next stop": "前往下一站",
"Arriving at a stop": "即將到站",
"Stopped at a stop": "停靠站點",
@@ -3750,12 +3750,12 @@
"Flight level": "飛行高度層",
"Mach": "馬赫",
"Squawk {code}": "應答機編碼 {code}",
"Signal": "訊號",
"Signal": "信號",
"Civilian, in the air": "民用,空中",
"Military, in the air": "軍用,空中",
"On the ground": "地面",
"Motion": "運動",
"Operator": "營運商",
"Operator": "運營商",
"Last reported": "最近報告",
"Crowding": "擁擠程度",
"Class": "類別",
@@ -3768,7 +3768,7 @@
"Wildfire": "野火",
"{n} acres": "{n} 英畝",
"{n}% contained": "已控制 {n}%",
"prescribed burn": "計畫燒除",
"prescribed burn": "計劃燒除",
"{count} satellite fire hits": {
"other": "{count} 個衛星火點"
},
@@ -3784,45 +3784,45 @@
"Snow showers": "陣雪",
"Thunderstorm": "雷暴",
"Mixed conditions": "天氣多變",
"Search {name} and nearby": "搜尋 {name} 及附近",
"Search what is in view": "搜尋視野內內容",
"Close Context search": "關閉態勢搜尋",
"Search in Context": "在態勢中搜尋",
"Close search": "關閉搜尋",
"Search {name} and nearby": "搜索 {name} 及附近",
"Search what is in view": "搜索視野內內容",
"Close Context search": "關閉態勢搜索",
"Search in Context": "在態勢中搜索",
"Close search": "關閉搜索",
"Shrink Context back to a panel": "將態勢縮回面板",
"Expand Context to a full-height column": "將態勢展開為全高欄",
"Context tabs": "態勢分頁",
"Context tabs": "態勢標籤頁",
"Inspector": "檢查器",
"Properties": "屬性",
"Level": "等級",
"Last {n} min": "最近 {n} 分鐘",
"Just now": "剛剛",
"Since selected": "自選取起",
"Since selected": "自選中起",
"Altitude": "高度",
"Heading": "航向",
"Field of view": "視野",
"Camera frame": "攝影機畫面",
"Acquiring frame…": "正在取得畫面…",
"Show a bigger view": "放大檢視",
"Camera view": "攝影機視圖",
"More info": "更多資訊",
"Field of view": "視場",
"Camera frame": "攝像頭畫面",
"Acquiring frame…": "正在獲取畫面…",
"Show a bigger view": "放大查看",
"Camera view": "攝像頭視圖",
"More info": "更多信息",
"{n} s ago": "{n} 秒前",
"{n} min ago": "{n} 分鐘前",
"{n} h ago": "{n} 小時前",
"{n} d ago": "{n} 天前",
"Out of feed · last reading": "已離開資料源 · 最後讀數",
"Out of feed · last reading": "已離開數據源 · 最後讀數",
"Live · {age}": "實時 · {age}",
"{n} m": "{n} m",
"{n} km": "{n} km",
"updated {age}": "更新於 {age}",
"Selected on the map": "地圖上的選取項",
"Selected on the map": "地圖上的選中項",
"Close card": "關閉卡片",
"{n}% flown": "已飛 {n}%",
"to go": "剩餘",
"The scheduled route for this flight number does not match where the plane is; it may be another leg of the same flight.": "該航班號的計畫航線與飛機位置不符,可能是同一航班的另一航段。",
"Scheduled · unverified: does not match where the plane is": "計畫 · 未核實:與飛機位置不符",
"Nothing in this item’s details matches “{text}”.": "此項詳情中沒有與「{text}」相符的內容。",
"Matching details": "相符的詳情",
"The scheduled route for this flight number does not match where the plane is; it may be another leg of the same flight.": "該航班號的計劃航線與飛機位置不符,可能是同一航班的另一航段。",
"Scheduled · unverified: does not match where the plane is": "計劃 · 未核實:與飛機位置不符",
"Nothing in this item’s details matches “{text}”.": "此項詳情中沒有與“{text}”匹配的內容。",
"Matching details": "匹配的詳情",
"Enter orbital view": "進入軌道視圖",
"Enter Cockpit": "進入座艙",
"Fly to": "飛往",
@@ -3838,10 +3838,10 @@
"Conditions here": "此處狀況",
"feels {n}°": "體感 {n}°",
"Reading conditions here…": "正在讀取此處狀況…",
"No weather reading here.": "此處沒有天氣資料。",
"No weather reading here.": "此處沒有天氣數據。",
"Local solar time": "當地太陽時",
"Nearby radius": "附近半徑",
"How far out the nearby lists look": "附近清單的範圍",
"How far out the nearby lists look": "附近列表的範圍",
"Hazards within {radius}": "{radius} 內的災害",
"Turns the layer on": "開啟該圖層",
"No earthquakes, tropical storms or wildfires reported within {radius}.": "{radius} 內未報告地震、熱帶風暴或野火。",
@@ -3859,29 +3859,29 @@
"{things} in view from {layers}": "視野內有來自 {layers} 的 {things}",
"{n} km up": "高 {n} km",
"{n} m up": "高 {n} m",
"This view": "目前視圖",
"This view": "當前視圖",
"Day": "白天",
"Twilight": "晨昏",
"Night": "夜間",
"Daylight": "日照",
"sun {n}°": "太陽 {n}°",
"Of {n} read, {total} loaded": "讀取 {n} 個,已載入 {total} 個",
"Of {n} read, {total} loaded": "讀取 {n} 個,已加載 {total} 個",
"Of all {n}": "全部 {n} 個中",
"Of {n} in view": "視野內 {n} 個中",
"Error": "錯誤",
"Stale": "已過時",
"In view": "視野內",
"Globe view": "地球視圖",
"Nothing selected": "未選取任何內容",
"Worldwide now": "全球目前",
"Nothing selected": "未選中任何內容",
"Worldwide now": "全球當前",
"Turn on {name}": "開啟 {name}",
"{n} loaded": "已載入 {n}",
"{n} loaded": "已加載 {n}",
"{n} in view": "視野內 {n}",
"Turn off {name}": "關閉 {name}",
"Camera height": "相機高度",
"Nothing in view matches “{text}”.": "視野內沒有與「{text}」相符的內容。",
"Nothing from the layers that are on is in view here. Zoom out to see more.": "已開啟的圖層在此處視野內沒有內容。縮小以檢視更多。",
"No loaded layer has anything in view. Turn some on in Data Layers.": "已載入的圖層在視野內都沒有內容。請在數據圖層中開啟一些。",
"Nothing in view matches “{text}”.": "視野內沒有與“{text}”匹配的內容。",
"Nothing from the layers that are on is in view here. Zoom out to see more.": "已開啟的圖層在此處視野內沒有內容。縮小以查看更多。",
"No loaded layer has anything in view. Turn some on in Data Layers.": "已加載的圖層在視野內都沒有內容。請在數據圖層中開啟一些。",
"Places in view": "視野內的地點",
"Show here": "在此顯示",
"Ask GEV what's here": "問問 GEV 這裡有什麼",
@@ -3889,19 +3889,19 @@
"vessel": "船舶",
"launch": "發射",
"fire": "火點",
"Fire detection": "火點偵測",
"Fire detection": "火點探測",
"fire perimeter": "火場範圍",
"earthquake": "地震",
"storm": "風暴",
"air quality station": "空氣品質站",
"air quality station": "空氣質量站",
"installation": "設施",
"dam": "水壩",
"data centre": "資料中心",
"data centre": "數據中心",
"place": "地點",
"vehicle": "車輛",
"bike station": "單車站",
"plate reader": "車牌辨識器",
"camera": "攝影機",
"plate reader": "車牌識別器",
"camera": "攝像頭",
"airspace": "空域",
"sighting": "目擊",
"Callsign": "呼號",
@@ -3919,8 +3919,8 @@
"Place": "地點",
"Fire power": "火點功率",
"Satellite": "衛星",
"Sensor": "感測器",
"Detected": "偵測時間",
"Sensor": "傳感器",
"Detected": "探測時間",
"Contained": "已控制",
"Discovered": "發現時間",
"Basin": "海域",
@@ -3958,7 +3958,7 @@
"Typhoon": "颱風",
"Super typhoon": "超強颱風",
"Tropical cyclone": "熱帶氣旋",
"Prescribed burn": "計畫燒除",
"Prescribed burn": "計劃燒除",
"Atlantic": "大西洋",
"Eastern Pacific": "東太平洋",
"Central Pacific": "中太平洋",
@@ -3995,7 +3995,7 @@
"Emergency: {kind}": "緊急情況:{kind}",
"Emergency declared": "已宣布緊急情況",
"Tsunami warning issued": "已發布海嘯警報",
"VFR, no flight plan": "VFR,無飛行計畫",
"VFR, no flight plan": "VFR,無飛行計劃",
"VFR conspicuity": "VFR 識別碼",
"IFR, no code yet": "IFR,尚未分配編碼",
"Hijack": "劫機",
@@ -4003,12 +4003,12 @@
"Descending {n} ft/min": "下降 {n} ft/min",
"Cruising, level": "巡航,平飛",
"Airliners": "客機",
"Widebodies": "廣體機",
"Widebodies": "寬體機",
"Business jets": "公務機",
"Helicopters": "直升機",
"Turboprops": "渦槳飛機",
"Fast jets": "高速噴射機",
"Four-engine jets": "四發噴射機",
"Fast jets": "高速噴氣機",
"Four-engine jets": "四發噴氣機",
"M6 and above": "M6 及以上",
"M5 to 6": "M5 至 6",
"M4 to 5": "M4 至 5",
+145
View File
@@ -0,0 +1,145 @@
// The zh-Hant branches of `npm run i18n` (main in scripts/i18n.mjs), run in a
// throwaway repository like stale-index.test.mjs.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { execFileSync, spawnSync } from 'node:child_process';
import {
copyFileSync,
mkdirSync,
mkdtempSync,
readFileSync,
rmSync,
symlinkSync,
writeFileSync,
} from 'node:fs';
import { createRequire } from 'node:module';
import { tmpdir } from 'node:os';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const REPO = path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
'../..',
);
const json = (catalog) => `${JSON.stringify(catalog, null, 2)}\n`;
function sandbox(zhCN, { modules = true } = {}) {
const root = mkdtempSync(path.join(tmpdir(), 'zh-hant-cli-'));
const write = (file, text) => {
mkdirSync(path.dirname(path.join(root, file)), { recursive: true });
writeFileSync(path.join(root, file), text);
};
mkdirSync(path.join(root, 'scripts'));
copyFileSync(
path.join(REPO, 'scripts/i18n.mjs'),
path.join(root, 'scripts/i18n.mjs'),
);
if (modules) {
// The package wherever node finds it, from its dist/umd entry; a junction
// needs no symlink privilege on Windows.
const entry = createRequire(import.meta.url).resolve('opencc-js/cn2t');
mkdirSync(path.join(root, 'node_modules'));
symlinkSync(
path.resolve(path.dirname(entry), '../..'),
path.join(root, 'node_modules/opencc-js'),
'junction',
);
}
write('.gitignore', 'node_modules\n');
write('src/a.js', "export const a = [t('Video'), t('Server')];\n");
write('src/i18n/same-as-english.json', '{}\n');
write('src/i18n/locales/zh-CN.json', json(zhCN));
const git = (...args) =>
execFileSync('git', args, { cwd: root, encoding: 'utf8' });
git('init', '-q');
return {
git,
write,
read: (file) => readFileSync(path.join(root, file), 'utf8'),
run: (...args) =>
spawnSync(process.execPath, ['scripts/i18n.mjs', ...args], {
cwd: root,
encoding: 'utf8',
}),
done: () => rmSync(root, { recursive: true, force: true }),
};
}
const ZH_CN = { Video: '视频', Server: '服务器' };
const ZH_HANT = { Video: '視頻', Server: '服務器' };
test('--missing zh-Hant points to --zh-hant instead of printing a template', () => {
const box = sandbox(ZH_CN);
try {
for (const locale of ['zh-Hant', 'zh-hant']) {
const result = box.run('--missing', locale);
assert.equal(result.status, 1);
assert.equal(result.stdout, '');
assert.match(result.stderr, /then run npm run i18n -- --zh-hant/);
}
} finally {
box.done();
}
});
test('--zh-hant writes zh-CN converted, in its key order, indent 2 and a final newline', () => {
const box = sandbox(ZH_CN);
try {
const result = box.run('--zh-hant');
assert.equal(result.status, 0, result.stdout + result.stderr);
assert.equal(box.read('src/i18n/locales/zh-Hant.json'), json(ZH_HANT));
assert.match(result.stdout, /zh-Hant: 2 messages, complete/);
} finally {
box.done();
}
});
test('--prune drops a stale entry from both catalogs, whichever git lists first', () => {
const box = sandbox({ ...ZH_CN, Old: '旧' });
try {
// zh-CN tracked and zh-Hant not: git ls-files lists zh-Hant first.
box.git('add', '-A');
box.run('--zh-hant');
const result = box.run('--prune');
assert.equal(result.status, 0, result.stdout + result.stderr);
assert.match(result.stdout, /zh-CN: pruned 1 unused entries/);
assert.match(result.stdout, /zh-Hant: pruned 1 unused entries/);
assert.equal(box.read('src/i18n/locales/zh-Hant.json'), json(ZH_HANT));
} finally {
box.done();
}
});
test('a missing zh-Hant entry says to add it to zh-CN only when zh-CN lacks it too', () => {
for (const [zhCN, fill] of [
[ZH_CN, 'run npm run i18n -- --zh-hant'],
[{ Video: '视频' }, 'add them to zh-CN, then npm run i18n -- --zh-hant'],
]) {
const box = sandbox(zhCN);
try {
box.write('src/i18n/locales/zh-Hant.json', json({ Video: '視頻' }));
const result = box.run();
assert.equal(result.status, 1);
assert.ok(
result.stdout.includes(`zh-Hant: 1 missing (${fill}):`),
result.stdout,
);
} finally {
box.done();
}
}
});
test('without node_modules the zh-Hant check says to install and the other checks still run', () => {
const box = sandbox(ZH_CN, { modules: false });
try {
box.write('src/i18n/locales/zh-Hant.json', json(ZH_HANT));
box.write('index.html', '<p>Unmarked words</p>\n');
const result = box.run();
assert.equal(result.status, 1);
assert.match(result.stdout, /zh-Hant: .*run npm ci/);
assert.match(result.stdout, /1 UI strings not marked for translation/);
} finally {
box.done();
}
});