From ffa68dc3564259a5763ae6501fa11690b9da932f Mon Sep 17 00:00:00 2001 From: James Pine Date: Mon, 20 Apr 2026 03:04:25 -0700 Subject: [PATCH] feat(i18n): localize history item and story item dropdown menus Covers the "..." action menu on both the History table (Play, Export Audio, Export Package, Apply Effects, Regenerate, Delete) and on individual story chat items (Play from here, Remove from Story). Co-Authored-By: Claude Opus 4.7 (1M context) --- app/src/components/History/HistoryTable.tsx | 15 +++++++-------- app/src/components/StoriesTab/StoryChatItem.tsx | 13 ++++++++++--- app/src/i18n/locales/en/translation.json | 12 ++++++++++++ app/src/i18n/locales/zh-CN/translation.json | 12 ++++++++++++ 4 files changed, 41 insertions(+), 11 deletions(-) diff --git a/app/src/components/History/HistoryTable.tsx b/app/src/components/History/HistoryTable.tsx index 605abe32..8aa47f53 100644 --- a/app/src/components/History/HistoryTable.tsx +++ b/app/src/components/History/HistoryTable.tsx @@ -673,7 +673,7 @@ export function HistoryTable() { variant="ghost" size="icon" className="h-6 w-6 text-muted-foreground/50 hover:bg-muted-foreground/20 hover:text-muted-foreground" - aria-label="Actions" + aria-label={t('history.actions.menu')} disabled={isGenerating} > @@ -684,37 +684,36 @@ export function HistoryTable() { onClick={() => handlePlay(gen.id, gen.text, gen.profile_id)} > - Play + {t('history.actions.play')} handleDownloadAudio(gen.id, gen.text)} disabled={exportGenerationAudio.isPending} > - Export Audio + {t('history.actions.exportAudio')} handleExportPackage(gen.id, gen.text)} disabled={exportGeneration.isPending} > - Export Package + {t('history.actions.exportPackage')} handleApplyEffects(gen.id)}> - Apply Effects + {t('history.actions.applyEffects')} handleRegenerate(gen.id)}> - Regenerate + {t('history.actions.regenerate')} handleDeleteClick(gen.id, gen.profile_name)} disabled={deleteGeneration.isPending} - // className="text-destructive focus:text-destructive" > - Delete + {t('common.delete')} diff --git a/app/src/components/StoriesTab/StoryChatItem.tsx b/app/src/components/StoriesTab/StoryChatItem.tsx index 7055e136..8ae49b0d 100644 --- a/app/src/components/StoriesTab/StoryChatItem.tsx +++ b/app/src/components/StoriesTab/StoryChatItem.tsx @@ -2,6 +2,7 @@ import { useSortable } from '@dnd-kit/sortable'; import { CSS } from '@dnd-kit/utilities'; import { GripVertical, Mic, MoreHorizontal, Play, Trash2 } from 'lucide-react'; import { useState } from 'react'; +import { useTranslation } from 'react-i18next'; import { Button } from '@/components/ui/button'; import { DropdownMenu, @@ -34,6 +35,7 @@ export function StoryChatItem({ dragHandleProps, isDragging, }: StoryChatItemProps) { + const { t } = useTranslation(); const seek = useStoryStore((state) => state.seek); const serverUrl = useServerStore((state) => state.serverUrl); const [avatarError, setAvatarError] = useState(false); @@ -118,21 +120,26 @@ export function StoryChatItem({
- - Play from here + {t('storyContent.itemActions.playFromHere')} - Remove from Story + {t('storyContent.itemActions.removeFromStory')} diff --git a/app/src/i18n/locales/en/translation.json b/app/src/i18n/locales/en/translation.json index 5581e49a..53e89764 100644 --- a/app/src/i18n/locales/en/translation.json +++ b/app/src/i18n/locales/en/translation.json @@ -104,6 +104,10 @@ "title": "No items in this story", "hint": "Generate speech using the box below to add items" }, + "itemActions": { + "playFromHere": "Play from here", + "removeFromStory": "Remove from Story" + }, "toast": { "removeFailed": "Failed to remove item", "reorderFailed": "Failed to reorder items", @@ -112,6 +116,14 @@ } }, "history": { + "actions": { + "menu": "Actions", + "play": "Play", + "exportAudio": "Export Audio", + "exportPackage": "Export Package", + "applyEffects": "Apply Effects", + "regenerate": "Regenerate" + }, "deleteDialog": { "title": "Delete Generation", "body": "Are you sure you want to delete this generation from \"{{name}}\"? This action cannot be undone.", diff --git a/app/src/i18n/locales/zh-CN/translation.json b/app/src/i18n/locales/zh-CN/translation.json index a2cfb4b9..d1ce7eac 100644 --- a/app/src/i18n/locales/zh-CN/translation.json +++ b/app/src/i18n/locales/zh-CN/translation.json @@ -104,6 +104,10 @@ "title": "此故事暂无项目", "hint": "使用下方输入框生成语音以添加项目" }, + "itemActions": { + "playFromHere": "从此处播放", + "removeFromStory": "从故事中移除" + }, "toast": { "removeFailed": "移除项目失败", "reorderFailed": "重新排序项目失败", @@ -112,6 +116,14 @@ } }, "history": { + "actions": { + "menu": "操作", + "play": "播放", + "exportAudio": "导出音频", + "exportPackage": "导出包", + "applyEffects": "应用效果", + "regenerate": "重新生成" + }, "deleteDialog": { "title": "删除生成", "body": "确定要删除来自 \"{{name}}\" 的这次生成吗?此操作不可撤销。",