fix: update i18n - text verdicts from analyze tools

This commit is contained in:
2026-09-13 06:38:58 +05:00
parent 4b44bc439c
commit 372babc3b7
5 changed files with 30 additions and 20 deletions
@@ -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}
@@ -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 @@
<SchemaTextResult
value={textResult}
kind="verdict"
{toolId}
oncopy={oncopy ?? (() => {})}
ondownload={ondownloadtxt ?? (() => {})}
/>
@@ -1,11 +1,13 @@
<script lang="ts">
import { Copy, Download, FileText } from "@lucide/svelte";
import { verdictTone, verdictText } from "$lib/i18n/schema-tool-strings";
import { t } from "$lib/i18n/t";
import IconButton from "./ui/IconButton.svelte";
interface Props {
value: string;
kind: "text" | "verdict";
toolId?: string;
fileName?: string;
oncopy: () => void;
ondownload: () => void;
@@ -13,17 +15,15 @@
let {
value,
kind,
toolId = "",
fileName = "result.txt",
oncopy,
ondownload,
}: Props = $props();
const tone = $derived(
/^(yes|true)/i.test(value.trim())
? "success"
: /^(no|false)/i.test(value.trim())
? "danger"
: "info",
const tone = $derived(verdictTone(value));
const displayValue = $derived(
kind === "verdict" && toolId ? verdictText(toolId, value) : value,
);
</script>
@@ -31,7 +31,7 @@
<div class="verdict">
<span class="verdict-label">{t("resultCard.result")}</span>
<div class="badge badge-tone--{tone}" role="status">
<span class="verdict-text">{value}</span>
<span class="verdict-text">{displayValue}</span>
<IconButton icon={Copy} label={t("textResult.copy")} onclick={oncopy} />
</div>
</div>
+9 -2
View File
@@ -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 @@
<section class="panel">
<SchemaPreview
toolId={tool.id}
{source}
{result}
{fileResult}