feedback5 WAD: docs for language packs and content packs — docs/PACKS.md (the manifest, the two layouts, discovery and the index, what is served, the types and how a later type plugs in), docs/I18N.md §5 "Adding a language" (step by step for a translator) with the fallback chain, placeholder validation and plural categories, CONTRIBUTING / README pointers, DEPLOY §7 (packs/ and packs/index.json in the zips), ARCHITECTURE, docs/history/0.2.0.md §25.16; build-i18n --dict (a community dictionary for a language without an official client); the browser check of a pack file and a pack folder dropped in while the server runs (test/ui/i18n.e2e.test.js); golden unchanged

This commit is contained in:
sganggs committed 2026-10-07 02:39:11 +08:00
1 parent 25b2a87b26
commit 1ee39a79b5
11 files changed
+466 -64

No files matched your search

+5 -4
View File
@@ -3,9 +3,10 @@
// The Chinese source string is the message id: `t('整备区已满')`, `t('还剩 {n} 秒', { n })`. A message without a
// translation in the current language falls back to the Chinese text, so an untranslated string is never blank.
// Chinese ('zh') is the default language; every other language is a pack (shared/i18nPacks.js): a file in
// public/i18n/ that the client lists from /i18n/index.json and loads on demand (ui/lang.js). Nothing here knows a
// language by name (the owner's decisions of 2026-10-05 and 2026-10-07: Chinese by default, a language is a file in the
// language folder). docs/I18N.md explains how to add and translate strings and how to add a language.
// public/i18n/ (or a pack folder, shared/packs.js) that the client lists from /packs/index.json and loads on demand
// (ui/lang.js). Nothing here knows a language by name (the owner's decisions of 2026-10-05 and 2026-10-07: Chinese by
// default, a language is a file in the language folder). docs/I18N.md explains how to add and translate strings and how
// to add a language.
//
// Fallback chain per string: the chosen pack → its base (pt-BR → pt; zh-TW has none) → the packs its `_meta.fallback`
// names (e.g. English) → the Chinese msgid (i18nPacks.js computeChain). A partial pack is fine: what it lacks falls
@@ -81,7 +82,7 @@ const notifyLangs = () => {
};
/**
* Register languages (the client: the entries of /i18n/index.json; a pack's own `_meta` when it loads). A known code
* Register languages (the client: the language entries of /packs/index.json, shared/packs.js langMetaOf). A known code
* is merged with what is there. Listeners of onLangsChange run once.
* @param {Partial<LangMeta>[]} entries each with a `code`
* @returns {number} languages registered