fix(frontend): replace t Proxy with _ function in ValidationRunDetailPage

The  export from i18n is a Proxy that supports property access (t.dashboard)
and .subscribe(), but is NOT callable as t(key). Passing it as a function
argument to getPathLabel() and getTriggerLabel() caused:
  TypeError: tFn is not a function at getPathLabel

Fix: import the callable  translation function (key: string) => string
and pass that instead. The  import is kept for template usage (t.nav?.home).

@RATIONALE Svelte 5 i18n Proxy () supports property access but not
function calls. The  function is the correct callable formatter.
This commit is contained in:
2026-06-03 10:52:47 +03:00
parent 37fe425c59
commit b5e104c9e8

View File

@@ -5,7 +5,7 @@
<script lang="ts">
import { goto } from '$app/navigation';
import { ROUTES } from '$lib/routes';
import { t } from '$lib/i18n/index.svelte.js';
import { t, _ } from '$lib/i18n/index.svelte.js';
import { page } from '$app/state';
import { ValidationRunDetailModel } from '$lib/models/ValidationRunDetailModel.svelte';
@@ -70,7 +70,7 @@
<div class="flex flex-wrap items-center gap-3 text-sm">
<span class="font-semibold text-text">{m.run.id}</span>
<span class="inline-flex px-2 py-0.5 text-xs rounded-full {getStatusDotClass(m.run.status)}">{getStatusDot(m.run.status)} {m.run.status}</span>
{#if m.run.trigger_type}<span class="text-text-muted">{getTriggerLabel(m.run.trigger_type, t)}</span>{/if}
{#if m.run.trigger_type}<span class="text-text-muted">{getTriggerLabel(m.run.trigger_type, _)}</span>{/if}
<span class="text-text-subtle">{m.run.started_at ? new Date(m.run.started_at as string).toLocaleString() : ''}</span>
{#if m.run.finished_at}<span class="text-text-subtle">{new Date(m.run.finished_at as string).toLocaleString()}</span>{/if}
{#if m.run.started_at && m.run.finished_at}<span class="text-text-muted font-mono text-xs">{formatDuration((new Date(m.run.finished_at as string).getTime() - new Date(m.run.started_at as string).getTime()))}</span>{/if}
@@ -89,7 +89,7 @@
</div>
<div class="flex items-center gap-3">
{#if dashboard.path}
<span class={`px-2 py-0.5 text-xs rounded-full ${getPathBadgeClass(dashboard.path)}`}>{getPathLabel(dashboard.path, t)}</span>
<span class={`px-2 py-0.5 text-xs rounded-full ${getPathBadgeClass(dashboard.path)}`}>{getPathLabel(dashboard.path, _)}</span>
{/if}
<span class={`px-2 py-0.5 text-xs rounded-full font-semibold uppercase ${getStatusDotClass(dashboard.status)}`}>{dashboard.status}</span>
{#if dashboard.duration_ms}<span class="text-xs text-text-muted font-mono">{formatDuration(dashboard.duration_ms)}</span>{/if}