mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-14 15:22:21 +00:00
i18n: keep 並 before 道路, 道歉 and 道理 in zh-Hant
The 並道 → 併道 correction replaced the substring anywhere, so a zh-CN string where 并 means "and" and 道 starts the next word would turn into 併道路 or 併道歉. It now skips 道路, 道歉 and 道理. The three current entries (lane merging) convert as before; zh-Hant.json does not change.
This commit is contained in:
1 parent
4c5fbd3223
commit
3822ee9f00
3 files changed
+9
-2
No files matched your search
@@ -10,7 +10,7 @@ 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: 年曆史 → 年歷史, 下遊 → 下游, 並道 → 併道, 發佈 → 發布, 公佈 → 公布, 控制檯 → 控制台, and 周 → 週 where it means a week (1 週/秒). The list is `ZH_HANT_CORRECTIONS` in `scripts/i18n.mjs`; when the conversion picks another wrong character, add the pair there and run the command.
|
||||
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: 年曆史 → 年歷史, 下遊 → 下游, 並道 → 併道 (not in 並道路, 並道歉, 並道理), 發佈 → 發布, 公佈 → 公布, 控制檯 → 控制台, and 周 → 週 where it means a week (1 週/秒). The list is `ZH_HANT_CORRECTIONS` in `scripts/i18n.mjs`; when the conversion picks another wrong character, add the pair there 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`.
|
||||
|
||||
|
||||
+2
-1
@@ -634,7 +634,8 @@ const ZH_HANT_COMMAND = 'npm run i18n -- --zh-hant';
|
||||
const ZH_HANT_CORRECTIONS = [
|
||||
['年曆史', '年歷史'],
|
||||
['下遊', '下游'],
|
||||
['並道', '併道'],
|
||||
// 併道 is merging lanes; 並 stays when 道 starts 道路, 道歉 or 道理.
|
||||
[/並道(?![路歉理])/g, '併道'],
|
||||
['發佈', '發布'],
|
||||
['公佈', '公布'],
|
||||
['控制檯', '控制台'],
|
||||
|
||||
@@ -54,6 +54,12 @@ 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('{direction}并道,进入 {road}'),
|
||||
'{direction}併道,進入 {road}',
|
||||
);
|
||||
assert.equal(toZhHant('事故并道路封闭'), '事故並道路封閉');
|
||||
assert.equal(toZhHant('已关闭并道歉'), '已關閉並道歉');
|
||||
});
|
||||
|
||||
test('checkZhHant names each entry that is not the conversion of zh-CN', () => {
|
||||
|
||||
Reference in new issue
Block a user