translations; numgen category drawing

This commit is contained in:
2024-02-05 22:36:36 +01:00
parent 5d24accb15
commit ed191d597b
3 changed files with 57 additions and 15 deletions
+21 -13
View File
@@ -53,41 +53,40 @@
<div class="category-rules" v-if="chosenCategory && categoryRules && trainNumber">
<!-- First & second digit (the same regions) -->
<div v-if="beginRegionName && endRegionName && beginRegionName == endRegionName">
<b>Dwie pierwsze cyfry:</b> z puli
<b>{{ $t('numgen.rules.two-first-digits') }}</b> {{ $t('numgen.rules.from-pool') }}
<b class="text--accent">{{ genData.sameRegions[beginRegionName].join(', ') }}</b>
dla obszaru {{ beginRegionName }}
{{ $t('numgen.rules.for-region') }} {{ beginRegionName }}
</div>
<!-- First & second digit (different regions) -->
<div v-else>
<div>
<b>
Pierwsza cyfra: <span class="text--accent">{{ trainNumber[0] }}</span>
{{ $t('numgen.rules.first-digit') }} <span class="text--accent">{{ trainNumber[0] }}</span>
</b>
<span v-if="beginRegionName"> dla początkowego obszaru konstrukcyjnego {{ beginRegionName }}</span>
<span v-else>wybierz początkowy obszar konstrukcyjny</span>
{{ $t('numgen.rules.for-region-begin') }} {{ beginRegionName }}
</div>
<div>
<b>
Druga cyfra: <span class="text--accent">{{ trainNumber[1] }}</span>
{{ $t('numgen.rules.second-digit') }} <span class="text--accent">{{ trainNumber[1] }} </span>
</b>
<span v-if="endRegionName"> dla końcowego obszaru konstrukcyjnego {{ endRegionName }}</span>
<span v-else>wybierz początkowy obszar konstrukcyjny</span>
{{ $t('numgen.rules.for-region-end') }} {{ endRegionName }}
</div>
</div>
<!-- Third digit (non-passenger only) -->
<div v-if="categoryRules[0] != null">
<b>
Trzecia cyfra: <span class="text--accent">{{ categoryRules[0] }}</span>
{{ $t('numgen.rules.third-digit') }} <span class="text--accent">{{ categoryRules[0] }}</span>
</b>
dla kategorii {{ chosenCategory }}
{{ $t('numgen.rules.for-category') }} {{ chosenCategory }}
</div>
<!-- Last digits -->
<div>
<b> {{ categoryRules[1]?.length == 3 ? 'Trzy' : 'Dwie' }} ostatnie cyfry:</b>
z przedziału
<b> {{ $t(`numgen.rules.${categoryRules[1]?.length == 3 ? 'three' : 'two'}-last-digits`) }}</b>
{{ $t('numgen.rules.from-range') }}
<b class="text--accent">{{ categoryRules[1] }}-{{ categoryRules[2] }}</b>
</div>
</div>
@@ -107,7 +106,9 @@
{{ $t('numgen.action-random-region') }}
</button>
<button class="btn" @click="randomizeTrainNumber(true)">LOSUJ KATEGORIĘ</button>
<button class="btn" @click="randomizeCategory">
{{ $t('numgen.action-random-category') }}
</button>
<button class="btn" @click="randomizeTrainNumber(false)">
{{ $t('numgen.action-random-number') }}
@@ -147,6 +148,13 @@ const categoryRules = computed(() => {
return genData.categoriesRules[chosenCategory.value];
});
const randomizeCategory = () => {
const categoryKeys = Object.keys(genData.categoriesRules) as Category[];
chosenCategory.value = categoryKeys[~~(Math.random() * categoryKeys.length)];
randomizeTrainNumber(false);
};
const randomizeTrainNumber = (randomizeRegions = false) => {
// if (categoryRules.value == null) return;
+18 -1
View File
@@ -102,7 +102,24 @@
"td2-wiki": "> Polish rules of train numbering (forum thread)",
"td2-wiki-link": "https://td2.info.pl/english-boards/new-train-categories-in-the-simulator/",
"action-random-region": "DRAW REGIONS",
"action-random-number": "DRAW A NUMBER",
"action-random-number": "DRAW LAST DIGITS",
"action-random-category": "DRAW A CATEGORY",
"rules": {
"first-digit": "First digit:",
"second-digit": "Second digit:",
"third-digit": "Third digit:",
"two-first-digits": "Two first digits:",
"two-last-digits": "Two last digits:",
"three-last-digits": "Three last digits:",
"from-pool": "from pool of",
"for-category": "for category",
"for-region": "for region",
"for-region-begin": "for the beginning construction region",
"for-region-end": "for the terminating construction region",
"from-range": "from range of"
},
"categories": {
"EI": "EI - domestic express",
"EC": "EC - international express",
+18 -1
View File
@@ -102,7 +102,24 @@
"td2-wiki": "> Szczegółowe zasady numeracji (wątek forum)",
"td2-wiki-link": "https://td2.info.pl/ogloszenia/nowe-kategorie-pociagow-w-symulatorze/",
"action-random-region": "LOSUJ OBSZARY",
"action-random-number": "LOSUJ NUMER",
"action-random-number": "LOSUJ KOŃCÓWKĘ",
"action-random-category": "LOSUJ KATEGORIĘ",
"rules": {
"first-digit": "Pierwsza cyfra:",
"second-digit": "Druga cyfra:",
"third-digit": "Trzecia cyfra:",
"two-first-digits": "Dwie pierwsze cyfry:",
"two-last-digits": "Dwie ostatnie cyfry:",
"three-last-digits": "Trzy ostatnie cyfry:",
"from-pool": "z puli",
"for-category": "dla kategorii",
"for-region": "dla obszaru",
"for-region-begin": "dla początkowego obszaru konstrukcyjnego",
"for-region-end": "dla końcowego obszaru konstrukcyjnego",
"from-range": "z przedziału"
},
"categories": {
"EI": "EI - ekspres krajowy",
"EC": "EC - ekspres międzynarodowy",