diff --git a/frontend/src/components/falukant/DirectorInfo.vue b/frontend/src/components/falukant/DirectorInfo.vue index 446081c..c3c0609 100644 --- a/frontend/src/components/falukant/DirectorInfo.vue +++ b/frontend/src/components/falukant/DirectorInfo.vue @@ -256,11 +256,17 @@ export default { }, speedLabel(value) { - const key = value == null ? 'unknown' : String(value); + if (value == null) return this.$t('falukant.branch.transport.speed.unknown') || '—'; + if (typeof value === 'object') { + const k = value.tr ?? value.id ?? 'unknown'; + const tKey = `falukant.branch.transport.speed.${k}`; + const t = this.$t(tKey); + return (t && t !== tKey) ? t : String(k); + } + const key = String(value); const tKey = `falukant.branch.transport.speed.${key}`; const translated = this.$t(tKey); - if (!translated || translated === tKey) return value; - return translated; + return (!translated || translated === tKey) ? key : translated; }, openNewDirectorDialog() { diff --git a/frontend/src/components/falukant/SaleSection.vue b/frontend/src/components/falukant/SaleSection.vue index c481234..97728c6 100644 --- a/frontend/src/components/falukant/SaleSection.vue +++ b/frontend/src/components/falukant/SaleSection.vue @@ -252,11 +252,17 @@ }); }, speedLabel(value) { - const key = value == null ? 'unknown' : String(value); + if (value == null) return this.$t('falukant.branch.transport.speed.unknown') || '—'; + if (typeof value === 'object') { + const k = value.tr ?? value.id ?? 'unknown'; + const tKey = `falukant.branch.transport.speed.${k}`; + const t = this.$t(tKey); + return (t && t !== tKey) ? t : String(k); + } + const key = String(value); const tKey = `falukant.branch.transport.speed.${key}`; const translated = this.$t(tKey); - if (!translated || translated === tKey) return value; - return translated; + return (!translated || translated === tKey) ? key : translated; }, }, async mounted() { @@ -300,10 +306,10 @@ currentPrice: currentPrice } }); - this.$set(item, 'betterPrices', data || []); + item.betterPrices = data || []; } catch (error) { console.error(`Error loading prices for item ${itemKey}:`, error); - this.$set(item, 'betterPrices', []); + item.betterPrices = []; } finally { this.loadingPrices.delete(itemKey); } diff --git a/frontend/src/views/falukant/BranchView.vue b/frontend/src/views/falukant/BranchView.vue index 1a6f7a6..a124bd5 100644 --- a/frontend/src/views/falukant/BranchView.vue +++ b/frontend/src/views/falukant/BranchView.vue @@ -719,13 +719,17 @@ export default { }, speedLabel(value) { - // Expect numeric speeds 1..4; provide localized labels as fallback to raw value - const key = value == null ? 'unknown' : String(value); + if (value == null) return this.$t('falukant.branch.transport.speed.unknown') || '—'; + if (typeof value === 'object') { + const k = value.tr ?? value.id ?? 'unknown'; + const tKey = `falukant.branch.transport.speed.${k}`; + const t = this.$t(tKey); + return (t && t !== tKey) ? t : String(k); + } + const key = String(value); const tKey = `falukant.branch.transport.speed.${key}`; const translated = this.$t(tKey); - // If translation returns the key (no translation found), fall back to the numeric value - if (!translated || translated === tKey) return value; - return translated; + return (!translated || translated === tKey) ? key : translated; }, transportModeLabel(mode) {