Enhance vehicle speed display by adding localized labels in DirectorInfo, SaleSection, and BranchView components

This commit is contained in:
Torsten Schulz (local)
2025-12-09 11:45:35 +01:00
parent a7350282ee
commit 71c62cf5e8
5 changed files with 44 additions and 3 deletions

View File

@@ -103,7 +103,7 @@
<td>{{ v.type.capacity }}</td>
<td>{{ conditionLabel(v.condition) }}</td>
<td>{{ v.type.transportMode }}</td>
<td>{{ v.type.speed }}</td>
<td>{{ speedLabel(v.type.speed) }}</td>
<td>{{ formatDateTime(v.availableFrom) }}</td>
<td>
<span v-if="v.status === 'travelling'">
@@ -601,6 +601,16 @@ export default {
return 'Unbekannt';
},
speedLabel(value) {
// Expect numeric speeds 1..4; provide localized labels as fallback to raw value
const key = value == null ? 'unknown' : 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;
},
async loadVehicles() {
if (!this.selectedBranch) return;
try {