feat(frontend): add next-intl bilingual i18n for core paths

Wire next-intl without locale routes, add zh-CN/en catalogs, language
switcher, and migrate layout/auth/settings UI copy. Document i18n rules
in AGENTS.md and keep static export builds working.
This commit is contained in:
ryan
2026-07-24 16:25:41 +08:00
parent 9c1369186f
commit 1625cfb2fb
23 changed files with 1638 additions and 355 deletions
+11 -9
View File
@@ -1,6 +1,7 @@
'use client';
import * as React from 'react';
import { useTranslations } from 'next-intl';
import { RefreshCwIcon } from 'lucide-react';
import { Button } from '@/components/ui/button';
@@ -33,12 +34,11 @@ export function OTPForm({
onResend,
onSubmit,
}: OTPFormProps) {
const t = useTranslations('auth.otp');
return (
<div className='flex flex-col gap-6 [@media(max-height:700px)]:gap-4'>
<AuthHeading
title='验证您的登录'
description='输入发送到安全邮箱的 6 位验证码。'
/>
<AuthHeading title={t('title')} description={t('description')} />
{loginCodeTip ? (
<p className='text-sm leading-6 text-muted-foreground'>
{loginCodeTip}
@@ -51,7 +51,7 @@ export function OTPForm({
htmlFor='otp-verification'
className='text-sm font-medium'
>
验证码
{t('code')}
</FieldLabel>
<Button
variant='outline'
@@ -62,7 +62,9 @@ export function OTPForm({
className='h-8 text-xs'
>
<RefreshCwIcon className={cn(isPending && 'animate-spin')} />
{loginCooldown > 0 ? `${loginCooldown}秒后重发` : '重新发送'}
{loginCooldown > 0
? t('resendIn', { seconds: loginCooldown })
: t('resend')}
</Button>
</div>
<div className='flex justify-start'>
@@ -96,15 +98,15 @@ export function OTPForm({
onClick={onSubmit}
disabled={isPending || code.length < 6}
>
{isPending ? '验证中...' : '验证'}
{isPending ? t('submitting') : t('submit')}
</Button>
<div className='text-center text-sm text-muted-foreground'>
遇到登录问题?{' '}
{t('help')}{' '}
<a
href='#'
className='underline underline-offset-4 transition-colors hover:text-primary'
>
联系客服
{t('contactSupport')}
</a>
</div>
</div>