Commit graph

5 commits

Author SHA1 Message Date
spearzificial
ab0179545a docs: record the measurement traps and script them
Coverage was over-reported twice, both times by measuring the wrong thing:
once by scanning a plugin root instead of the served bundle set, once with a
non-global regex that returned one hit per file instead of a character count.
Both produced a confident "100%" while the interface was still Chinese, so
the measurement is now part of the repo instead of being done by eye.

- scripts/served.mjs resolves the boot HTML's combo URLs to the on-disk files
  the browser receives, searching lib/, client/, dist/ and the package root.
- scripts/measure.mts counts Chinese on the runtime output, decoding \uXXXX
  and separating comment text from text that renders.
- README documents the merge order, the comment dictionary, and both traps.
2026-10-18 22:33:30 +05:30
spearzificial
b865825c51 docs: describe both translation seams and the merged dictionary order 2026-10-15 23:44:53 +05:30
spearzificial
e3962c1591 fix: translate plugin bundles at the transport layer
The plugin never translated anything. Its client half monkey-patched locale
internals that do not mutate the locale snapshot, and its DOM walker was
disabled after it crashed the marketplace UI. Nothing else was left.

Move translation to the bundle transport instead. Every third-party bundle is
served through /plugins/ by the clientModules service, so wrapping
bundleResource reaches all of them before any code runs, with no client-side
ordering race and no React tree mutation.

Two bugs surfaced while verifying against the live server:

- The script check tested the path before the query string, but combo requests
  are /plugins/??a/client.js,b/client.js&rev=... where the path is just
  /plugins/. Every request was rejected.
- bundleResource yields a Buffer, not a string, so the string guard rejected
  every request a second time.

Rewriting is all-or-nothing per literal: Chinese has no word boundaries, so
replacing known keys wherever they appear corrupts larger words (当前工作区
became "Saat IniWorkspace"). A literal is translated only when every Chinese
character is covered by a dictionary entry. Two upstream entries were Malay
rather than English and are now corrected.

Each rewritten bundle is parsed with new Function before being served; if that
fails the original bytes are returned, so a bad dictionary entry cannot break
the UI. Verified against the live bundles: both combos compile, and a browser
A/B shows 105 Chinese characters in the Plugins view without the plugin and 0
with it.

The dictionary grows to 1,195 entries (45% of literals, zero partial rewrites)
via a curated supplement merged last so it overrides harvested sources.
2026-10-15 22:53:20 +05:30
53f3639814 chore: rename package to chinese2english 2026-10-11 18:33:25 +05:30
519ffefaef feat: initial commit of dsh-plugin-english 2026-10-11 16:57:03 +05:30