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"> <div class="category-rules" v-if="chosenCategory && categoryRules && trainNumber">
<!-- First & second digit (the same regions) --> <!-- First & second digit (the same regions) -->
<div v-if="beginRegionName && endRegionName && beginRegionName == endRegionName"> <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> <b class="text--accent">{{ genData.sameRegions[beginRegionName].join(', ') }}</b>
dla obszaru {{ beginRegionName }} {{ $t('numgen.rules.for-region') }} {{ beginRegionName }}
</div> </div>
<!-- First & second digit (different regions) --> <!-- First & second digit (different regions) -->
<div v-else> <div v-else>
<div> <div>
<b> <b>
Pierwsza cyfra: <span class="text--accent">{{ trainNumber[0] }}</span> {{ $t('numgen.rules.first-digit') }} <span class="text--accent">{{ trainNumber[0] }}</span>
</b> </b>
<span v-if="beginRegionName"> dla początkowego obszaru konstrukcyjnego {{ beginRegionName }}</span> {{ $t('numgen.rules.for-region-begin') }} {{ beginRegionName }}
<span v-else>wybierz początkowy obszar konstrukcyjny</span>
</div> </div>
<div> <div>
<b> <b>
Druga cyfra: <span class="text--accent">{{ trainNumber[1] }}</span> {{ $t('numgen.rules.second-digit') }} <span class="text--accent">{{ trainNumber[1] }} </span>
</b> </b>
<span v-if="endRegionName"> dla końcowego obszaru konstrukcyjnego {{ endRegionName }}</span> {{ $t('numgen.rules.for-region-end') }} {{ endRegionName }}
<span v-else>wybierz początkowy obszar konstrukcyjny</span>
</div> </div>
</div> </div>
<!-- Third digit (non-passenger only) --> <!-- Third digit (non-passenger only) -->
<div v-if="categoryRules[0] != null"> <div v-if="categoryRules[0] != null">
<b> <b>
Trzecia cyfra: <span class="text--accent">{{ categoryRules[0] }}</span> {{ $t('numgen.rules.third-digit') }} <span class="text--accent">{{ categoryRules[0] }}</span>
</b> </b>
dla kategorii {{ chosenCategory }} {{ $t('numgen.rules.for-category') }} {{ chosenCategory }}
</div> </div>
<!-- Last digits -->
<div> <div>
<b> {{ categoryRules[1]?.length == 3 ? 'Trzy' : 'Dwie' }} ostatnie cyfry:</b> <b> {{ $t(`numgen.rules.${categoryRules[1]?.length == 3 ? 'three' : 'two'}-last-digits`) }}</b>
z przedziału {{ $t('numgen.rules.from-range') }}
<b class="text--accent">{{ categoryRules[1] }}-{{ categoryRules[2] }}</b> <b class="text--accent">{{ categoryRules[1] }}-{{ categoryRules[2] }}</b>
</div> </div>
</div> </div>
@@ -107,7 +106,9 @@
{{ $t('numgen.action-random-region') }} {{ $t('numgen.action-random-region') }}
</button> </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)"> <button class="btn" @click="randomizeTrainNumber(false)">
{{ $t('numgen.action-random-number') }} {{ $t('numgen.action-random-number') }}
@@ -147,6 +148,13 @@ const categoryRules = computed(() => {
return genData.categoriesRules[chosenCategory.value]; 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) => { const randomizeTrainNumber = (randomizeRegions = false) => {
// if (categoryRules.value == null) return; // if (categoryRules.value == null) return;
+18 -1
View File
@@ -102,7 +102,24 @@
"td2-wiki": "> Polish rules of train numbering (forum thread)", "td2-wiki": "> Polish rules of train numbering (forum thread)",
"td2-wiki-link": "https://td2.info.pl/english-boards/new-train-categories-in-the-simulator/", "td2-wiki-link": "https://td2.info.pl/english-boards/new-train-categories-in-the-simulator/",
"action-random-region": "DRAW REGIONS", "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": { "categories": {
"EI": "EI - domestic express", "EI": "EI - domestic express",
"EC": "EC - international express", "EC": "EC - international express",
+18 -1
View File
@@ -102,7 +102,24 @@
"td2-wiki": "> Szczegółowe zasady numeracji (wątek forum)", "td2-wiki": "> Szczegółowe zasady numeracji (wątek forum)",
"td2-wiki-link": "https://td2.info.pl/ogloszenia/nowe-kategorie-pociagow-w-symulatorze/", "td2-wiki-link": "https://td2.info.pl/ogloszenia/nowe-kategorie-pociagow-w-symulatorze/",
"action-random-region": "LOSUJ OBSZARY", "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": { "categories": {
"EI": "EI - ekspres krajowy", "EI": "EI - ekspres krajowy",
"EC": "EC - ekspres międzynarodowy", "EC": "EC - ekspres międzynarodowy",