fix(i18n): use English runtime text and localize system UI

This commit is contained in:
Arthur Koba
2026-10-25 19:44:15 +03:00
parent ada0550571
commit 65a96670d5
289 changed files with 8092 additions and 3426 deletions
@@ -1,3 +1,4 @@
import { runtimeText } from '@/i18n/runtime';
/**
* 元旦/新年主题装饰组件归档
* 包含灯笼、福字以及烟花效果的集成组件
@@ -95,7 +96,7 @@ export const Lantern = ({ className }: { className?: string }) => (
fontWeight='bold'
fontFamily='serif'
>
福
{runtimeText('good_fortune_b3541887')}
</text>
<path d='M512 660V720' stroke='#FFD700' strokeWidth='20' />
@@ -186,7 +187,7 @@ export const FuCharacter = ({
style={{ letterSpacing: '0px' }}
transform='rotate(130 50 50)'
>
福
{runtimeText('good_fortune_b3541887')}
</text>
</g>
+5 -1
View File
@@ -1,3 +1,4 @@
import { useTranslations } from 'next-intl';
import * as React from 'react';
import { FileTextIcon } from 'lucide-react';
import { Button } from '@/components/ui/button';
@@ -128,10 +129,13 @@ export function EmptyStateWithBorder(props: EmptyStateProps) {
* @returns {React.ReactNode} 简化版空状态组件
*/
export function EmptyInline({
message = '暂无数据',
message = undefined,
icon: Icon = FileTextIcon,
className,
}: Pick<EmptyStateProps, 'icon' | 'className'> & { message?: string }) {
const rt = useTranslations('runtime');
message ??= rt('no_data_497c8569');
return (
<div
className={cn(
+17 -6
View File
@@ -1,3 +1,4 @@
import { useTranslations } from 'next-intl';
import * as React from 'react';
import { AlertCircle } from 'lucide-react';
import { Button } from '@/components/ui/button';
@@ -48,16 +49,23 @@ export interface ErrorDisplayProps {
* @returns {React.ReactNode} 错误展示组件
*/
export function ErrorDisplay({
title = '加载失败',
title = undefined,
message,
error,
onRetry,
retryText = '重试',
retryText = undefined,
icon: Icon = AlertCircle,
className,
showStack = false,
}: ErrorDisplayProps) {
const errorMessage = message || error?.message || '发生未知错误,请稍后重试';
const rt = useTranslations('runtime');
title ??= rt('load_failed_d1d04482');
retryText ??= rt('retry_b8784c8d');
const errorMessage =
message ||
error?.message ||
rt('an_unknown_error_occurred_please_try_again_79a9f98a');
return (
<div
@@ -85,7 +93,7 @@ export function ErrorDisplay({
{showStack && error?.stack && process.env.NODE_ENV === 'development' && (
<details className='mt-6 text-left max-w-2xl w-full'>
<summary className='cursor-pointer text-xs text-muted-foreground hover:text-foreground'>
查看详细错误信息
{rt('view_error_details_9e7e4e37')}
</summary>
<pre className='mt-2 p-4 bg-muted rounded-lg text-xs overflow-auto'>
{error.stack}
@@ -115,7 +123,10 @@ export function ErrorInline({
onRetry,
className,
}: Omit<ErrorDisplayProps, 'title' | 'icon' | 'showStack'>) {
const errorMessage = message || error?.message || '发生未知错误';
const rt = useTranslations('runtime');
const errorMessage =
message || error?.message || rt('unknown_error_e83a8ca8');
return (
<div
@@ -133,7 +144,7 @@ export function ErrorInline({
size='sm'
className='h-6 px-4 text-xs'
>
重试
{rt('retry_b8784c8d')}
</Button>
)}
</div>
+7 -2
View File
@@ -1,3 +1,4 @@
import { useTranslations } from 'next-intl';
import * as React from 'react';
import { motion } from 'motion/react';
import { cn } from '@/lib/utils';
@@ -87,12 +88,16 @@ interface LoadingStateProps extends React.ComponentProps<'div'> {
* 用于统一显示加载中的状态
*/
export function LoadingState({
title = '加载中',
description = '正在获取活动数据...',
title = undefined,
description = undefined,
icon: Icon = FileTextIcon,
className,
iconSize = 'md',
}: LoadingStateProps) {
const rt = useTranslations('runtime');
title ??= rt('loading_d04fcbda');
description ??= rt('fetching_data_9ac5e428');
const iconSizes = { sm: 'size-8', md: 'size-10', lg: 'size-14' };
const iconInnerSizes = { sm: 'size-4', md: 'size-5', lg: 'size-7' };