Refresh wp-asciiplayer with native block editor playback (#36)
Build and WordPress integration / PHP 7.4 syntax and regression tests (push) Canceled after 0s
Build and WordPress integration / PHP 8.3 syntax and regression tests (push) Canceled after 0s
Build and WordPress integration / WordPress 6.3 / PHP 7.4 (push) Canceled after 0s
Build and WordPress integration / WordPress latest / PHP 8.2 (push) Canceled after 0s

* Refresh player with native block editor preview and local assets

Preserve shortcode rendering, normalize options, bundle the player locally,
and add reproducible packaging and WordPress integration tests.

* Fix emitted frontend boot and verify bundled runtime initialization

* Record verified WordPress 7.1.3 compatibility

* Use WordPress readme major-version compatibility format

* Add responsive player layout, captions and native terminal sizing

* Keep editor caption geometry stable during block selection

* Respect WordPress editor gutters with border-box sizing

* Improve automatic previews and toolbar terminal sizing (1.2.1)

* Show native cast dimensions and add Media Library recordings (1.2.2)

* Fix Media Library test storage and scope sidebar selectors

* Document bounded temporary-upload stream exceptions

* Move block explanations into collapsed sidebar help (1.2.3)

* Add bundled English and Simplified Chinese UI translations (1.1.0-dev)

* Use native RichText labels and supported Chinese HTML language tags in locale tests
This commit is contained in:
2026-10-14 15:56:05 +08:00
committed by GitHub
parent 40e2bf0733
commit 85e5ffa0ec
109 changed files with 32680 additions and 2090 deletions
+45
View File
@@ -0,0 +1,45 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import gettext from 'gettext-parser';
const po = gettext.po.parse(fs.readFileSync('languages/wp-asciiplayer-zh_CN.po'));
const mo = gettext.mo.parse(fs.readFileSync('languages/wp-asciiplayer-zh_CN.mo'));
const pot = gettext.po.parse(fs.readFileSync('languages/wp-asciiplayer.pot'));
const editor = JSON.parse(fs.readFileSync('languages/wp-asciiplayer-zh_CN-lamgc-asciiplayer-editor.json')).locale_data.messages;
const view = JSON.parse(fs.readFileSync('languages/wp-asciiplayer-zh_CN-lamgc-asciiplayer-view.json')).locale_data.messages;
test('all extracted strings and gettext contexts round-trip through MO and both script catalogs', () => {
let count = 0;
for (const [context, entries] of Object.entries(pot.translations)) {
for (const entry of Object.values(entries)) {
if (!entry.msgid) continue;
count++;
const translated = po.translations[context][entry.msgid].msgstr;
assert.ok(translated[0]);
assert.deepEqual(mo.translations[context][entry.msgid].msgstr, translated);
const key = context ? `${context}\u0004${entry.msgid}` : entry.msgid;
assert.deepEqual(editor[key], translated);
assert.deepEqual(view[key], translated);
}
}
assert.ok(count >= 75);
});
test('catalogs use Chinese plural rules, exact locale, and standard WordPress textdomain', () => {
assert.equal(po.headers.language, 'zh_CN');
assert.equal(mo.headers.language, 'zh_CN');
assert.equal(editor[''].lang, 'zh_CN');
assert.equal(editor[''].domain, 'wp-asciiplayer');
assert.equal(editor['']['plural-forms'], 'nplurals=1; plural=0;');
assert.equal(editor['block title\u0004Asciicast Player'][0], 'Asciicast 播放器');
assert.equal(editor['Recording URL'][0], '录制文件 URL');
});
test('Unicode, punctuation, percentages and literal author content are preserved', () => {
assert.equal(editor['Add a caption…'][0], '添加说明文字…');
assert.match(editor['Use a CSS length, such as 480px or 65%. The player stays within its available space.'][0], /480px.*65%/);
assert.equal(editor['Author caption / 作者说明'], undefined);
const serialized = JSON.stringify(editor);
assert.deepEqual(JSON.parse(serialized), editor);
});