From 372babc3b741e0fd5e10709b4b6e3e70589b6074 Mon Sep 17 00:00:00 2001 From: Ku6epXBOCTuK Date: Sun, 13 Sep 2026 06:38:58 +0500 Subject: [PATCH] fix: update i18n - text verdicts from analyze tools --- web/src/lib/components/SchemaPreview.svelte | 3 +++ .../lib/components/SchemaResultTile.svelte | 3 +++ .../lib/components/SchemaTextResult.svelte | 14 +++++++------- web/src/lib/components/SchemaToolView.svelte | 11 +++++++++-- web/src/lib/registry/analyze.ts | 19 ++++++++----------- 5 files changed, 30 insertions(+), 20 deletions(-) diff --git a/web/src/lib/components/SchemaPreview.svelte b/web/src/lib/components/SchemaPreview.svelte index 6295673..6029738 100644 --- a/web/src/lib/components/SchemaPreview.svelte +++ b/web/src/lib/components/SchemaPreview.svelte @@ -10,6 +10,7 @@ interface Props { inputMode: InputMode; resultKind?: ResultKind; + toolId: string; source: PixelImage | null; result: PixelImage | null; fileResult?: FileResult | null; @@ -27,6 +28,7 @@ let { inputMode, resultKind = "image", + toolId, source, result, fileResult = null, @@ -104,6 +106,7 @@ {result} {fileResult} {textResult} + {toolId} {running} oncopy={oncopytext} {ondownloadtxt} diff --git a/web/src/lib/components/SchemaResultTile.svelte b/web/src/lib/components/SchemaResultTile.svelte index 592ef19..f9b46e7 100644 --- a/web/src/lib/components/SchemaResultTile.svelte +++ b/web/src/lib/components/SchemaResultTile.svelte @@ -12,6 +12,7 @@ result: PixelImage | null; fileResult?: FileResult | null; textResult?: string | null; + toolId?: string; running?: boolean; oncopy?: () => void; ondownloadtxt?: () => void; @@ -21,6 +22,7 @@ result, fileResult = null, textResult = null, + toolId = "", running = false, oncopy, ondownloadtxt, @@ -62,6 +64,7 @@ {})} ondownload={ondownloadtxt ?? (() => {})} /> diff --git a/web/src/lib/components/SchemaTextResult.svelte b/web/src/lib/components/SchemaTextResult.svelte index 3f05ef4..11c5144 100644 --- a/web/src/lib/components/SchemaTextResult.svelte +++ b/web/src/lib/components/SchemaTextResult.svelte @@ -1,11 +1,13 @@ @@ -31,7 +31,7 @@
{t("resultCard.result")}
- {value} + {displayValue}
diff --git a/web/src/lib/components/SchemaToolView.svelte b/web/src/lib/components/SchemaToolView.svelte index 6c634b9..4069ec1 100644 --- a/web/src/lib/components/SchemaToolView.svelte +++ b/web/src/lib/components/SchemaToolView.svelte @@ -6,7 +6,11 @@ import { decodeFile, encode } from "$lib/core/io"; import type { PixelImage } from "$lib/core/types"; import { execute } from "$lib/executor"; - import { toolDescription, toolTitle } from "$lib/i18n/schema-tool-strings"; + import { + toolDescription, + toolTitle, + verdictText, + } from "$lib/i18n/schema-tool-strings"; import { t } from "$lib/i18n/t"; import type { FileResult, ToolEntry } from "$lib/registry"; import { @@ -120,8 +124,10 @@ async function copyText() { if (!textResult) return; + const copyValue = + resultKind === "verdict" ? verdictText(tool.id, textResult) : textResult; try { - await navigator.clipboard.writeText(textResult); + await navigator.clipboard.writeText(copyValue); } catch (e) { error = errorText(e); } @@ -178,6 +184,7 @@
= { input: "text", result: "verdict", run: textGen((text) => - looksLikePng(base64ToBytes(stripDataUri(text))) - ? "Yes — valid PNG signature." - : "No — the content is not a PNG.", + looksLikePng(base64ToBytes(stripDataUri(text))) ? "verifyYes" : "verifyNo", ), }; @@ -218,9 +217,7 @@ const pngIsGrayscale: ToolEntry = { schema: emptySchema, input: "image", result: "verdict", - run: imgTool((img) => - isGrayscale(img) ? "Yes — grayscale." : "No — contains colors.", - ), + run: imgTool((img) => (isGrayscale(img) ? "grayscaleYes" : "grayscaleNo")), }; const pngFileSize: ToolEntry = { @@ -236,7 +233,7 @@ const pngFileSize: ToolEntry = { const blob = await encode(img, "image/png"); const kb = blob.size / 1024; const kbText = kb >= 100 ? Math.round(kb).toString() : kb.toFixed(1); - return `${kbText} KB`; + return t("tools.png-file-size.results.line", { kb: kbText }); }), }; @@ -250,7 +247,7 @@ const pngIsTransparent: ToolEntry = { input: "image", result: "verdict", run: imgTool((img) => - hasTransparency(img) ? "Yes — has transparency." : "No — fully opaque.", + hasTransparency(img) ? "transparentYes" : "transparentNo", ), }; @@ -265,11 +262,11 @@ const pngOrientation: ToolEntry = { run: imgTool((img) => { switch (orientationOf(img)) { case "portrait": - return "Portrait"; + return "orientationPortrait"; case "landscape": - return "Landscape"; + return "orientationLandscape"; default: - return "Square"; + return "orientationSquare"; } }), };