From 8b6bac9f2c8316cb4a7ceab5bf0e5d0b1751e053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=A8=E9=9C=96=E9=93=83?= Date: Thu, 28 May 2026 19:23:57 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=E8=AF=AD?= =?UTF-8?q?=E8=A8=80=E5=88=87=E6=8D=A2=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit chrome.i18n 语言由浏览器设置决定,不支持运行时切换,移除 TopBar 中的语言切换按钮及相关逻辑。 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- components/TopBar.tsx | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/components/TopBar.tsx b/components/TopBar.tsx index bd02c25..dcf1e6e 100644 --- a/components/TopBar.tsx +++ b/components/TopBar.tsx @@ -2,7 +2,6 @@ import React, { useEffect, useMemo, useRef, useState } from 'react'; import { ArrowLeft, ExternalLink, - Globe, History, Monitor, Moon, @@ -17,7 +16,6 @@ import { FeatureConfig, FEATURES } from '@/config/features'; import { storageUtil } from '@/utils/chromeStorage'; import { openExtensionPage } from '@/utils/chromeTabs'; import { useI18n } from '@/utils/chromeI18n'; -import { normalizeLanguage, SUPPORTED_LANGUAGES } from '@/utils/chromeI18n'; import { cn } from '@/lib/utils'; // 1. 引入 shadcn 核心工具函数 // 常量配置抽取(无需写在全局变量或 styles 对象里) @@ -27,7 +25,7 @@ const SEARCH_HISTORY_DISPLAY = 5; export default function TopBar({ onOpenOptions }: { onOpenOptions: () => void }) { const { currentPage, goBack, navigateTo } = useRouter(); const { mode, setMode } = useThemeMode(); - const { t, i18n } = useI18n(['common', 'features']); + const { t } = useI18n(['common', 'features']); const [searchQuery, setSearchQuery] = useState(''); const [showResults, setShowResults] = useState(false); @@ -99,14 +97,6 @@ export default function TopBar({ onOpenOptions }: { onOpenOptions: () => void }) setShowResults(false); }; - const toggleLanguage = async () => { - const currentLng = normalizeLanguage(i18n.language); - const currentIndex = SUPPORTED_LANGUAGES.indexOf(currentLng); - const nextLng = SUPPORTED_LANGUAGES[(currentIndex + 1) % SUPPORTED_LANGUAGES.length]; - await i18n.changeLanguage(nextLng); - await storageUtil.set('app/language', nextLng); - }; - const cycleThemeMode = () => { const nextMap = { light: 'dark', dark: 'system', system: 'light' } as const; setMode(nextMap[mode]); @@ -272,9 +262,6 @@ export default function TopBar({ onOpenOptions }: { onOpenOptions: () => void }) {/* 右侧:操作区 */}
- - -