refactor: 完成全站国际化改造,统一多语言支持
此提交完成了全项目的国际化适配: 1. 新增多语言翻译文件与基础配置 2. 替换所有硬编码文本为i18n调用 3. 优化语言切换与文档语言同步逻辑 4. 重构部分业务逻辑以支持动态翻译 5. 移除过时代码与硬编码配置
This commit is contained in:
@@ -32,3 +32,13 @@ const LABELS: Record<string, string> = {
|
||||
export function playLabelZh(playCode: string): string {
|
||||
return LABELS[playCode] ?? playCode;
|
||||
}
|
||||
|
||||
export function playLabel(
|
||||
playCode: string,
|
||||
t?: (key: string, options?: { defaultValue?: string }) => string,
|
||||
): string {
|
||||
if (!t) {
|
||||
return playLabelZh(playCode);
|
||||
}
|
||||
return t(`playLabels.${playCode}`, { defaultValue: LABELS[playCode] ?? playCode });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user