Fix hardcoded text and add missing i18n translations in file manager

- Add 18 new translation keys for file manager sidebar and context menu operations
- Replace hardcoded Chinese text with t() function calls in FileManagerSidebar.tsx:
  * Toast messages for remove/unpin/clear operations
  * Context menu items for recent files, pinned files, and shortcuts
- Replace hardcoded Chinese text with t() function calls in FileManagerContextMenu.tsx:
  * Pin/unpin file menu items
  * Add to shortcuts menu item
  * Save to system menu items with dynamic count support
- Add bilingual support for all new strings (English and Chinese)
- Improve consistency with existing i18n patterns
This commit is contained in:
ZacharyZcR
2025-09-17 10:32:06 +08:00
parent 2a8133dc36
commit 8fd46f2383
4 changed files with 56 additions and 20 deletions

View File

@@ -262,10 +262,10 @@ export function FileManagerContextMenu({
menuItems.push({
icon: <ExternalLink className="w-4 h-4" />,
label: isMultipleFiles
? `保存 ${files.length} 个文件到系统`
: "保存到系统",
? t("fileManager.saveFilesToSystem", { count: files.length })
: t("fileManager.saveToSystem"),
action: () => onDragToDesktop(),
shortcut: isModernBrowser ? "选择位置保存" : "下载到默认位置"
shortcut: isModernBrowser ? t("fileManager.selectLocationToSave") : t("fileManager.downloadToDefaultLocation")
});
}
@@ -276,13 +276,13 @@ export function FileManagerContextMenu({
if (isCurrentlyPinned && onUnpinFile) {
menuItems.push({
icon: <Star className="w-4 h-4 fill-yellow-400" />,
label: "取消固定",
label: t("fileManager.unpinFile"),
action: () => onUnpinFile(files[0])
});
} else if (!isCurrentlyPinned && onPinFile) {
menuItems.push({
icon: <Star className="w-4 h-4" />,
label: "固定文件",
label: t("fileManager.pinFile"),
action: () => onPinFile(files[0])
});
}
@@ -292,7 +292,7 @@ export function FileManagerContextMenu({
if (isSingleFile && files[0].type === 'directory' && onAddShortcut) {
menuItems.push({
icon: <Bookmark className="w-4 h-4" />,
label: "添加到快捷方式",
label: t("fileManager.addToShortcuts"),
action: () => onAddShortcut(files[0].path)
});
}