refactor(i18n): 移除 chrome.i18n 国际化,统一使用中文硬编码

移除 chromeI18n 工具、_locales 翻译文件和 manifest default_locale 配置,
将所有 UI 文案改为直接硬编码中文,并更新相关测试与文档。
This commit is contained in:
雨霖铃
2026-06-18 14:22:14 +00:00
parent 618f3c36f2
commit ec92afa294
68 changed files with 531 additions and 2148 deletions
+5 -7
View File
@@ -4,7 +4,6 @@ import { copyTextToClipboard } from '@/utils/clipboard';
import { cn } from '@/lib/utils';
import { buttonVariants, type ButtonProps } from '@/components/ui/button';
import { toast } from 'sonner';
import { useI18n } from '@/utils/chromeI18n';
interface CopyButtonProps extends Omit<ButtonProps, 'children' | 'onClick'> {
text: string;
@@ -19,7 +18,6 @@ export const CopyButton: React.FC<CopyButtonProps> = ({
className,
...props
}) => {
const { t } = useI18n('common');
const [copied, setCopied] = useState(false);
const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
@@ -33,18 +31,18 @@ export const CopyButton: React.FC<CopyButtonProps> = ({
e.stopPropagation();
if (!text) {
toast.error(t('messages.copyEmpty'));
toast.error('无内容可复制');
return;
}
const success = await copyTextToClipboard(text);
if (success) {
toast.success(t('messages.copySuccess'));
toast.success('已复制到剪贴板');
setCopied(true);
if (timerRef.current) clearTimeout(timerRef.current);
timerRef.current = setTimeout(() => setCopied(false), 1500);
} else {
toast.error(t('messages.copyError'));
toast.error('复制失败');
}
};
@@ -52,8 +50,8 @@ export const CopyButton: React.FC<CopyButtonProps> = ({
<button
type="button"
onClick={handleCopy}
title={tooltip ?? t('buttons.copy')}
aria-label={tooltip ?? t('buttons.copy')}
title={tooltip ?? '复制'}
aria-label={tooltip ?? '复制'}
className={cn(
buttonVariants({ variant, size }),
copied &&