feat(frontend): 控制台 next-intl 中英双语

接入无 URL 前缀的 zh-CN/en,顶栏与外观设置可切换语言;选择写入 cookie 后刷新生效。
This commit is contained in:
ryan
2026-08-16 16:49:16 +08:00
parent 64fbaa7ef1
commit 5a8722ff07
219 changed files with 21437 additions and 5212 deletions
@@ -1,5 +1,7 @@
'use client';
import { useTranslations } from 'next-intl';
import { TrendChart } from '@/components/data/trend-chart';
import {
Card,
@@ -14,18 +16,23 @@ import { formatPercent, formatTrendHour } from './dashboard-utils';
export function CapacityTrendChart({
points,
title = '24 小时容量趋势',
description = '按小时聚合 CPU 与内存使用率,判断整体容量是否持续紧张。',
title,
description,
}: {
points: CapacityTrendPoint[];
title?: string;
description?: string;
}) {
const t = useTranslations('dashboard.capacityTrend');
return (
<Card className='border-dashed shadow-none'>
<CardHeader>
<CardTitle className='text-sm font-semibold'>{title}</CardTitle>
<CardDescription className='text-xs'>{description}</CardDescription>
<CardTitle className='text-sm font-semibold'>
{title ?? t('title')}
</CardTitle>
<CardDescription className='text-xs'>
{description ?? t('description')}
</CardDescription>
</CardHeader>
<CardContent>
<TrendChart
@@ -35,7 +42,7 @@ export function CapacityTrendChart({
yAxisValueFormatter={formatPercent}
series={[
{
label: '平均 CPU',
label: t('avgCpu'),
color: '#0f766e',
fillColor: 'rgba(15, 118, 110, 0.15)',
variant: 'area',
@@ -43,7 +50,7 @@ export function CapacityTrendChart({
valueFormatter: formatPercent,
},
{
label: '平均内存',
label: t('avgMemory'),
color: '#2563eb',
values: points.map((point) => point.average_memory_usage_percent),
valueFormatter: formatPercent,