mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-20 10:12:18 +00:00
i18n: tighten the zh-Hant check and test its command line
- Without opencc-js the zh-Hant check says to run npm ci, and the other
checks still run.
- --prune handles zh-CN before zh-Hant: shippedLocales() sorts, since
git lists untracked catalogs first.
- A key missing from zh-Hant is reported once, with "run npm run i18n --
--zh-hant" when zh-CN has it; a zh-Hant entry still in English points
to zh-CN and same-as-english.json.
- 並道 -> 併道 applies only to entries whose English key says merge, so
并 (and) before 道路 or 道謝 stays 並.
- Two more corrections for strings main has added: 箇中 -> 個中 after a
count (全部 {n} 個中), and 宣佈 -> 宣布 like 發佈 and 公佈.
- zh-hant-cli.test.mjs runs the command in a throwaway repository, with
opencc-js linked as a junction, so Windows needs no symlink privilege.
zh-Hant.json does not change.
This commit is contained in:
1 parent
3822ee9f00
commit
b63205f69c
4 files changed
+239
-39
No files matched your search
@@ -54,12 +54,27 @@ test('toZhHant converts characters, not vocabulary, and fixes what s2tw picks wr
|
||||
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('{direction}并道,进入 {road}'),
|
||||
'{direction}併道,進入 {road}',
|
||||
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': '已關閉並道歉',
|
||||
},
|
||||
);
|
||||
assert.equal(toZhHant('事故并道路封闭'), '事故並道路封閉');
|
||||
assert.equal(toZhHant('已关闭并道歉'), '已關閉並道歉');
|
||||
});
|
||||
|
||||
test('checkZhHant names each entry that is not the conversion of zh-CN', () => {
|
||||
@@ -96,6 +111,21 @@ test('checkZhHant names each entry that is not the conversion of zh-CN', () => {
|
||||
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)', () => {
|
||||
|
||||
Reference in new issue
Block a user