feat(i18n): localize plugin catalog names and shell preset desc
Catalog entry names (15 tab + 4 viewer) and the dsh-desktop shell preset
desc were raw hardcoded zh strings rendered straight into the add-plugin
modals and the title-bar scheme dropdown. Mirror the existing desc
pattern exactly: PluginEntry.name / ShellPreset.desc widen to the
i18n-friendly string-or-() =>-string union, the catalogs carry lazy
t('pluginXxxName') / t('presetDshDesktopDesc') lookups, and the
add-plugin modal (render, search filter, aria-labels) plus the scheme
SelectMenu resolve them like every other copy. The plain-string arm of
the union stays as the raw-name fallback, and t() itself never yields
empty text (missing keys render the key), so a dict gap can never blank
a name.
20 new dictionary keys added to zh/en (locales.ts), ja (locales-ja.ts),
and all 18 third-language dictionaries — tests/locales.spec.ts enforces
key-set equality against zh for every shipped dict (precedent: 9cc642b),
so the 'leave other locales-* untouched' shortcut would fail the hard
parity gate; real translations are provided instead.
Spec follow-ups (behavior change: names/descs now render through t()):
- plugin-list.spec.ts: name non-empty assertion resolves the union.
- add-plugin-modal.spec.tsx: sentinel/office name assertions resolve
from the catalog (en locale in tests) instead of pinning zh literals.
- shell-presets.spec.ts: desc non-empty assertion resolves the union.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
* 100+ GitHub stars (a real user base). The mechanism is opt-in: auto
|
||||
* detection never applies a preset — the settings badge only SUGGESTS it.
|
||||
*/
|
||||
import { t } from './locales.ts'
|
||||
import type { DesktopEnv } from './desktop-env.ts'
|
||||
|
||||
export interface ShellPreset {
|
||||
@@ -17,8 +18,10 @@ export interface ShellPreset {
|
||||
readonly id: string
|
||||
/** User-facing name of the shell. */
|
||||
readonly title: string
|
||||
/** One-line description shown in the settings popup. */
|
||||
readonly desc: string
|
||||
/** One-line description shown in the settings popup (i18n friendly:
|
||||
* string or () => string — the plain string form is the raw-text
|
||||
* fallback when no dictionary key covers the preset). */
|
||||
readonly desc: string | (() => string)
|
||||
/**
|
||||
* The top strip (px) this shell reserves over web content, per
|
||||
* environment — the fallback used when neither the standard WCO API nor
|
||||
@@ -53,7 +56,7 @@ export interface ShellPreset {
|
||||
const DSH_DESKTOP: ShellPreset = {
|
||||
id: 'dsh-desktop',
|
||||
title: 'DeepSeek Harness Desktop',
|
||||
desc: 'Electron 高级模式(无边框):macOS 顶栏 20px、Windows 无 WCO 时 32px 标题栏让位',
|
||||
desc: () => t('presetDshDesktopDesc'),
|
||||
stripFor: (env) => {
|
||||
if (env.mode !== 'advanced') return undefined
|
||||
if (env.platform === 'darwin') return 20
|
||||
|
||||
Reference in New Issue
Block a user