feat(i18n): add i18n support

This commit is contained in:
leookun
2026-08-24 03:08:29 +08:00
parent 2abffcc835
commit 03075952a6
20 changed files with 932 additions and 354 deletions
@@ -11,14 +11,6 @@ import styles from "./OverviewTimeRangeFilter.module.scss";
export type OverviewRangePreset = "ten-minutes" | "hour" | "today" | "week" | "month" | "custom";
const presets: Array<{ value: Exclude<OverviewRangePreset, "custom">; label: string }> = [
{ value: "hour", label: "近1小时" },
{ value: "today", label: "近1自然日" },
{ value: "ten-minutes", label: "近10分钟" },
{ value: "week", label: "近一周" },
{ value: "month", label: "近一个月" },
];
export function OverviewTimeRangeFilter({ value, customOpen, customStart, customEnd, modelOptions, providerOptions, selectedModels, selectedProviders, busy, onSelect, onCustomOpenChange, onCustomStartChange, onCustomEndChange, onSelectedModelsChange, onSelectedProvidersChange, onCustomApply, onRefresh }: {
value: OverviewRangePreset;
customOpen: boolean;
@@ -38,6 +30,13 @@ export function OverviewTimeRangeFilter({ value, customOpen, customStart, custom
onCustomApply: () => void;
onRefresh: () => void;
}) {
const presets: Array<{ value: Exclude<OverviewRangePreset, "custom">; label: string }> = [
{ value: "hour", label: t("近1小时") },
{ value: "today", label: t("近1自然日") },
{ value: "ten-minutes", label: t("近10分钟") },
{ value: "week", label: t("近一周") },
{ value: "month", label: t("近一个月") },
];
const customButton = useRef<HTMLButtonElement>(null);
const popover = useRef<HTMLDivElement>(null);
const popoverId = useId();
+1 -1
View File
@@ -6,7 +6,7 @@ const icon = (body: string, width = 24, height = 24): IconifyIcon => ({ body, wi
export const flatColorAreaChartIcon = icon('<path fill="#3F51B5" d="M42 37H6V25l10-15l14 7L42 6z"/><path fill="#00BCD4" d="M42 42H6V32l10-8l14 2l12-9z"/>', 48, 48);
export const flatColorSalesPerformanceIcon = icon('<g fill="#FFA000"><path d="M32 8h12v32c0 1.1-2.7 2-6 2s-6-.9-6-2zM4 14h12v26c0 1.1-2.7 2-6 2s-6-.9-6-2zM18 23h12v17c0 1.1-2.7 2-6 2s-6-.9-6-2z"/></g><g fill="#FFC107"><ellipse cx="38" cy="8" rx="6" ry="2"/><ellipse cx="10" cy="14" rx="6" ry="2"/><ellipse cx="24" cy="23" rx="6" ry="2"/></g><g fill="none" stroke="#FFC107" stroke-width="2"><path d="M32 11c0 1.1 2.7 2 6 2s6-.9 6-2m-12 3c0 1.1 2.7 2 6 2s6-.9 6-2m-12 3c0 1.1 2.7 2 6 2s6-.9 6-2m-12 3c0 1.1 2.7 2 6 2s6-.9 6-2m-12 3c0 1.1 2.7 2 6 2s6-.9 6-2m-12 3c0 1.1 2.7 2 6 2s6-.9 6-2m-12 3c0 1.1 2.7 2 6 2s6-.9 6-2m-12 3c0 1.1 2.7 2 6 2s6-.9 6-2m-12 3c0 1.1 2.7 2 6 2s6-.9 6-2m-12 3c0 1.1 2.7 2 6 2s6-.9 6-2M4 17c0 1.1 2.7 2 6 2s6-.9 6-2m-12 3c0 1.1 2.7 2 6 2s6-.9 6-2m-12 3c0 1.1 2.7 2 6 2s6-.9 6-2m-12 3c0 1.1 2.7 2 6 2s6-.9 6-2m-12 3c0 1.1 2.7 2 6 2s6-.9 6-2m-12 3c0 1.1 2.7 2 6 2s6-.9 6-2m-12 3c0 1.1 2.7 2 6 2s6-.9 6-2m-12 3c0 1.1 2.7 2 6 2s6-.9 6-2M18 26c0 1.1 2.7 2 6 2s6-.9 6-2m-12 3c0 1.1 2.7 2 6 2s6-.9 6-2m-12 3c0 1.1 2.7 2 6 2s6-.9 6-2m-12 3c0 1.1 2.7 2 6 2s6-.9 6-2m-12 3c0 1.1 2.7 2 6 2s6-.9 6-2"/></g>', 48, 48);
export const flatColorLinkIcon = icon('<path fill="#1976D2" d="M38 13h-3c-5.5 0-10 4.5-10 10s4.5 10 10 10h3c5.5 0 10-4.5 10-10s-4.5-10-10-10m0 16h-3c-3.3 0-6-2.7-6-6s2.7-6 6-6h3c3.3 0 6 2.7 6 6s-2.7 6-6 6M13 13h-3C4.5 13 0 17.5 0 23s4.5 10 10 10h3c5.5 0 10-4.5 10-10s-4.5-10-10-10m0 16h-3c-3.3 0-6-2.7-6-6s2.7-6 6-6h3c3.3 0 6 2.7 6 6s-2.7 6-6 6"/><path fill="#42A5F5" d="M33 21H15c-1.1 0-2 .9-2 2s.9 2 2 2h18c1.1 0 2-.9 2-2s-.9-2-2-2"/>', 48, 48);
export const flatColorAboutIcon = icon('<path fill="#2196F3" d="M37 40H11l-6 6V12c0-3.3 2.7-6 6-6h26c3.3 0 6 2.7 6 6v22c0 3.3-2.7 6-6 6"/><g fill="#fff"><path d="M22 20h4v11h-4z"/><circle cx="24" cy="15" r="2"/></g>', 48, 48);
export const flatColorOrganizationIcon = icon('<path fill="#90CAF9" d="M42 42H6V10c0-2.2 1.8-4 4-4h28c2.2 0 4 1.8 4 4z"/><path fill="#64B5F6" d="M6 42h36v2H6z"/><path fill="#1565C0" d="M31 27h6v5h-6zm-10 0h6v5h-6zm-10 0h6v5h-6zm20 8h6v5h-6zm-20 0h6v5h-6zm20-16h6v5h-6zm-10 0h6v5h-6zm-10 0h6v5h-6zm20-8h6v5h-6zm-10 0h6v5h-6zm-10 0h6v5h-6zm10 24h6v9h-6z"/>', 48, 48);
export const flatColorBarChartIcon = icon('<path fill="#00BCD4" d="M19 22h10v20H19zM6 12h10v30H6zm26-6h10v36H32z"/>', 48, 48);
export const flatColorComboChartIcon = icon('<path fill="#00BCD4" d="M37 18h6v24h-6zm-8 8h6v16h-6zm-8-4h6v20h-6zm-8 10h6v10h-6zm-8-4h6v14H5z"/><g fill="#3F51B5"><circle cx="8" cy="16" r="3"/><circle cx="16" cy="18" r="3"/><circle cx="24" cy="11" r="3"/><circle cx="32" cy="13" r="3"/><circle cx="40" cy="9" r="3"/><path d="m39.1 7.2l-7.3 3.7l-8.3-2.1l-8 7l-7-1.7l-1 3.8l9 2.3l8-7l7.7 1.9l8.7-4.3z"/></g>', 48, 48);