Skip to content

Commit f8bb301

Browse files
authored
Merge pull request #535 from omdsh-dev/feat/i18n-catalog-names
feat(i18n): 目录项与 shell 预设文案词典化,兜底错误条改皮肤令牌链
2 parents 463e96b + e8834bd commit f8bb301

30 files changed

Lines changed: 520 additions & 60 deletions

src/client/SideCardSection.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -947,9 +947,11 @@ export function SideCardSection({ store, service }: SideCardSectionProps) {
947947
...getShellPresets().map(preset => ({
948948
value: `preset:${preset.id}`,
949949
title: preset.title,
950+
// The preset desc is i18n-friendly (string or () => string)
951+
// — resolve it like every other settings text here.
950952
desc: preset.detect?.(detectedEnv) === true
951-
? `${preset.desc}${t('settingsSchemeDetectedSuffix')})`
952-
: preset.desc,
953+
? `${textOf(preset.desc)}${t('settingsSchemeDetectedSuffix')})`
954+
: textOf(preset.desc),
953955
})),
954956
{ value: 'custom', title: t('settingsSchemeCustomTitle'), desc: t('settingsSchemeCustomDesc') },
955957
]}

src/client/add-plugin-modal.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ export function PluginListBody(props: { service: BetterSidebarService; kind: Plu
5656
const needle = query.trim().toLowerCase()
5757
const matches = (entry: PluginEntry): boolean => {
5858
if (needle === '') return true
59+
const name = typeof entry.name === 'function' ? entry.name() : entry.name
5960
const description = typeof entry.description === 'function' ? entry.description() : entry.description
60-
return entry.name.toLowerCase().includes(needle)
61+
return name.toLowerCase().includes(needle)
6162
|| entry.id.toLowerCase().includes(needle)
6263
|| description.toLowerCase().includes(needle)
6364
}
@@ -93,8 +94,12 @@ export function PluginListBody(props: { service: BetterSidebarService; kind: Plu
9394
window.open(entry.url, '_blank', 'noopener')
9495
}
9596

96-
/** One catalog row (extracted so the group render stays flat). */
97-
const renderEntry = (entry: PluginEntry): ReactNode => (
97+
/** One catalog row (extracted so the group render stays flat). The name
98+
* resolves like the description (string or () => string) so it follows
99+
* the active locale; a plain-string entry keeps its raw name. */
100+
const renderEntry = (entry: PluginEntry): ReactNode => {
101+
const name = typeof entry.name === 'function' ? entry.name() : entry.name
102+
return (
98103
<div key={entry.id} className={css.pluginEntry}>
99104
<div className={css.pluginEntryHead}>
100105
{/* The name is a BUTTON on the same window.open path as the
@@ -104,24 +109,24 @@ export function PluginListBody(props: { service: BetterSidebarService; kind: Plu
104109
<button
105110
type="button"
106111
className={css.pluginName}
107-
aria-label={`${t('openPlugin')}: ${entry.name}`}
112+
aria-label={`${t('openPlugin')}: ${name}`}
108113
onClick={() => { jump(entry) }}
109114
>
110-
{entry.name}
115+
{name}
111116
</button>
112117
<span className={css.pluginEntryActions}>
113118
<button
114119
type="button"
115120
className={css.pluginJumpBtn}
116-
aria-label={`${t('openPlugin')}: ${entry.name}`}
121+
aria-label={`${t('openPlugin')}: ${name}`}
117122
onClick={() => { jump(entry) }}
118123
>
119124
{t('openPlugin')}
120125
</button>
121126
<button
122127
type="button"
123128
className={css.pluginCopyBtn}
124-
aria-label={`${t('copyInstall')}: ${entry.name}`}
129+
aria-label={`${t('copyInstall')}: ${name}`}
125130
onClick={() => { copy(entry) }}
126131
>
127132
{copiedId === entry.id ? t('copied') : t('copy')}
@@ -133,7 +138,8 @@ export function PluginListBody(props: { service: BetterSidebarService; kind: Plu
133138
</div>
134139
<code className={css.pluginInstall}>{entry.install}</code>
135140
</div>
136-
)
141+
)
142+
}
137143

138144
return (
139145
<div className={css.pluginList}>

src/client/index.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,21 @@ export function apply(ctx: Context): void {
166166
)
167167
// A failure anywhere in the client lifecycle must never take the app down
168168
// silently: log with the plugin prefix and pin a visible diagnostic strip
169-
// to the page so a blank panel is never the only symptom.
169+
// to the page so a blank panel is never the only symptom. This strip is
170+
// the last-resort reporter (no CSS module is reachable from here), so its
171+
// colors go through skin token chains with the previous hexes as the
172+
// chain tails — worst case (no skin tokens on the page) it renders
173+
// byte-identical to the old hardcoded bar, and any `--dsw-alias-*` skin
174+
// re-themes it (guide §12: no hardcoded colors).
170175
const fail = (phase: string, error: unknown): void => {
171176
console.error(`[dsh-better-sidebar] ${phase} error:`, error)
172177
try {
173178
const bar = document.createElement('div')
174179
bar.style.cssText = 'position:fixed;left:8px;bottom:8px;z-index:2147483000;max-width:70vw;padding:8px 12px;'
175-
+ 'font:12px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;color:#f2a1a1;background:#1b1b22;'
176-
+ 'border:1px solid #f2a1a1;border-radius:8px;white-space:pre-wrap'
180+
+ 'font:12px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;'
181+
+ 'color:var(--dsw-alias-state-error-primary,#f2a1a1);'
182+
+ 'background:var(--dsw-alias-bg-layer-3,var(--dsw-alias-bg-base,#1b1b22));'
183+
+ 'border:1px solid var(--dsw-alias-state-error-primary,#f2a1a1);border-radius:8px;white-space:pre-wrap'
177184
bar.textContent = `[dsh-better-sidebar] ${phase} error: ${error instanceof Error ? error.message : String(error)}`
178185
document.body.appendChild(bar)
179186
} catch {

src/client/locales-ar.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,4 +422,24 @@ export const ar: Record<string, string> = {
422422
pluginDocsPanelDesc: '«وثائق عامة» في شريط DSH الجانبي: ملاحظات Markdown عامة، قابلة للقراءة من أي مساحة عمل — قائمة ملفات، مخطط تفصيلي، فتح في Chrome / VS Code، وأزرار نسخ؛ دليل الوثائق قابل للتكوين (الافتراضي ~/.dsh/docs)',
423423
pluginEgoBrowserDesc: 'متصفح الوكيل لـ DeepSeek Harness: 32 أداة ego_* تقود متصفح Chromium حقيقي، مع تبويب «متصفح ego» أصلي في الشريط الجانبي يعرض مباشرة كل صفحة يزورها الوكيل — يمكنك النقر والسحب والكتابة لتولي التحكم. يسجّل التبويب تلقائيًا عند وجود better-sidebar، وإلا يظهر كفقاعة عائمة',
424424
pluginBilingualReaderDesc: 'اقرأ ملفات PDF في الشريط الجانبي لـ DSH: عرض PDF أصلي، حدد نصًا لترجمته بواسطة النموذج اللغوي مع السياق، معزولًا تمامًا عن المحادثة الرئيسية',
425+
pluginSentinelName: 'dsh-sentinel نظام الاستيقاظ',
426+
pluginEgoBrowserName: 'ego-browser متصفح الوكيل',
427+
pluginBetterOverleafName: 'dsh-better-overleaf تبويب Overleaf',
428+
pluginDocsPanelName: 'dsh-docs-panel مستندات عامة',
429+
pluginFlowglassName: 'dsh-flowglass Flowglass',
430+
pluginGitForgeName: 'dsh-git-forge بيانات اعتماد Git',
431+
pluginGitRemotesName: 'dsh-git-remotes أجهزة Git البعيدة',
432+
pluginGithubWorkbenchName: 'dsh-github-workbench منصة GitHub',
433+
pluginSidebarQaName: 'dsh-sidebar-qa تحديد وسؤال',
434+
pluginSidenoteName: 'dsh-sidenote محادثة جانبية',
435+
pluginServerDeckName: 'dsh-server-deck لوحة الخوادم',
436+
pluginSuhuangScrollName: 'dsh-suhuang-scroll Suhuang Scroll',
437+
pluginSshTunnelName: 'dsh-ssh-tunnel نفق SSH',
438+
pluginTurnReviewName: 'dsh-turn-review مراجعة الجولة',
439+
pluginBilingualReaderName: 'dsh-bilingual-reader قارئ ثنائي اللغة',
440+
pluginOfficeName: 'معاينة Office',
441+
pluginMdExportName: 'تصدير Markdown',
442+
pluginCodeNavName: 'مستكشف معاينة الكود',
443+
pluginVideoPreviewName: 'معاينة الفيديو',
444+
presetDshDesktopDesc: 'وضع Electron المتقدم (بلا إطار): يحجز macOS شريطًا علويًا بمقدار 20px، ويحجز Windows بمقدار 32px لشريط العنوان عند غياب WCO',
425445
}

src/client/locales-de.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,4 +407,24 @@ export const de: Record<string, string> = {
407407
pluginDocsPanelDesc: '„Globale Dokumente“ in der DSH-Seitenleiste: eigene Markdown-Notizen aus jedem Arbeitsbereich lesen – Dateiliste, Gliederung, Öffnen in Chrome / VS Code und Kopieren-Buttons; das Dokumentenverzeichnis ist konfigurierbar (Standard ~/.dsh/docs)',
408408
pluginEgoBrowserDesc: 'Der Agent-Browser für DeepSeek Harness: 32 ego_*-Tools steuern ein echtes Chromium; ein nativer „ego-Browser“-Tab in der Seitenleiste zeigt live jede Seite, die der Agent besucht – Klicken, Ziehen und Tippen zum Übernehmen. Registriert den Tab automatisch, wenn better-sidebar vorhanden ist, sonst eine schwebende Blase',
409409
pluginBilingualReaderDesc: 'PDFs im DSH-Seitenbereich lesen: native PDF-Anzeige, Text auswählen und mit dem LLM übersetzen — mit Kontext, vollständig vom Hauptgespräch isoliert',
410+
pluginSentinelName: 'dsh-sentinel Wecksystem',
411+
pluginEgoBrowserName: 'ego-browser Agent-Browser',
412+
pluginBetterOverleafName: 'dsh-better-overleaf Overleaf-Tab',
413+
pluginDocsPanelName: 'dsh-docs-panel Globale Dokumente',
414+
pluginFlowglassName: 'dsh-flowglass Flowglass',
415+
pluginGitForgeName: 'dsh-git-forge Git-Zugangsdaten',
416+
pluginGitRemotesName: 'dsh-git-remotes Git-Remotes',
417+
pluginGithubWorkbenchName: 'dsh-github-workbench GitHub-Workbench',
418+
pluginSidebarQaName: 'dsh-sidebar-qa Auswählen & Fragen',
419+
pluginSidenoteName: 'dsh-sidenote Seiten-Chat',
420+
pluginServerDeckName: 'dsh-server-deck Server-Deck',
421+
pluginSuhuangScrollName: 'dsh-suhuang-scroll Suhuang Scroll',
422+
pluginSshTunnelName: 'dsh-ssh-tunnel SSH-Tunnel',
423+
pluginTurnReviewName: 'dsh-turn-review Runden-Review',
424+
pluginBilingualReaderName: 'dsh-bilingual-reader Zweisprachiger Reader',
425+
pluginOfficeName: 'Office-Vorschau',
426+
pluginMdExportName: 'Markdown-Export',
427+
pluginCodeNavName: 'Code-Vorschau-Navigation',
428+
pluginVideoPreviewName: 'Video-Vorschau',
429+
presetDshDesktopDesc: 'Elektronischer Erweiterte-Modus (rahmenlos): macOS reserviert oben 20px; Windows reserviert ohne WCO 32px für die Titelleiste',
410430
}

src/client/locales-fr.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,4 +414,24 @@ export const fr: Record<string, string> = {
414414
pluginDocsPanelDesc: '« Documentation globale » dans la barre latérale DSH : notes Markdown globales, lisibles depuis n’importe quel espace de travail — sélection dans la liste, saut via le plan flottant, ouverture externe Chrome / VS Code, copie de code, répertoire configurable (défaut ~/.dsh/docs)',
415415
pluginEgoBrowserDesc: 'Le navigateur d’agent pour DeepSeek Harness : 32 outils ego_* pilotent un vrai Chromium ; un onglet natif « ego browser » dans la barre latérale montre en direct chaque page visitée par l’agent — cliquez, glissez et tapez pour reprendre la main. Enregistre l’onglet automatiquement si better-sidebar est présent, sinon une bulle flottante',
416416
pluginBilingualReaderDesc: 'Lire des PDF dans la barre latérale DSH : affichage PDF natif, sélectionnez du texte pour le traduire avec le LLM, avec contexte et totalement isolé de la conversation principale',
417+
pluginSentinelName: 'dsh-sentinel Système de réveil',
418+
pluginEgoBrowserName: 'ego-browser Navigateur d’agents',
419+
pluginBetterOverleafName: 'dsh-better-overleaf Onglet Overleaf',
420+
pluginDocsPanelName: 'dsh-docs-panel Docs globales',
421+
pluginFlowglassName: 'dsh-flowglass Flowglass',
422+
pluginGitForgeName: 'dsh-git-forge Identifiants Git',
423+
pluginGitRemotesName: 'dsh-git-remotes Dépôts distants Git',
424+
pluginGithubWorkbenchName: 'dsh-github-workbench Atelier GitHub',
425+
pluginSidebarQaName: 'dsh-sidebar-qa Sélectionner & demander',
426+
pluginSidenoteName: 'dsh-sidenote Chat latéral',
427+
pluginServerDeckName: 'dsh-server-deck Tableau de bord serveurs',
428+
pluginSuhuangScrollName: 'dsh-suhuang-scroll Suhuang Scroll',
429+
pluginSshTunnelName: 'dsh-ssh-tunnel Tunnel SSH',
430+
pluginTurnReviewName: 'dsh-turn-review Revue du tour',
431+
pluginBilingualReaderName: 'dsh-bilingual-reader Lecteur bilingue',
432+
pluginOfficeName: 'Aperçu Office',
433+
pluginMdExportName: 'Exportation Markdown',
434+
pluginCodeNavName: 'Navigateur d’aperçu de code',
435+
pluginVideoPreviewName: 'Aperçu vidéo',
436+
presetDshDesktopDesc: 'Mode avancé Electron (sans bordure) : macOS réserve 20px en haut ; Windows réserve 32px pour la barre de titre sans WCO',
417437
}

src/client/locales-hi.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,4 +421,24 @@ export const hi: Record<string, string> = {
421421
pluginDocsPanelDesc: 'DSH साइडबार में ग्लोबल डॉक्स: किसी भी वर्कस्पेस से अपने Markdown नोट्स पढ़ें — फ़ाइल सूची, रूपरेखा, Chrome / VS Code में खोलें, और कॉपी बटन; docs डायरेक्टरी कॉन्फ़िगर करने योग्य (डिफ़ॉल्ट ~/.dsh/docs)',
422422
pluginEgoBrowserDesc: 'DeepSeek Harness के लिए एजेंट ब्राउज़र: 32 ego_* टूल असली Chromium चलाते हैं; साइडबार में नेटिव «ego browser» टैब एजेंट के हर विज़िट किए गए पेज को लाइव दिखाता है — आप क्लिक, ड्रैग और टाइप करके नियंत्रण ले सकते हैं। better-sidebar मौजूद होने पर टैब स्वतः रजिस्टर होता है, अन्यथा फ्लोटिंग बबल के रूप में दिखता है',
423423
pluginBilingualReaderDesc: 'DSH साइडबार में PDF पढ़ें: मूल PDF प्रदर्शन, टेक्स्ट चुनकर LLM से अनुवाद करें, संदर्भ के साथ और मुख्य संवाद से पूरी तरह अलग',
424+
pluginSentinelName: 'dsh-sentinel वेक-अप सिस्टम',
425+
pluginEgoBrowserName: 'ego-browser एजेंट ब्राउज़र',
426+
pluginBetterOverleafName: 'dsh-better-overleaf Overleaf टैब',
427+
pluginDocsPanelName: 'dsh-docs-panel ग्लोबल डॉक्स',
428+
pluginFlowglassName: 'dsh-flowglass Flowglass',
429+
pluginGitForgeName: 'dsh-git-forge Git क्रेडेंशियल',
430+
pluginGitRemotesName: 'dsh-git-remotes Git रिमोट',
431+
pluginGithubWorkbenchName: 'dsh-github-workbench GitHub वर्कबेंच',
432+
pluginSidebarQaName: 'dsh-sidebar-qa चुनें और पूछें',
433+
pluginSidenoteName: 'dsh-sidenote साइड चैट',
434+
pluginServerDeckName: 'dsh-server-deck सर्वर डेक',
435+
pluginSuhuangScrollName: 'dsh-suhuang-scroll Suhuang Scroll',
436+
pluginSshTunnelName: 'dsh-ssh-tunnel SSH टनल',
437+
pluginTurnReviewName: 'dsh-turn-review टर्न समीक्षा',
438+
pluginBilingualReaderName: 'dsh-bilingual-reader द्विभाषी रीडर',
439+
pluginOfficeName: 'Office प्रीव्यू',
440+
pluginMdExportName: 'Markdown एक्सपोर्ट',
441+
pluginCodeNavName: 'कोड प्रीव्यू नेविगेटर',
442+
pluginVideoPreviewName: 'वीडियो प्रीव्यू',
443+
presetDshDesktopDesc: 'Electron एडवांस्ड (फ्रेमलेस) मोड: macOS ऊपर 20px सुरक्षित रखता है; Windows WCO अनुपलब्ध होने पर टाइटल बार के लिए 32px रखता है',
424444
}

src/client/locales-id.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,4 +419,24 @@ export const id: Record<string, string> = {
419419
pluginDocsPanelDesc: 'Dokumen global di sidebar DSH: baca catatan Markdown Anda sendiri dari ruang kerja apa pun — daftar berkas, kerangka, buka di Chrome / VS Code, dan tombol salin; direktori docs dapat dikonfigurasi (default ~/.dsh/docs)',
420420
pluginEgoBrowserDesc: 'Browser agen untuk DeepSeek Harness: 32 alat ego_* menggerakkan Chromium sungguhan; tab «ego browser» native di bilah samping menampilkan langsung setiap halaman yang dikunjungi agen — Anda bisa mengklik, menyeret, dan mengetik untuk mengambil alih. Tab terdaftar otomatis jika better-sidebar terpasang; jika tidak, jatuh ke gelembung mengambang',
421421
pluginBilingualReaderDesc: 'Baca PDF di sidebar DSH: tampilan PDF asli, pilih teks untuk diterjemahkan dengan LLM, dengan konteks dan sepenuhnya terisolasi dari percakapan utama',
422+
pluginSentinelName: 'dsh-sentinel Sistem bangun',
423+
pluginEgoBrowserName: 'ego-browser Peramban agen',
424+
pluginBetterOverleafName: 'dsh-better-overleaf Tab Overleaf',
425+
pluginDocsPanelName: 'dsh-docs-panel Dokumen global',
426+
pluginFlowglassName: 'dsh-flowglass Flowglass',
427+
pluginGitForgeName: 'dsh-git-forge Kredensial Git',
428+
pluginGitRemotesName: 'dsh-git-remotes Remote Git',
429+
pluginGithubWorkbenchName: 'dsh-github-workbench Meja kerja GitHub',
430+
pluginSidebarQaName: 'dsh-sidebar-qa Pilih & tanya',
431+
pluginSidenoteName: 'dsh-sidenote Obrolan samping',
432+
pluginServerDeckName: 'dsh-server-deck Dek server',
433+
pluginSuhuangScrollName: 'dsh-suhuang-scroll Suhuang Scroll',
434+
pluginSshTunnelName: 'dsh-ssh-tunnel Terowongan SSH',
435+
pluginTurnReviewName: 'dsh-turn-review Tinjauan giliran',
436+
pluginBilingualReaderName: 'dsh-bilingual-reader Pembaca dwibahasa',
437+
pluginOfficeName: 'Pratinjau Office',
438+
pluginMdExportName: 'Ekspor Markdown',
439+
pluginCodeNavName: 'Navigator pratinjau kode',
440+
pluginVideoPreviewName: 'Pratinjau video',
441+
presetDshDesktopDesc: 'Mode Electron lanjutan (tanpa bingkai): macOS mencadangkan 20px di atas; Windows mencadangkan 32px untuk bilah judul saat WCO tidak tersedia',
422442
}

src/client/locales-it.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,4 +412,24 @@ export const it: Record<string, string> = {
412412
pluginDocsPanelDesc: 'Documenti globali nella barra laterale di DSH: legga le sue note Markdown da qualsiasi spazio di lavoro — una lista di file, una struttura, apertura in Chrome / VS Code e pulsanti di copia; la directory dei documenti è configurabile (predefinita ~/.dsh/docs)',
413413
pluginEgoBrowserDesc: 'Il browser agente per DeepSeek Harness: 32 strumenti ego_* pilotano un vero Chromium; una scheda nativa «ego browser» nella barra laterale mostra in tempo reale ogni pagina visitata dall’agente — puoi cliccare, trascinare e digitare per prendere il controllo. Registra la scheda automaticamente se better-sidebar è presente, altrimenti una bolla flottante',
414414
pluginBilingualReaderDesc: 'Leggi PDF nella barra laterale DSH: visualizzazione PDF nativa, seleziona il testo per tradurlo con l’LLM, con contesto e completamente isolato dalla conversazione principale',
415+
pluginSentinelName: 'dsh-sentinel Sistema di riattivazione',
416+
pluginEgoBrowserName: 'ego-browser Browser dell’agente',
417+
pluginBetterOverleafName: 'dsh-better-overleaf Scheda Overleaf',
418+
pluginDocsPanelName: 'dsh-docs-panel Documenti globali',
419+
pluginFlowglassName: 'dsh-flowglass Flowglass',
420+
pluginGitForgeName: 'dsh-git-forge Credenziali Git',
421+
pluginGitRemotesName: 'dsh-git-remotes Remote Git',
422+
pluginGithubWorkbenchName: 'dsh-github-workbench Banco di lavoro GitHub',
423+
pluginSidebarQaName: 'dsh-sidebar-qa Seleziona e chiedi',
424+
pluginSidenoteName: 'dsh-sidenote Chat laterale',
425+
pluginServerDeckName: 'dsh-server-deck Ponte server',
426+
pluginSuhuangScrollName: 'dsh-suhuang-scroll Suhuang Scroll',
427+
pluginSshTunnelName: 'dsh-ssh-tunnel Tunnel SSH',
428+
pluginTurnReviewName: 'dsh-turn-review Revisione del turno',
429+
pluginBilingualReaderName: 'dsh-bilingual-reader Lettore bilingue',
430+
pluginOfficeName: 'Anteprima Office',
431+
pluginMdExportName: 'Esportazione Markdown',
432+
pluginCodeNavName: 'Navigatore anteprima codice',
433+
pluginVideoPreviewName: 'Anteprima video',
434+
presetDshDesktopDesc: 'Modalità avanzata Electron (senza bordi): macOS riserva 20px in alto; Windows riserva 32px per la barra del titolo quando WCO non è disponibile',
415435
}

0 commit comments

Comments
 (0)