i18n for login page.

This commit is contained in:
Florian THIERRY
2024-09-21 11:22:35 +02:00
parent fd5ad7e88e
commit 3935f6ad21
6 changed files with 24 additions and 37 deletions

View File

@@ -1,8 +1,8 @@
<form [formGroup]="loginForm" (submit)="performLogin()" ngNativeValidate> <form [formGroup]="loginForm" (submit)="performLogin()" ngNativeValidate>
<h1>Login</h1> <h1 i18n>Login</h1>
<div> <div>
<mat-icon>mail</mat-icon> <mat-icon>mail</mat-icon>
<label for="email"> <label for="email" i18n>
Email address Email address
<span class="required">*</span> <span class="required">*</span>
</label> </label>
@@ -10,14 +10,14 @@
</div> </div>
<div> <div>
<mat-icon>lock</mat-icon> <mat-icon>lock</mat-icon>
<label for="password"> <label for="password" i18n>
Password Password
<span class="required">*</span> <span class="required">*</span>
</label> </label>
<input type="password" id="password" formControlName="password" required /> <input type="password" id="password" formControlName="password" required />
</div> </div>
<div class="actions"> <div class="actions">
<button type="submit">Send</button> <button type="submit" i18n>Send</button>
<a [routerLink]="['/signin']">Create an account</a> <a [routerLink]="['/signin']" i18n>Create an account</a>
</div> </div>
</form> </form>

View File

@@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { LoginComponent } from './login.component';
describe('LoginComponent', () => {
let component: LoginComponent;
let fixture: ComponentFixture<LoginComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [LoginComponent]
})
.compileComponents();
fixture = TestBed.createComponent(LoginComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -66,16 +66,12 @@ export class LoginService {
.login(state.request) .login(state.request)
.then((response) => { .then((response) => {
this.authenticationService.authenticate(response.accessToken, response.refreshToken); this.authenticationService.authenticate(response.accessToken, response.refreshToken);
this.snackBar.open('Authentication succeeded!', 'Close', { this.snackBar.open($localize`Authentication succeeded!`, $localize`Close`, { duration: 5000 });
duration: 5000,
});
this.router.navigate(['/home']); this.router.navigate(['/home']);
}) })
.catch((error) => { .catch((error) => {
console.error(error); console.error(error);
this.snackBar.open('Authentication failed.', 'Close', { this.snackBar.open($localize`Authentication failed.`, $localize`Close`, { duration: 5000 });
duration: 5000,
});
}); });
} }
} }

View File

@@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>CodikiNg</title> <title>Codiki</title>
<base href="/"> <base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="assets/images/favicon.ico"> <link rel="icon" type="image/x-icon" href="assets/images/favicon.ico">

View File

@@ -7,6 +7,13 @@
"5148998676057880041": "Chargement des publications...", "5148998676057880041": "Chargement des publications...",
"3688381096110057852": "Il n'y a aucune publication.", "3688381096110057852": "Il n'y a aucune publication.",
"8393632007890629197": "Une erreur est survenue lors du chargement des dernières publications...", "8393632007890629197": "Une erreur est survenue lors du chargement des dernières publications...",
"7819314041543176992": "Fermer" "7819314041543176992": "Fermer",
"2454050363478003966": "Connexion",
"8138320902772264034": "Adresse email {$START_TAG_SPAN}*{$CLOSE_TAG_SPAN}",
"9175472990822669391": "Mot de passe {$START_TAG_SPAN}*{$CLOSE_TAG_SPAN}",
"6490688569532630280": "Valider",
"2308975396733519902": "Créer un compte",
"1037765878727976611": "Connexion réussie",
"6034686865111167926": "Une erreur est survenue lors de la connexion."
} }
} }

View File

@@ -7,6 +7,13 @@
"5148998676057880041": "Publications loading...", "5148998676057880041": "Publications loading...",
"3688381096110057852": "No any publication.", "3688381096110057852": "No any publication.",
"8393632007890629197": "An error occurred while retrieving latest publications...", "8393632007890629197": "An error occurred while retrieving latest publications...",
"7819314041543176992": "Close" "7819314041543176992": "Close",
"2454050363478003966": "Login",
"8138320902772264034": " Email address {$START_TAG_SPAN}*{$CLOSE_TAG_SPAN}",
"9175472990822669391": " Password {$START_TAG_SPAN}*{$CLOSE_TAG_SPAN}",
"6490688569532630280": "Send",
"2308975396733519902": "Create an account",
"1037765878727976611": "Authentication succeeded!",
"6034686865111167926": "Authentication failed."
} }
} }