feat: füge Unterstützung für Lagerschaden hinzu und aktualisiere Übersetzungen in mehreren Sprachen
All checks were successful
Deploy to production / deploy (push) Successful in 2m16s

This commit is contained in:
Torsten Schulz (local)
2026-05-27 18:25:40 +02:00
parent 2f858edd5b
commit 1a8326ab24
6 changed files with 44 additions and 0 deletions

View File

@@ -184,6 +184,12 @@ export default {
key = raw;
}
// Fallback: use payload.type if present (e.g. storage_damage)
if ((!raw || !String(raw).trim()) && payload?.type) {
raw = String(payload.type);
key = raw;
}
// 1) JSON-Format unterstützen: {"tr":"random_event.windfall","amount":1000,"characterName":"Max"}
if (typeof raw === 'string') {
const trimmed = raw.trim();
@@ -286,6 +292,24 @@ export default {
if (params.storage_destruction_percent !== undefined) {
formatted.destructionPercent = ` Lager zerstört: ${params.storage_destruction_percent.toFixed(1)}%.`;
}
// Storage damage specific numbers
if (params.destroyed_inventory_units !== undefined) {
formatted.destroyedInventoryUnits = new Intl.NumberFormat(navigator.language).format(Number(params.destroyed_inventory_units));
}
if (params.affected_stocks !== undefined) {
formatted.affectedStocks = new Intl.NumberFormat(navigator.language).format(Number(params.affected_stocks));
}
if (params.destroyed_stocks !== undefined) {
formatted.destroyedStocks = new Intl.NumberFormat(navigator.language).format(Number(params.destroyed_stocks));
}
if (params.stock_type !== undefined) {
// Try to translate product type via i18n product keys if available
const prodKey = `falukant.product.${params.stock_type}`;
formatted.stockType = this.$te(prodKey) ? String(this.$t(prodKey)) : String(params.stock_type);
}
if (params.damage_reason !== undefined) {
formatted.damageReason = String(params.damage_reason);
}
if (params.regionLabel) {
formatted.regionLabel = isGerman
? ` Ort: ${params.regionLabel}.`