From 44ab8389d6fad13c55925dd007c4ed25fe8d80f2 Mon Sep 17 00:00:00 2001 From: happymy <598176144@qq.com> Date: Sat, 12 Sep 2026 15:56:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(i18n):=20=E4=BF=AE=E5=A4=8D=20{n}=20?= =?UTF-8?q?=E5=8D=A0=E4=BD=8D=E7=AC=A6=E6=8F=92=E5=80=BC=E6=96=AD=E8=A3=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit t() 按 {占位名} 逐名替换,但多数 count 语义键字典用 {n}、调用处传 count 或不传参,导致页面显示字面 "{n}"。t() 增加 count→{n} 约定,一次性修复 WorkflowsLibrary 统计、ProjectCard 相对时间、ActivityPanel、NavRail、MemoryPanel、ScriptStage、AssetsStage 等错配;queue.exportingSub/filmstrip.sceneClips/queue.scene/script.shotClipPlural 补 {n} 参数;queue.queueingProgress 与 queue.filmMeta 调用参数对齐字典;filmstrip.clipTitle 重写为 {scene}·镜头 {shot}·{time}。en/zh 983 keys 对齐,svelte-check 0 errors。 --- calliope-web/src/lib/components/QueueStage.svelte | 8 ++++---- calliope-web/src/lib/components/ScriptStage.svelte | 2 +- .../src/lib/components/video/SceneFilmstrip.svelte | 2 +- calliope-web/src/lib/i18n.svelte.ts | 2 ++ calliope-web/src/lib/i18n/en.ts | 6 +++--- calliope-web/src/lib/i18n/zh.ts | 2 +- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/calliope-web/src/lib/components/QueueStage.svelte b/calliope-web/src/lib/components/QueueStage.svelte index 05f69c17..0943037e 100644 --- a/calliope-web/src/lib/components/QueueStage.svelte +++ b/calliope-web/src/lib/components/QueueStage.svelte @@ -462,7 +462,7 @@ const generateOne = createMutation({ : [{ id: scene.id, key: String(scene.id) }]; for (const target of renderTargets) { done++; - batchNote = t('queue.queueingProgress', { current: done, total: totalClips }); + batchNote = t('queue.queueingProgress', { n: done, total: totalClips }); try { // Resolve like the per-clip button does: session pick → scene's stored // workflow → first enabled video workflow. A scene whose stored workflow @@ -977,7 +977,7 @@ const generateOne = createMutation({ label={exportProg?.message} /> -

{t('queue.exportingSub')}

+

{t('queue.exportingSub', { n: clipsReady })}

@@ -1038,7 +1038,7 @@ const generateOne = createMutation({ {@const exportUrl = assetUrl(exportPath)}
- {t('queue.filmMeta', { clips: exportClipCount, time: formatClock(totalSec) })} + {t('queue.filmMeta', { scenes: scenes.length, clips: exportClipCount, duration: formatClock(totalSec) })} {#if exportedAgo} · {t('queue.exportedAgo', { ago: exportedAgo })}{/if}
@@ -1069,7 +1069,7 @@ const generateOne = createMutation({ type="button" class="filmstrip-item" title={t('queue.editInTimeline', { - scene: entry.scene.heading || t('queue.scene'), + scene: entry.scene.heading || t('queue.scene', { n: entry.scene.order_index }), label: entry.label, })} onclick={() => editScene(entry.scene.id)} diff --git a/calliope-web/src/lib/components/ScriptStage.svelte b/calliope-web/src/lib/components/ScriptStage.svelte index 2ea3db7b..74f4f0a5 100644 --- a/calliope-web/src/lib/components/ScriptStage.svelte +++ b/calliope-web/src/lib/components/ScriptStage.svelte @@ -440,7 +440,7 @@ {(scene.clips ?? []).length} - {((scene.clips ?? []).length === 1 ? t('script.shotClipSingular') : t('script.shotClipPlural'))} + {((scene.clips ?? []).length === 1 ? t('script.shotClipSingular') : t('script.shotClipPlural', { n: (scene.clips ?? []).length }))} {#if (scene.clips ?? []).some((c) => c.clip_path)} · {t('script.renderedCount', { count: (scene.clips ?? []).filter((c) => c.clip_path).length })} {/if} diff --git a/calliope-web/src/lib/components/video/SceneFilmstrip.svelte b/calliope-web/src/lib/components/video/SceneFilmstrip.svelte index 64982230..3cb8e14d 100644 --- a/calliope-web/src/lib/components/video/SceneFilmstrip.svelte +++ b/calliope-web/src/lib/components/video/SceneFilmstrip.svelte @@ -73,7 +73,7 @@
): string { let s: string = dictionaries[language.current][key] ?? (en as Record)[key] ?? key; if (vars) { for (const [k, v] of Object.entries(vars)) s = s.replaceAll(`{${k}}`, String(v)); + // ponytail: count 语义占位统一为 {n};调用方传 count 即命中 + if (vars.count !== undefined) s = s.replaceAll('{n}', String(vars.count)); } return s; } \ No newline at end of file diff --git a/calliope-web/src/lib/i18n/en.ts b/calliope-web/src/lib/i18n/en.ts index a571db46..5b749fab 100644 --- a/calliope-web/src/lib/i18n/en.ts +++ b/calliope-web/src/lib/i18n/en.ts @@ -700,7 +700,7 @@ export const en = { // --- Filmstrip --- 'filmstrip.title': 'Filmstrip', - 'filmstrip.clipTitle': 'Clip {n}', + 'filmstrip.clipTitle': '{scene} · shot {shot} · {time}', 'filmstrip.scene': 'Scene', 'filmstrip.sceneClips': '{n} clips', 'filmstrip.prev': 'Previous clip', @@ -804,8 +804,8 @@ export const en = { 'wf.deleteTitle': 'Delete workflow', 'wf.deleteMessage': 'This workflow and its saved JSON will be deleted.', 'wf.analyzeRegister': 'Analyze & register', - 'wf.countImage': '{n} image', - 'wf.countVideo': '{n} video', + 'wf.countImage': '{n} images', + 'wf.countVideo': '{n} videos', 'wf.countSaved': '{n} saved', 'wf.profileH3': 'Use case', 'wf.profileProse': 'This workflow generates {kind} from a {target}.', diff --git a/calliope-web/src/lib/i18n/zh.ts b/calliope-web/src/lib/i18n/zh.ts index f2fea475..51da3e66 100644 --- a/calliope-web/src/lib/i18n/zh.ts +++ b/calliope-web/src/lib/i18n/zh.ts @@ -700,7 +700,7 @@ export const zh: Dict = { // --- Filmstrip --- 'filmstrip.title': '胶片条', - 'filmstrip.clipTitle': '片段 {n}', + 'filmstrip.clipTitle': '{scene} · 镜头 {shot} · {time}', 'filmstrip.scene': '场景', 'filmstrip.sceneClips': '{n} 个片段', 'filmstrip.prev': '上一个片段',