feat: add more translations

This commit is contained in:
EETagent 2023-01-26 21:15:44 +01:00
parent 528b534446
commit a87358a3b3
3 changed files with 53 additions and 38 deletions

View file

@ -25,7 +25,10 @@
import GradesTable from '$lib/components/grades/GradesTable.svelte'; import GradesTable from '$lib/components/grades/GradesTable.svelte';
import SchoolSelect from '$lib/components/select/SchoolSelect.svelte'; import SchoolSelect from '$lib/components/select/SchoolSelect.svelte';
import PersonalIdConfirmCheckBox from '$lib/components/checkbox/PersonalIdConfirmCheckBox.svelte'; import PersonalIdConfirmCheckBox from '$lib/components/checkbox/PersonalIdConfirmCheckBox.svelte';
import { deriveBirthdateFromPersonalId, isPersonalIdNumberWithBirthdateValid } from '$lib/utils/personalIdFormat'; import {
deriveBirthdateFromPersonalId,
isPersonalIdNumberWithBirthdateValid
} from '$lib/utils/personalIdFormat';
let pageIndex = 0; let pageIndex = 0;
let pagesFilled = [false, false, false, false, false, false, false, false]; let pagesFilled = [false, false, false, false, false, false, false, false];
@ -72,9 +75,9 @@
schoolName: '', schoolName: '',
healthInsurance: '', healthInsurance: '',
grades: [], grades: [],
firstSchool: {name: '', field: ''}, firstSchool: { name: '', field: '' },
secondSchool: {name: '', field: ''}, secondSchool: { name: '', field: '' },
testLanguage: '', testLanguage: ''
}, },
parents: [ parents: [
{ {
@ -136,16 +139,17 @@
semester: yup.string().required() semester: yup.string().required()
}) })
.required() .required()
).required(), )
.required(),
firstSchool: yup.object().shape({ firstSchool: yup.object().shape({
name: yup.string().required(), name: yup.string().required(),
field: yup.string().required(), field: yup.string().required()
}), }),
secondSchool: yup.object().shape({ secondSchool: yup.object().shape({
name: yup.string().required(), name: yup.string().required(),
field: yup.string().required(), field: yup.string().required()
}), }),
testLanguage: yup.string().required(), testLanguage: yup.string().required()
}), }),
parents: yup.array().of( parents: yup.array().of(
yup.object().shape({ yup.object().shape({
@ -276,8 +280,8 @@
const isPageInvalid = (index: number): boolean => { const isPageInvalid = (index: number): boolean => {
switch (index) { switch (index) {
case 0: case 0:
if ($typedErrors['personalIdOk'] || $typedErrors['personalIdErr']) { if ($typedErrors['personalIdOk'] || $typedErrors['personalIdErr']) {
return true; return true;
} }
break; break;
@ -343,9 +347,12 @@
break; break;
case 7: case 7:
// @ts-ignore // @ts-ignore
if ($typedErrors["candidate"]["firstSchool"].name || $typedErrors["candidate"]["firstSchool"].field || if (
$typedErrors['candidate']['firstSchool'].name ||
$typedErrors['candidate']['firstSchool'].field ||
// @ts-ignore // @ts-ignore
$typedErrors["candidate"]["secondSchool"].name || $typedErrors["candidate"]["secondSchool"].field $typedErrors['candidate']['secondSchool'].name ||
$typedErrors['candidate']['secondSchool'].field
) { ) {
return true; return true;
} }
@ -363,7 +370,6 @@
return '+' + telephone.match(/[0-9]{1,3}/g)!.join(' '); return '+' + telephone.match(/[0-9]{1,3}/g)!.join(' ');
}; };
/* $form.candidate.personalIdNumber = data.whoami.personalIdNumber; /* $form.candidate.personalIdNumber = data.whoami.personalIdNumber;
const [birthdate, sex] = deriveBirthdateFromPersonalId(data.whoami.personalIdNumber); const [birthdate, sex] = deriveBirthdateFromPersonalId(data.whoami.personalIdNumber);
$form.candidate.birthdate = birthdate; $form.candidate.birthdate = birthdate;
@ -473,17 +479,18 @@
<div class="field flex"> <div class="field flex">
<span class="w-[50%]"> <span class="w-[50%]">
<NameField <NameField
error={$typedErrors['candidate']['name'] || $typedErrors['candidate']['surname']} error={$typedErrors['candidate']['name'] ||
$typedErrors['candidate']['surname']}
bind:valueName={$form.candidate.name} bind:valueName={$form.candidate.name}
bind:valueSurname={$form.candidate.surname} bind:valueSurname={$form.candidate.surname}
placeholder={$LL.input.nameSurname()} placeholder={$LL.input.nameSurname()}
/> />
</span> </span>
<span class="w-[50%] ml-2"> <span class="ml-2 w-[50%]">
<TextField <TextField
error={$typedErrors['candidate']['birthSurname']} error={$typedErrors['candidate']['birthSurname']}
bind:value={$form.candidate.birthSurname} bind:value={$form.candidate.birthSurname}
placeholder="Rodné příjmení (pokud odlišné)" placeholder={$LL.input.birthSurname()}
/> />
</span> </span>
</div> </div>
@ -493,24 +500,24 @@
error={$typedErrors['candidate']['email']} error={$typedErrors['candidate']['email']}
bind:value={$form.candidate.email} bind:value={$form.candidate.email}
placeholder={$LL.input.email()} placeholder={$LL.input.email()}
/> />
</span> </span>
<span class="w-[50%] ml-2"> <span class="ml-2 w-[50%]">
<TelephoneField <TelephoneField
error={$typedErrors['candidate']['telephone']} error={$typedErrors['candidate']['telephone']}
bind:value={$form.candidate.telephone} bind:value={$form.candidate.telephone}
placeholder={$LL.input.telephone()} placeholder={$LL.input.telephone()}
/> />
</span> </span>
</div> </div>
<span class="field"> <span class="field">
<TextField <TextField
error={$typedErrors['candidate']['city']} error={$typedErrors['candidate']['city']}
bind:value={$form.candidate.city} bind:value={$form.candidate.city}
type="text" type="text"
placeholder={$LL.input.city()} placeholder={$LL.input.city()}
helperText="Uveďte poštovní směrovací číslo. (např. 602 00)" helperText="Uveďte poštovní směrovací číslo. (např. 602 00)"
/> />
</span> </span>
</div> </div>
<div class="field flex"> <div class="field flex">
@ -550,7 +557,7 @@
options={['Česká republika', 'Slovenská republika', 'Ukrajina', 'Jiné']} options={['Česká republika', 'Slovenská republika', 'Ukrajina', 'Jiné']}
/> />
</span> </span>
<span class="w-[50%] ml-2"> <span class="ml-2 w-[50%]">
<SelectField <SelectField
error={$typedErrors['candidate']['testLanguage']} error={$typedErrors['candidate']['testLanguage']}
bind:value={$form.candidate.testLanguage} bind:value={$form.candidate.testLanguage}
@ -571,7 +578,7 @@
error={$typedErrors['candidate']['birthplace']} error={$typedErrors['candidate']['birthplace']}
bind:value={$form.candidate.birthplace} bind:value={$form.candidate.birthplace}
type="text" type="text"
placeholder="Místo narození" placeholder={$LL.input.birthPlace()}
helperText="TODO: (Místo narození)" helperText="TODO: (Místo narození)"
/> />
</div> </div>
@ -580,13 +587,13 @@
<IdField <IdField
error={$typedErrors['candidate']['personalIdNumber']} error={$typedErrors['candidate']['personalIdNumber']}
bind:value={$form.candidate.personalIdNumber} bind:value={$form.candidate.personalIdNumber}
placeholder="Rodné číslo" placeholder={$LL.input.personalIdentificationNumber()}
/> />
{:else} {:else}
<TextField <TextField
error={$typedErrors['candidate']['personalIdNumber']} error={$typedErrors['candidate']['personalIdNumber']}
bind:value={$form.candidate.personalIdNumber} bind:value={$form.candidate.personalIdNumber}
placeholder="Rodné číslo" placeholder={$LL.input.personalIdentificationNumber()}
/> />
{/if} {/if}
<div class="ml-2"> <div class="ml-2">
@ -605,14 +612,14 @@
error={$typedErrors['candidate']['schoolName']} error={$typedErrors['candidate']['schoolName']}
type="number" type="number"
bind:value={$form.candidate.schoolName} bind:value={$form.candidate.schoolName}
placeholder="IZO školy" placeholder={$LL.input.schoolIzo()}
/> />
{:else} {:else}
<TextField <TextField
error={$typedErrors['candidate']['schoolName']} error={$typedErrors['candidate']['schoolName']}
type="text" type="text"
bind:value={$form.candidate.schoolName} bind:value={$form.candidate.schoolName}
placeholder="Název školy" placeholder={$LL.input.schoolName()}
/> />
{/if} {/if}
</span> </span>
@ -622,11 +629,10 @@
error={$typedErrors['candidate']['healthInsurance']} error={$typedErrors['candidate']['healthInsurance']}
type="text" type="text"
bind:value={$form.candidate.healthInsurance} bind:value={$form.candidate.healthInsurance}
placeholder="Číslo zdravotní pojišťovny" placeholder={$LL.input.insuranceNumber()}
/> />
</span> </span>
</div> </div>
{:else if pageIndex === 5} {:else if pageIndex === 5}
<h1 class="title mt-8">{pageTexts[3]}</h1> <h1 class="title mt-8">{pageTexts[3]}</h1>
<p class="description mt-8 block text-center"> <p class="description mt-8 block text-center">
@ -687,12 +693,12 @@
</div> </div>
{:else if pageIndex === 7} {:else if pageIndex === 7}
<h1 class="title mt-8">Přihlášky na školy</h1> <h1 class="title mt-8">Přihlášky na školy</h1>
<div class="flex flex-col justify-between h-full"> <div class="flex h-full flex-col justify-between">
<span> <span>
<SchoolSelect bind:selectedSchool={$form.candidate.firstSchool}></SchoolSelect> <SchoolSelect bind:selectedSchool={$form.candidate.firstSchool} />
</span> </span>
<span class="mt-10 w-full"> <span class="mt-10 w-full">
<SchoolSelect bind:selectedSchool={$form.candidate.secondSchool}></SchoolSelect> <SchoolSelect bind:selectedSchool={$form.candidate.secondSchool} />
</span> </span>
</div> </div>
{:else if pageIndex === 8} {:else if pageIndex === 8}

View file

@ -134,6 +134,7 @@ const cs: BaseTranslation = {
input: { input: {
optional: 'nepovinné', optional: 'nepovinné',
nameSurname: 'Jméno a příjmení', nameSurname: 'Jméno a příjmení',
birthSurname: "Rodné příjmení (pokud odlišné)",
email: 'E-mail', email: 'E-mail',
telephone: 'Telefon', telephone: 'Telefon',
address: 'Ulice a č. p.', address: 'Ulice a č. p.',

View file

@ -317,6 +317,10 @@ type RootTranslation = {
* Jméno a příjmení * Jméno a příjmení
*/ */
nameSurname: string nameSurname: string
/**
* Rodné příjmení (pokud odlišné)
*/
birthSurname: string
/** /**
* E-mail * E-mail
*/ */
@ -708,6 +712,10 @@ export type TranslationFunctions = {
* Jméno a příjmení * Jméno a příjmení
*/ */
nameSurname: () => LocalizedString nameSurname: () => LocalizedString
/**
* Rodné příjmení (pokud odlišné)
*/
birthSurname: () => LocalizedString
/** /**
* E-mail * E-mail
*/ */