feat: add english and hungarian translations

This commit is contained in:
2026-08-29 11:42:16 +02:00
parent ab32f01e07
commit 0c1a9f86d6
13 changed files with 285 additions and 64 deletions
+21 -15
View File
@@ -1,4 +1,4 @@
import { Component, ViewChild } from '@angular/core';
import { Component, inject, ViewChild } from '@angular/core';
import {
IonHeader,
IonToolbar,
@@ -26,6 +26,9 @@ import { add, trash } from 'ionicons/icons';
import { OverlayEventDetail } from '@ionic/core/components';
import { FormsModule } from '@angular/forms';
import { FullnamePipe } from '../fullname-pipe';
import { TranslatePipe } from '../i18n/translation.pipe';
import { TranslationKey } from '../i18n/translations';
import { TranslationService } from '../i18n/translation.service';
@Component({
selector: 'app-tab2',
@@ -51,12 +54,19 @@ import { FullnamePipe } from '../fullname-pipe';
IonSelect,
IonSelectOption,
IonList,
FullnamePipe
FullnamePipe,
TranslatePipe
]
})
export class Tab2Page {
readonly translationService = inject(TranslationService);
@ViewChild(IonModal) modal!: IonModal;
public readonly umpireService = inject(UmpireService);
public readonly fullnamePipe = inject(FullnamePipe);
public readonly alertController = inject(AlertController);
public readonly umpires = this.umpireService.umpires;
public lastName: string = '';
@@ -64,16 +74,12 @@ export class Tab2Page {
public country: string = '';
public gender: string = '';
public genders = [
{ label: 'gender.male', code: 'M' },
{ label: 'gender.female', code: 'W' }
public genders: { label: TranslationKey; code: string }[] = [
{ label: 'male', code: 'M' },
{ label: 'female', code: 'W' }
];
constructor(
private umpireService: UmpireService,
private alertController: AlertController,
private fullnamePipe: FullnamePipe
) {
constructor() {
addIcons({ add, trash });
}
@@ -112,18 +118,18 @@ export class Tab2Page {
return this.lastName !== '' && this.firstName !== '';
}
public async showDeleteConfirmation(umpire: Umpire) {
public async showDeleteConfirmation(umpire: Umpire): Promise<void> {
const alert = await this.alertController.create({
header: 'Megerősítés',
subHeader: 'Biztos törlöd a következő játékvezetőt?',
header: this.translationService.translate('confirmation'),
subHeader: this.translationService.translate('confirmDeleteUmpire'),
message: this.fullnamePipe.transform(umpire),
buttons: [
{
text: 'Nem',
text: this.translationService.translate('no'),
role: 'cancel'
},
{
text: 'Igen',
text: this.translationService.translate('yes'),
role: 'confirm',
handler: () => {
// TODO: also remove from first tab