Files
OmniRoute/tests/unit/i18n-hardcoded-pt-dashboard-6761.test.ts
Chirag Singhal dd057f590e fix(i18n): translate hardcoded Portuguese dashboard strings to English (#6769)
Reconstructed onto release/v3.8.47 to drop unrelated main-drift (deps/electron/proxy
files belong to #6620, not this PR); keeps only the author's changes.

Co-authored-by: Chirag Singhal <chirag127@users.noreply.github.com>
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
2026-07-10 18:05:36 -03:00

45 lines
1.6 KiB
TypeScript

// ABOUTME: Guard test — the 4 dashboard files translated in #6761/#6768 must stay free of
// ABOUTME: hardcoded Portuguese UI strings (regression guard for the i18n cleanup).
import test from "node:test";
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
import { dirname, join } from "node:path";
const repoRoot = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
// Files cleaned of hardcoded Portuguese in #6769 (issues #6761, #6768).
const FILES = [
"src/app/(dashboard)/dashboard/compression/studio/CompareView.tsx",
"src/app/(dashboard)/dashboard/compression/studio/PlaygroundInput.tsx",
"src/app/(dashboard)/dashboard/context/combos/CompressionHub.tsx",
"src/app/(dashboard)/dashboard/translator/components/advanced/CompressionPreviewAccordion.tsx",
];
// Portuguese-only words that appeared as hardcoded UI copy before the fix.
// Distinct from English + from shared tech terms, so a hit means real PT regression.
const PT_MARKERS = [
"Retenção",
"Fidelidade",
"Compressão",
"Proteger conteúdo",
"delegada ao provedor",
"Deixa o próprio provedor",
"Hoje disponível apenas",
"Técnicas:",
"Não afeta",
"reescrevemos",
];
for (const rel of FILES) {
test(`no hardcoded Portuguese in ${rel}`, () => {
const src = readFileSync(join(repoRoot, rel), "utf8");
const hits = PT_MARKERS.filter((m) => src.includes(m));
assert.deepEqual(
hits,
[],
`Hardcoded Portuguese found in ${rel}: ${hits.join(", ")} — translate to English or route through t().`
);
});
}