fixed translations

This commit is contained in:
grata
2023-05-06 11:55:34 +02:00
parent d2e5a227af
commit 6866d0779f
4 changed files with 29 additions and 13 deletions

View File

@@ -1,6 +1,12 @@
import {Component, OnInit} from '@angular/core';
import {Router} from "@angular/router";
import {homeTranslations, listTranslations, loginTranslations, managementTranslations} from "./interface/translations";
import {
detailTranslations,
homeTranslations,
listTranslations,
loginTranslations,
managementTranslations
} from "./interface/translations";
import {TranslateService} from "./service/language/translate.service";
import {ReadTranslateJsonService} from "./service/language/readTranslateJson.service";
import {cookieService} from "./service/cookie.service";
@@ -17,6 +23,7 @@ export class AppComponent implements OnInit {
listTranslations: listTranslations = {} as listTranslations;
managementTranslation: managementTranslations = {} as managementTranslations;
loginTranslation: loginTranslations = {} as loginTranslations;
detailTranslation: detailTranslations = {} as detailTranslations;
constructor(
@@ -32,6 +39,7 @@ export class AppComponent implements OnInit {
this.listTranslations = this.readTranslationJsonService.getListTransaltions();
this.managementTranslation = this.readTranslationJsonService.getManagementTranslations();
this.loginTranslation = this.readTranslationJsonService.getLoginTranslations();
this.detailTranslation = this.readTranslationJsonService.getDetailTranslations()
}
clearAllCookies() {
@@ -85,5 +93,10 @@ export class AppComponent implements OnInit {
this.loginTranslation.register = await this.translateService.getData(this.loginTranslation.register, lang);
this.loginTranslation.usernamePlaceholder = await this.translateService.getData(this.loginTranslation.usernamePlaceholder, lang);
this.loginTranslation.passwordPlaceholder = await this.translateService.getData(this.loginTranslation.passwordPlaceholder, lang);
this.loginTranslation.errorLogin = await this.translateService.getData(this.loginTranslation.errorLogin, lang);
this.loginTranslation.errorCreateUser = await this.translateService.getData(this.loginTranslation.errorCreateUser, lang);
// Load Detail Page Translations
this.detailTranslation.congratulations = await this.translateService.getData(this.detailTranslation.congratulations, lang);
}
}

View File

@@ -2,7 +2,7 @@
<div class="max-w-md">
<div class="bg-white px-6 py-8 rounded-lg shadow-md w-[400px]">
<div style="padding-bottom: 30px">
<div style="padding-bottom: 30px" *ngIf="errorLogin || errorCreateUser">
<div class="alert alert-error shadow-lg">
<div>
<svg xmlns="http://www.w3.org/2000/svg" class="stroke-current flex-shrink-0 h-6 w-6" fill="none"
@@ -10,9 +10,8 @@
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
<span *ngIf="errorLogin">Username o password sbagliate</span>
<span *ngIf="errorCreateUser">Username già utilizzato</span>
<span>ciao</span>
<span *ngIf="errorLogin">{{ loginTranslation.errorLogin }}</span>
<span *ngIf="errorCreateUser">{{ loginTranslation.errorCreateUser }}</span>
</div>
</div>
</div>

View File

@@ -36,14 +36,16 @@ export interface managementTranslations {
}
export interface loginTranslations {
"login": string,
"register": string,
"username": string,
"password": string,
"usernamePlaceholder": string,
"passwordPlaceholder": string
"login": string;
"register": string;
"username": string;
"password": string;
"usernamePlaceholder": string;
"passwordPlaceholder": string;
"errorLogin": string;
"errorCreateUser": string;
}
export interface detailTranslations {
"congratulations": string
"congratulations": string;
}