diff --git a/src/lib/components/DACSetupWizard.svelte b/src/lib/components/DACSetupWizard.svelte index ade7e0cc6..349bd376c 100644 --- a/src/lib/components/DACSetupWizard.svelte +++ b/src/lib/components/DACSetupWizard.svelte @@ -194,9 +194,11 @@ return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase()); } - const steps = $derived(STEPS.map((step, index) => ({ + // Store labelKey instead of calling $t() in $derived - resolve in template + const steps = $derived<(Step & { labelKey: string })[]>(STEPS.map((step, index) => ({ id: step, - label: $t(`dacWizard.steps.${toCamelCase(step)}`) || step, + label: step, // fallback + labelKey: `dacWizard.steps.${toCamelCase(step)}`, status: index === currentIndex ? 'active' : completedSteps.has(step) ? 'complete' : 'upcoming' }))); diff --git a/src/lib/components/DownloadButton.svelte b/src/lib/components/DownloadButton.svelte index 96c8f219f..575551504 100644 --- a/src/lib/components/DownloadButton.svelte +++ b/src/lib/components/DownloadButton.svelte @@ -50,21 +50,31 @@ } } - const title = $derived.by(() => { + // Return translation key for title - call $t() in template + const titleKey = $derived.by(() => { // Show offline message when trying to download while offline if (isOffline && (status === 'none' || status === 'failed')) { - return $t('offline.featureDisabled'); + return 'offline.featureDisabled'; } switch (status) { - case 'none': return 'Make available offline'; - case 'queued': return 'Queued for offline'; - case 'downloading': return `Preparing for offline ${progress}%`; - case 'ready': return 'Available offline (click to remove)'; - case 'failed': return 'Failed to cache for offline (click to retry)'; - default: return ''; + case 'none': return 'download.makeAvailable'; + case 'queued': return 'download.queued'; + case 'downloading': return 'download.preparing'; + case 'ready': return 'download.ready'; + case 'failed': return 'download.failed'; + default: return null; } }); + // Resolve title - must be a function called from template (not $derived) + function getTitle(): string { + if (!titleKey) return ''; + if (status === 'downloading') { + return `${$t(titleKey)} ${progress}%`; + } + return $t(titleKey); + } + // Disable button when offline and not already downloaded const isDisabled = $derived( status === 'queued' || (isOffline && status !== 'ready') @@ -78,8 +88,8 @@ class:failed={status === 'failed'} class:offline={isOffline && status !== 'ready'} onclick={handleClick} - title={title} - aria-label={title} + title={getTitle()} + aria-label={getTitle()} disabled={isDisabled} > {#if status === 'ready'} diff --git a/src/lib/components/RemoteControlSetupGuide.svelte b/src/lib/components/RemoteControlSetupGuide.svelte index 265b88edb..9af6ae3cc 100644 --- a/src/lib/components/RemoteControlSetupGuide.svelte +++ b/src/lib/components/RemoteControlSetupGuide.svelte @@ -31,9 +31,11 @@ // Derived values const currentIndex = $derived(STEPS.indexOf(currentStep)); - const steps = $derived(STEPS.map((step, index) => ({ + // Store labelKey instead of calling $t() in $derived - resolve in WizardStepper template + const steps = $derived<(Step & { labelKey: string })[]>(STEPS.map((step, index) => ({ id: step, - label: $t(`remoteControlWizard.steps.${step}`) || step, + label: step, // fallback + labelKey: `remoteControlWizard.steps.${step}`, status: index === currentIndex ? 'active' : completedSteps.has(step) ? 'complete' : 'upcoming' }))); diff --git a/src/lib/components/wizard/WizardStepper.svelte b/src/lib/components/wizard/WizardStepper.svelte index 1a6a5e38e..18bfb56f6 100644 --- a/src/lib/components/wizard/WizardStepper.svelte +++ b/src/lib/components/wizard/WizardStepper.svelte @@ -1,9 +1,11 @@