fix(i18n): preserve remaining Vietnamese localization (#7935)

* fix(i18n): preserve remaining Vietnamese localization

* chore(quality): rebaseline file-size cap for 9 dashboard components (i18n wiring)

Restoring the Vietnamese localization on 9 dashboard components (useTranslations
wiring + t()/tc() call-site swaps for previously hardcoded strings) grows each
file by a small, irreducible amount. Bumps the frozen file-size-baseline.json
caps to match, with a justification entry per the project's own ratchet policy.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

* fix(i18n): wire weekday localization + add missing qwen CLI description

Two gaps left by this PR's own new contract tests, caught while
reconciling the branch against the release tip:

- CostOverviewTab.tsx added formatWeekdayLabel() but never called it;
  the Weekly Usage Pattern chart still showed raw English day
  abbreviations regardless of locale. Now maps weeklyPattern rows
  through it before handing them to WeeklyPatternCard.
- cliTools.toolDescriptions was missing an entry for "qwen" (a
  baseUrlSupport:"full" tool) in both en.json and vi.json, failing
  the PR's own cli-catalog-display-contract.test.ts.

Covered by the PR's existing tests/unit/dashboard-localization-contract.test.ts
and tests/unit/cli-catalog-display-contract.test.ts (both now pass).

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

* i18n(vi): backfill the 4 proxySubscription keys #7299 added to en.json

#7299 (proxy subscriptions) merged while this branch was rebasing, adding
settings.proxySubscriptionsTab and settings.proxySubscription.error.{LOCAL_CORE_ENDPOINT_INVALID,
NEEDS_CORE_NOT_CONFIGURED,NO_USABLE_NODES} to en.json. This PR's own
i18n-vi-completeness contract asserts full en↔vi key parity, so the merge of the
current release tip surfaced them as missing. Adds the Vietnamese translations,
keeping the SS/VMess/Trojan/VLESS/SOCKS5 technical terms verbatim.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

---------

Co-authored-by: nguyenha935 <208228297+nguyenha935@users.noreply.github.com>
Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouza.pw@gmail.com>
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
Co-authored-by: nguyenha935 <nguyenha935@users.noreply.github.com>
This commit is contained in:
nguyenha935
2026-07-21 23:41:02 +07:00
committed by GitHub
parent eab59d4048
commit 4012bac41d
207 changed files with 12021 additions and 5221 deletions

View File

@@ -1,7 +1,7 @@
"use client";
import { useState, useEffect, useCallback, useMemo, useRef } from "react";
import { useTranslations } from "next-intl";
import { useLocale, useTranslations } from "next-intl";
import Card from "./Card";
import { CardSkeleton } from "./Loading";
import { fmtCompact as fmt, fmtFull, fmtCost } from "@/shared/utils/formatting";
@@ -31,6 +31,7 @@ import {
// ============================================================================
export default function UsageAnalytics() {
const locale = useLocale();
const t = useTranslations("analytics");
const tCommon = useTranslations("common");
const [range, setRange] = useState("30d");
@@ -87,7 +88,8 @@ export default function UsageAnalytics() {
}, [range, customStart, customEnd, selectedApiKeys, tCommon]);
useEffect(() => {
fetchAnalytics();
const timer = window.setTimeout(() => void fetchAnalytics(), 0);
return () => window.clearTimeout(timer);
}, [fetchAnalytics]);
const handleRangeSelect = useCallback((value: string) => {
@@ -111,7 +113,7 @@ export default function UsageAnalytics() {
if (range !== "custom" || !customStart || !customEnd) return null;
const fmt = (iso: string) => {
const d = new Date(iso);
return d.toLocaleDateString(undefined, {
return d.toLocaleDateString(locale, {
month: "short",
day: "numeric",
hour: "2-digit",
@@ -119,7 +121,7 @@ export default function UsageAnalytics() {
});
};
return `${fmt(customStart)}${fmt(customEnd)}`;
}, [range, customStart, customEnd]);
}, [range, customStart, customEnd, locale]);
const ranges = [
{ value: "1d", label: t("period1D") },
@@ -144,8 +146,13 @@ export default function UsageAnalytics() {
const wp = analytics?.weeklyPattern || [];
if (!wp.length) return "—";
const max = wp.reduce((a, b) => (a.avgTokens > b.avgTokens ? a : b), wp[0]);
return max.avgTokens > 0 ? max.day : "—";
}, [analytics]);
if (max.avgTokens <= 0) return "—";
const weekdayIndex = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"].indexOf(max.day);
if (weekdayIndex < 0) return max.day;
return new Intl.DateTimeFormat(locale, { weekday: "short" }).format(
new Date(2024, 0, 7 + weekdayIndex)
);
}, [analytics, locale]);
const providerCount = useMemo(() => {
return (analytics?.byProvider || []).length;