fix(i18n): 清除剩余硬编码英文文案并接入字典

消除 canvas 页 2 处 aria-label 与 Unlink 按钮、LanguageSwitcher aria、QueueStage "Clip #"、StoryStage "New beat"、JobInputsDrawer "Job #" 等硬编码英文;en/zh 字典同步新增 6 组 key 保持对齐。npm run check 0 errors。
This commit is contained in:
happymy
2026-09-13 08:19:24 +08:00
parent ba99cb4929
commit 389b4c0db7
7 changed files with 20 additions and 7 deletions
@@ -1,11 +1,12 @@
<script lang="ts">
import { language, setLanguage, type Language } from '$lib/i18n.svelte';
import { t } from '$lib/i18n.svelte';
</script>
<select
class="lang-switcher"
value={language.current}
aria-label="Language"
aria-label={t('common.language')}
onchange={(e) => setLanguage(e.currentTarget.value as Language)}
>
<option value="en">English</option>
@@ -166,7 +166,7 @@
for (const sc of scenes) {
if (sc.video_path) {
opts.push({
label: `Clip #${sc.order_index} · ${sc.heading || t('queue.sceneLabel')}`,
label: `${t('queue.clipLabel', { n: sc.order_index })} · ${sc.heading || t('queue.sceneLabel')}`,
path: sc.video_path,
kind: 'video',
group: 'clip',
@@ -216,7 +216,7 @@
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
order_index: nextIndex,
title: `New beat ${nextIndex}`,
title: t('story.newBeat', { n: nextIndex }),
description: '',
}),
});
@@ -215,7 +215,7 @@ function applyToScene() {
{/if}
<div class="job-head">
<span class="job-meta">Job #{activeJob.id}</span>
<span class="job-meta">{t('queue.jobLabel', { n: activeJob.id })}</span>
<span class="job-meta">·</span>
<span class="job-meta">{activeJob.status}</span>
{#if activeJob.completed_at}
+6
View File
@@ -24,6 +24,7 @@ export const en = {
'common.send': 'Send',
'common.stop': 'Stop',
'common.title': 'Title',
'common.language': 'Language',
// --- App shell / nav ---
'nav.canvas': 'AI Canvas',
@@ -248,6 +249,8 @@ export const en = {
'canvas.sessionDeleted': 'Session deleted',
'canvas.chatUnlinked': 'Chat unlinked — moved to Sandbox',
'canvas.unlinkFailed': 'Unlink failed',
'canvas.unlinkButton': 'Unlink',
'canvas.resizePanel': 'Resize chat panel (drag or arrow keys), currently {width} pixels',
'canvas.sendFailed': 'Failed to send',
'canvas.runCancelled': 'Run cancelled',
'canvas.cancelFailed': 'Cancel failed',
@@ -416,6 +419,7 @@ export const en = {
'story.saveSettingsFailed': 'Could not save settings',
'story.settingsTitle': 'Story settings',
'story.llmBanner': 'The story stage uses the active LLM to draft and refine beats.',
'story.newBeat': 'New beat {n}',
// --- Assets stage ---
'assets.title': 'Assets',
@@ -610,6 +614,8 @@ export const en = {
// --- Queue stage ---
'queue.sceneLabel': 'Scene',
'queue.clipLabel': 'Clip #{n}',
'queue.jobLabel': 'Job #{n}',
'queue.scene': 'Scene {n}',
'queue.sceneRef': 'Scene reference',
'queue.clipRef': 'Clip reference',
+6
View File
@@ -26,6 +26,7 @@ export const zh: Dict = {
'common.send': '发送',
'common.stop': '停止',
'common.title': '标题',
'common.language': '语言',
// --- App shell / nav ---
'nav.canvas': 'AI 画布',
@@ -248,6 +249,8 @@ export const zh: Dict = {
'canvas.sessionDeleted': '对话已删除',
'canvas.chatUnlinked': '对话已取消关联——已移至沙盒',
'canvas.unlinkFailed': '取消关联失败',
'canvas.unlinkButton': '解除关联',
'canvas.resizePanel': '调整对话面板大小(拖拽或方向键),当前 {width} 像素',
'canvas.sendFailed': '发送失败',
'canvas.runCancelled': '运行已取消',
'canvas.cancelFailed': '取消失败',
@@ -416,6 +419,7 @@ export const zh: Dict = {
'story.saveSettingsFailed': '无法保存设置',
'story.settingsTitle': '故事设置',
'story.llmBanner': '故事阶段使用当前激活的大语言模型来起草和润色节拍。',
'story.newBeat': '新节拍 {n}',
// --- Assets stage ---
'assets.title': '素材',
@@ -610,6 +614,8 @@ export const zh: Dict = {
// --- Queue stage ---
'queue.sceneLabel': '场景',
'queue.clipLabel': '片段 #{n}',
'queue.jobLabel': '任务 #{n}',
'queue.scene': '场景 {n}',
'queue.sceneRef': '场景参考',
'queue.clipRef': '片段参考',
@@ -1035,10 +1035,10 @@ title={running
: activeSession
? t('canvas.unlinkFrom', { title: canvas.project.title })
: t('canvas.noChatYet')}
aria-label={`Unlink this chat from ${canvas.project.title}`}
aria-label={t('canvas.unlinkFrom', { title: canvas.project.title })}
>
<Icon name="link-off" size={12} />
Unlink
{t('canvas.unlinkButton')}
</button>
{:else}
<span class="sandbox-chip">
@@ -1097,7 +1097,7 @@ title={running
type="button"
class="chat-splitter"
class:dragging
aria-label={`Resize chat panel (drag or arrow keys), currently ${Math.round(chatWidth)} pixels`}
aria-label={t('canvas.resizePanel', { width: Math.round(chatWidth) })}
onmousedown={startDrag}
onkeydown={(e) => {
if (e.key === 'ArrowLeft') {