Add post: No API for Browser Translation (EN + ZH)
Deploy / build (push) Successful in 23s

This commit is contained in:
2026-09-29 01:02:42 +08:00
parent 416246cc68
commit 8a9ba6af1b
6 changed files with 394 additions and 0 deletions
+21
View File
@@ -685,6 +685,27 @@ BANNERS['read-only-nocodb-dashboard-for-a-remote-database'] = {
],
};
BANNERS['adding-english-mode-to-a-chinese-only-web-app'] = {
titlebar: 'root@dsm — reader-gateway · nginx:alpine',
lines: [
{ t: 'prompt', text: '$' }, { t: 'cmd', text: 'curl -s book.hoelee.com/index.html | head -1' },
{ t: 'err', text: '<html lang="en"> ← but the UI is 100% Chinese' },
{ t: 'dim', text: 'browsers key the translate prompt off that attribute' },
{ t: 'prompt', text: '$' }, { t: 'cmd', text: 'sub_filter lang="en" → lang="zh-CN"' },
{ t: 'hl', text: 'no API exists to trigger browser translation from JS' },
{ t: 'cmd', text: 'gate-en.js · 871 zh→en labels · longest-first matching' },
{ t: 'dim', text: 'MutationObserver follows the Vue re-renders' },
{ t: 'ok', text: '→ 88% of UI labels English · app untouched ✓' },
],
flow: [
{ n: '1', label: 'Chinese-only SPA' },
{ n: '2', label: 'lang="en" lie', err: true },
{ n: '3', label: 'fix at the proxy' },
{ n: '4', label: 'EN pill + dictionary' },
{ n: '5', label: 'English UI ✓' },
],
};
// ---------- read frontmatter ----------
const postPath = join(ROOT, 'src', 'content', 'posts', `${slug}.md`);
let category = 'devops';
+5
View File
@@ -214,6 +214,11 @@ TERMINALS['upgrading-codeigniter-46-to-47'] = `
<div class="line"><span class="prompt">&nbsp;</span><span class="err">Undefined property Config\\App::$permittedURIChars → 500</span></div>
<div class="line"><span class="prompt">$</span><span class="cmd">merge project-space configs by hand</span><span class="fix">→ report renders ✓</span></div>`;
TERMINALS['adding-english-mode-to-a-chinese-only-web-app'] = `
<div class="line"><span class="prompt">$</span><span class="cmd">curl -s book.hoelee.com/index.html | grep -o lang=</span><span class="err">→ "en"</span></div>
<div class="line"><span class="prompt">&nbsp;</span><span class="err">the UI is 100% Chinese · browsers then never offer translate</span></div>
<div class="line"><span class="prompt">$</span><span class="cmd">nginx sub_filter + gate-en.js · 871 zh→en labels</span><span class="fix">→ 88% English ✓</span></div>`;
// ---------- read frontmatter ----------
const postPath = join(ROOT, 'src', 'content', 'posts', `${slug}.md`);
if (!existsSync(postPath)) {