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>
<h1>Login</h1>
<h1 i18n>Login</h1>
<div>
<mat-icon>mail</mat-icon>
<label for="email">
<label for="email" i18n>
Email address
<span class="required">*</span>
</label>
@@ -10,14 +10,14 @@
</div>
<div>
<mat-icon>lock</mat-icon>
<label for="password">
<label for="password" i18n>
Password
<span class="required">*</span>
</label>
<input type="password" id="password" formControlName="password" required />
</div>
<div class="actions">
<button type="submit">Send</button>
<a [routerLink]="['/signin']">Create an account</a>
<button type="submit" i18n>Send</button>
<a [routerLink]="['/signin']" i18n>Create an account</a>
</div>
</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)
.then((response) => {
this.authenticationService.authenticate(response.accessToken, response.refreshToken);
this.snackBar.open('Authentication succeeded!', 'Close', {
duration: 5000,
});
this.snackBar.open($localize`Authentication succeeded!`, $localize`Close`, { duration: 5000 });
this.router.navigate(['/home']);
})
.catch((error) => {
console.error(error);
this.snackBar.open('Authentication failed.', 'Close', {
duration: 5000,
});
this.snackBar.open($localize`Authentication failed.`, $localize`Close`, { duration: 5000 });
});
}
}