mirror of
https://github.com/LamGC/wp-asciiplayer.git
synced 2026-11-26 20:55:48 +00:00
Add bundled English and Simplified Chinese UI translations (1.1.0-dev)
This commit is contained in:
@@ -33,3 +33,28 @@ Chromium; the repository CI records the exact WordPress version under test and
|
||||
installs the release ZIP into the test site before checking it. Refer to the
|
||||
workflow for setup details. Running a unit test is not a substitute for the
|
||||
WordPress browser integration suite.
|
||||
|
||||
## Translation maintenance
|
||||
|
||||
The English gettext strings are the fallback. Edit `languages/wp-asciiplayer-zh_CN.po`
|
||||
to maintain Simplified Chinese; `npm run i18n` extracts the current static PHP/JS
|
||||
and block-metadata strings into the POT and compiles the MO and WordPress Jed JSON.
|
||||
`npm run i18n:check` fails for missing/fuzzy translations, stale generated files,
|
||||
unsupported plural extraction, and mismatched printf placeholders. Build runs
|
||||
compilation and tests check it reproducibly, without a network service or timestamps.
|
||||
For new strings, run `node scripts/i18n.mjs --pot-only`, merge into the maintained
|
||||
PO with a gettext editor, translate, and run `npm run i18n` again.
|
||||
|
||||
JSON files use WordPress's supported domain-locale-script-handle names for the
|
||||
actual `lamgc-asciiplayer-editor` and `lamgc-asciiplayer-view` handles. The editor
|
||||
bundle has no lazy translated chunks. `wp_set_script_translations` registers both
|
||||
paths after scripts; PHP registers `load_plugin_textdomain` during `init`, before
|
||||
block metadata is translated. The generated assets and all catalogs are packaged.
|
||||
The upstream vendor bundle is byte-for-byte unchanged and its own controls remain
|
||||
English. Runtime JS/CSS versions use build content hashes even though the preview
|
||||
package version stays `1.1.0-dev`.
|
||||
|
||||
References:
|
||||
- https://developer.wordpress.org/reference/functions/wp_set_script_translations/
|
||||
- https://developer.wordpress.org/reference/functions/load_script_textdomain/
|
||||
- https://developer.wordpress.org/reference/functions/load_plugin_textdomain/
|
||||
|
||||
Reference in New Issue
Block a user