chore(driver): locale & typings improvements

This commit is contained in:
2026-05-10 14:11:57 +02:00
parent d87e44a6c4
commit 3d0d980864
3 changed files with 26 additions and 35 deletions
+16 -24
View File
@@ -49,7 +49,7 @@
<div class="cargo-warnings" v-if="Object.values(cargoWarnings).length > 0"> <div class="cargo-warnings" v-if="Object.values(cargoWarnings).length > 0">
<hr class="divider" /> <hr class="divider" />
<h3>{{ t('analysis.warnings.title') }}</h3> <h3>{{ t('analysis.warnings-title') }}</h3>
<div class="warnings-container"> <div class="warnings-container">
<div <div
@@ -64,7 +64,7 @@
<div class="cargo-warnings no-warnings" v-else> <div class="cargo-warnings no-warnings" v-else>
<hr class="divider" /> <hr class="divider" />
{{ t('analysis.warnings.no-warnings') }} {{ t('analysis.no-warnings') }}
</div> </div>
</div> </div>
@@ -86,6 +86,9 @@ import { useI18n } from 'vue-i18n';
import { Train } from '../../typings/common'; import { Train } from '../../typings/common';
import rulesJSON from '../../data/trainNumberRules.json'; import rulesJSON from '../../data/trainNumberRules.json';
import { useApiStore } from '../../store/apiStore'; import { useApiStore } from '../../store/apiStore';
import { analysis } from '../../locales/pl.json';
type AnalysisKey = keyof typeof analysis.warnings;
const { t } = useI18n(); const { t } = useI18n();
@@ -128,33 +131,22 @@ const cargoWarnings = computed(() => {
stockList.forEach((stockVehicle) => { stockList.forEach((stockVehicle) => {
const [vehicleName, vehicleCargo] = stockVehicle.split(':'); const [vehicleName, vehicleCargo] = stockVehicle.split(':');
let warningsKey: AnalysisKey | null = null;
if (/^WB117/.test(vehicleName)) { if (/^WB117/.test(vehicleName)) {
if (vehicleCargo) { warningsKey = vehicleCargo ? 'zags-loaded-twr' : 'zags-empty-tn';
// warnings.add('twr-un1965');
warnings['zags-loaded-twr'] = (warnings['zags-loaded-twr'] || 0) + 1;
} else {
// warnings.add('tn-un1965');
warnings['zags-empty-tn'] = (warnings['zags-empty-tn'] || 0) + 1;
}
} else if (/^445Rb/.test(vehicleName)) { } else if (/^445Rb/.test(vehicleName)) {
if (vehicleCargo) { warningsKey = vehicleCargo ? 'zans-loaded-tn' : 'zans-empty-tn';
// warnings.add(vehicleCargo ? 'tn-un1202' : 'tn-un1202-empty');
warnings['zans-loaded-tn'] = (warnings['zans-loaded-tn'] || 0) + 1;
} else {
// warnings.add(vehicleCargo ? 'tn-un1202' : 'tn-un1202-empty');
warnings['zans-empty-tn'] = (warnings['zans-empty-tn'] || 0) + 1;
}
} else if (/^EDK80/.test(vehicleName)) { } else if (/^EDK80/.test(vehicleName)) {
// warnings.add('pn-edk80'); warningsKey = 'edk80-all-pn';
warnings['edk80-all-pn'] = (warnings['edk80-all-pn'] || 0) + 1; } else if (/^wt_20/.test(vehicleCargo)) {
warningsKey = 'innofreight-all-pn';
} else if (/^(tank|vehicles_01|truck)/.test(vehicleCargo)) {
warningsKey = 'military-all-pn';
} }
if (/^wt_20/.test(vehicleCargo)) { if (warningsKey) {
warnings['innofreight-all-pn'] = (warnings['innofreight-all-pn'] || 0) + 1; warnings[warningsKey] = (warnings[warningsKey] || 0) + 1;
}
if (/^(tank|vehicles_01|truck)/.test(vehicleCargo)) {
warnings['military-all-pn'] = (warnings['military-all-pn'] || 0) + 1;
} }
}); });
+5 -6
View File
@@ -441,7 +441,7 @@
}, },
"analysis": { "analysis": {
"button-show": "ANALYSIS & STOCK", "button-show": "STOCK INFORMATION",
"number-info": "will be automatically updated to the current train number chosen in the simulator after the analysis is sent in the chat.", "number-info": "will be automatically updated to the current train number chosen in the simulator after the analysis is sent in the chat.",
"stock-copy": "COPY CURRENT STOCK", "stock-copy": "COPY CURRENT STOCK",
@@ -461,18 +461,17 @@
"empty": "No propositions available for the chosen category! :/" "empty": "No propositions available for the chosen category! :/"
}, },
"warnings": { "warnings-title": "Additional cargo warnings:",
"title": "Additional cargo warnings:", "no-warnings": "No additional cargo warnings",
"warnings": {
"zags-loaded-twr": "TWR: 23UN1965, {0}x Zags", "zags-loaded-twr": "TWR: 23UN1965, {0}x Zags",
"zags-empty-tn": "TN: 23UN1965, {0}x Zags (empty)", "zags-empty-tn": "TN: 23UN1965, {0}x Zags (empty)",
"zans-loaded-tn": "TN: 33UN1202, {0}x Zans", "zans-loaded-tn": "TN: 33UN1202, {0}x Zans",
"zans-empty-tn": "TN: 33UN1202, {0}x Zans (empty)", "zans-empty-tn": "TN: 33UN1202, {0}x Zans (empty)",
"military-all-pn": "PN: military transport", "military-all-pn": "PN: military transport",
"edk80-all-pn": "PN: EDK80 railway crane", "edk80-all-pn": "PN: EDK80 railway crane",
"innofreight-all-pn": "PN: Innofreight C45 (exceeded gauge)", "innofreight-all-pn": "PN: Innofreight C45 (exceeded gauge)"
"no-warnings": "No additional cargo warnings"
} }
}, },
+5 -5
View File
@@ -431,7 +431,7 @@
}, },
"analysis": { "analysis": {
"button-show": "ANALIZA I SKŁAD", "button-show": "INFORMACJE O SKŁADZIE",
"number-info": "zostanie automatycznie zaktualizowany na obecny numer wybrany w symulatorze po wysłaniu wiadomości na czacie.", "number-info": "zostanie automatycznie zaktualizowany na obecny numer wybrany w symulatorze po wysłaniu wiadomości na czacie.",
"title": "Treść analizy:", "title": "Treść analizy:",
@@ -453,17 +453,17 @@
"empty": "Brak propozycji dla wybranej kategorii!" "empty": "Brak propozycji dla wybranej kategorii!"
}, },
"warnings-title": "Dodatkowe uwagi przewozowe:",
"no-warnings": "Brak dodatkowych uwag przewozowych",
"warnings": { "warnings": {
"title": "Dodatkowe uwagi przewozowe:",
"zags-loaded-twr": "TWR: 23UN1965, {0}x Zags", "zags-loaded-twr": "TWR: 23UN1965, {0}x Zags",
"zags-empty-tn": "TN: 23UN1965, {0}x Zags (próżne)", "zags-empty-tn": "TN: 23UN1965, {0}x Zags (próżne)",
"zans-loaded-tn": "TN: 33UN1202, {0}x Zans", "zans-loaded-tn": "TN: 33UN1202, {0}x Zans",
"zans-empty-tn": "TN: 33UN1202, {0}x Zans (próżne)", "zans-empty-tn": "TN: 33UN1202, {0}x Zans (próżne)",
"military-all-pn": "PN: transport wojskowy", "military-all-pn": "PN: transport wojskowy",
"edk80-all-pn": "PN: żuraw kolejowy EDK80", "edk80-all-pn": "PN: żuraw kolejowy EDK80",
"innofreight-all-pn": "PN: Innofreight C45 (przekroczona skrajnia)", "innofreight-all-pn": "PN: Innofreight C45 (przekroczona skrajnia)"
"no-warnings": "Brak dodatkowych uwag przewozowych"
} }
}, },
"train-stats": { "train-stats": {