Files
OmniRoute/src/app/(dashboard)/dashboard/compression/studio/EncoderComparisonTable.tsx
nguyenha935 4012bac41d 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>
2026-07-21 13:41:02 -03:00

60 lines
2.1 KiB
TypeScript

"use client";
import { useTranslations } from "next-intl";
import type { EncoderComparison } from "./compressionFlowModel";
const fmt = (n: number) => n.toLocaleString("en-US");
export function EncoderComparisonTable({ comparison }: { comparison: EncoderComparison }) {
const t = useTranslations("compressionStudio");
if (!comparison || comparison.arraysCompared === 0) return null;
const rows: Array<{
key: "gcf" | "toon" | "json";
label: string;
size: { bytes: number; tokens: number } | null;
}> = [
{ key: "gcf", label: "GCF", size: comparison.gcf },
{ key: "toon", label: "TOON", size: comparison.toonAvailable ? comparison.toon : null },
{ key: "json", label: "JSON", size: comparison.json },
].sort((a, b) => (a.size?.tokens ?? Infinity) - (b.size?.tokens ?? Infinity));
return (
<section data-testid="encoder-comparison" className="rounded border p-2 text-xs">
<header className="mb-1 font-semibold">
{t("encoderComparison", { count: comparison.arraysCompared })}{" "}
<span data-testid="encoder-winner" className="font-mono">
{t("encoderWinner", { winner: comparison.winner })}
</span>
</header>
<table className="w-full font-mono">
<thead>
<tr className="text-left text-muted-foreground">
<th>{t("encoder")}</th>
<th>{t("bytes")}</th>
<th>{t("tokensCl100k")}</th>
</tr>
</thead>
<tbody>
{rows.map((r) => (
<tr key={r.key} className={r.key === comparison.winner ? "font-bold" : ""}>
<td>
{r.label}
{r.key === comparison.winner ? " ✓" : ""}
</td>
{r.size ? (
<>
<td>{fmt(r.size.bytes)}</td>
<td>{fmt(r.size.tokens)}</td>
</>
) : (
<td colSpan={2} data-testid="encoder-toon-na">
n/a
</td>
)}
</tr>
))}
</tbody>
</table>
</section>
);
}