diff --git a/src/components/geek/Keyboard.astro b/src/components/geek/Keyboard.astro index 4a80b6d..2868976 100644 --- a/src/components/geek/Keyboard.astro +++ b/src/components/geek/Keyboard.astro @@ -21,7 +21,7 @@ const routes: Record = { g a文章 g g图库 g m瞬间 - /terminal终端彩蛋 + /terminal终端彩蛋 Esc关闭浮层 @@ -33,6 +33,10 @@ const routes: Record = { // 路由表由 data-routes 注入(module 脚本里 currentScript 恒为 null,不能走内联取参) const helpEl = document.getElementById('kbd-help') as HTMLElement & { dataset: { routes?: string } }; const routes: Record = JSON.parse(helpEl?.dataset.routes ?? '{}'); + // en 轨仅切换终端行词条(帮助表其余文案的双语化另行车道) + if (location.pathname === '/en' || location.pathname.startsWith('/en/')) { + document.querySelector('.k-term-desc')?.replaceChildren(document.createTextNode('terminal')); + } let chord = ''; let chordTimer: number | undefined; diff --git a/src/pages/en/terminal.astro b/src/pages/en/terminal.astro new file mode 100644 index 0000000..097aade --- /dev/null +++ b/src/pages/en/terminal.astro @@ -0,0 +1,6 @@ +--- +// en 轨薄壳:复用 /terminal 全部实现,仅切 locale(文案源见 terminal.astro 的 DICT) +import TerminalPage from '../terminal.astro'; +--- + + diff --git a/src/pages/terminal.astro b/src/pages/terminal.astro index 0735b58..e03a206 100644 --- a/src/pages/terminal.astro +++ b/src/pages/terminal.astro @@ -3,10 +3,32 @@ // 命令注册表唯一事实源;输出一律 DOM API + textContent(无 innerHTML,XSS 纪律) // 实现集提炼自 Phase 5b 预研(satnaing/terminal-portfolio 实读 + CodeNerve 反例) import BaseLayout from '../layouts/BaseLayout.astro'; + +interface Props { + locale?: 'zh' | 'en'; +} +const { locale = 'zh' } = Astro.props; + +// 静态层文案(script 层另有一套 dict,由 data-locale 运行时选取) +const T = locale === 'en' + ? { + desc: "wait4x's terminal easter egg: type help to explore", + welcome: 'wait4x terminal v1.0 —— type help to list available commands', + noscript: 'This easter egg needs JavaScript: the site is static with no runtime framework; this page is the only exception.', + aria_shell: 'interactive terminal easter egg', + aria_input: 'terminal command input', + } + : { + desc: 'wait4x 的终端彩蛋:help 开始探索', + welcome: 'wait4x terminal v1.0 —— 键入 help 查看可用命令', + noscript: '此彩蛋需要 JavaScript:静态站无运行时框架,仅此页例外。', + aria_shell: '交互终端彩蛋', + aria_input: '终端命令输入', + }; --- - -
+ +