diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-04 16:21:17 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-05 08:43:01 +0200 |
commit | b1d40cff89f7cff565a98cdbcea9a624196a169a (patch) | |
tree | d24746c1cc69f50471a9eba0dfb1c1bae06a1870 /client/src/app/login | |
parent | 989e526abf0c0dd7958deb630df009608561bb67 (diff) | |
download | PeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.tar.gz PeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.tar.zst PeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.zip |
Add i18n attributes
Diffstat (limited to 'client/src/app/login')
-rw-r--r-- | client/src/app/login/login.component.html | 28 | ||||
-rw-r--r-- | client/src/app/login/login.component.ts | 25 |
2 files changed, 30 insertions, 23 deletions
diff --git a/client/src/app/login/login.component.html b/client/src/app/login/login.component.html index b7fd25d27..1f6cfdb90 100644 --- a/client/src/app/login/login.component.html +++ b/client/src/app/login/login.component.html | |||
@@ -1,5 +1,5 @@ | |||
1 | <div class="margin-content"> | 1 | <div class="margin-content"> |
2 | <div class="title-page title-page-single"> | 2 | <div i18n class="title-page title-page-single"> |
3 | Login | 3 | Login |
4 | </div> | 4 | </div> |
5 | 5 | ||
@@ -8,21 +8,21 @@ | |||
8 | <form role="form" (ngSubmit)="login()" [formGroup]="form"> | 8 | <form role="form" (ngSubmit)="login()" [formGroup]="form"> |
9 | <div class="form-group"> | 9 | <div class="form-group"> |
10 | <div> | 10 | <div> |
11 | <label for="username">User</label> | 11 | <label i18n for="username">User</label> |
12 | <input | 12 | <input |
13 | type="text" id="username" placeholder="Username or email address" required tabindex="1" | 13 | type="text" id="username" i18n-placeholder placeholder="Username or email address" required tabindex="1" |
14 | formControlName="username" [ngClass]="{ 'input-error': formErrors['username'] }" | 14 | formControlName="username" [ngClass]="{ 'input-error': formErrors['username'] }" |
15 | > | 15 | > |
16 | <a *ngIf="signupAllowed === true" routerLink="/signup" class="create-an-account"> | 16 | <a i18n *ngIf="signupAllowed === true" routerLink="/signup" class="create-an-account"> |
17 | or create an account | 17 | or create an account |
18 | </a> | 18 | </a> |
19 | 19 | ||
20 | <a *ngIf="signupAllowed === false" href="https://joinpeertube.org/en/#getting-started" target="_blank" class="create-an-account"> | 20 | <a i18n *ngIf="signupAllowed === false" href="https://joinpeertube.org/en/#getting-started" target="_blank" class="create-an-account"> |
21 | or create an account on another instance | 21 | or create an account on another instance |
22 | </a> | 22 | </a> |
23 | 23 | ||
24 | <my-help | 24 | <my-help |
25 | *ngIf="signupAllowed === false" helpType="custom" | 25 | *ngIf="signupAllowed === false" helpType="custom" i18n-customHtml |
26 | customHtml="User registration is not allowed on this instance, but you can register on many others!" | 26 | customHtml="User registration is not allowed on this instance, but you can register on many others!" |
27 | ></my-help> | 27 | ></my-help> |
28 | </div> | 28 | </div> |
@@ -33,13 +33,13 @@ | |||
33 | </div> | 33 | </div> |
34 | 34 | ||
35 | <div class="form-group"> | 35 | <div class="form-group"> |
36 | <label for="password">Password</label> | 36 | <label i18n for="password">Password</label> |
37 | <div> | 37 | <div> |
38 | <input | 38 | <input |
39 | type="password" name="password" id="password" placeholder="Password" required tabindex="2" | 39 | type="password" name="password" id="password" i18n-placeholder placeholder="Password" required tabindex="2" |
40 | formControlName="password" [ngClass]="{ 'input-error': formErrors['password'] }" | 40 | formControlName="password" [ngClass]="{ 'input-error': formErrors['password'] }" |
41 | > | 41 | > |
42 | <div class="forgot-password-button" (click)="openForgotPasswordModal()">I forgot my password</div> | 42 | <div i18n class="forgot-password-button" (click)="openForgotPasswordModal()">I forgot my password</div> |
43 | </div> | 43 | </div> |
44 | <div *ngIf="formErrors.password" class="form-error"> | 44 | <div *ngIf="formErrors.password" class="form-error"> |
45 | {{ formErrors.password }} | 45 | {{ formErrors.password }} |
@@ -56,25 +56,25 @@ | |||
56 | 56 | ||
57 | <div class="modal-header"> | 57 | <div class="modal-header"> |
58 | <span class="close" aria-hidden="true" (click)="hideForgotPasswordModal()"></span> | 58 | <span class="close" aria-hidden="true" (click)="hideForgotPasswordModal()"></span> |
59 | <h4 class="modal-title">Forgot your password</h4> | 59 | <h4 i18n class="modal-title">Forgot your password</h4> |
60 | </div> | 60 | </div> |
61 | 61 | ||
62 | <div class="modal-body"> | 62 | <div class="modal-body"> |
63 | <div class="form-group"> | 63 | <div class="form-group"> |
64 | <label for="forgot-password-email">Email</label> | 64 | <label i18n for="forgot-password-email">Email</label> |
65 | <input | 65 | <input |
66 | type="email" id="forgot-password-email" placeholder="Email address" required | 66 | type="email" id="forgot-password-email" i18n-placeholder placeholder="Email address" required |
67 | [(ngModel)]="forgotPasswordEmail" #forgotPasswordEmailInput | 67 | [(ngModel)]="forgotPasswordEmail" #forgotPasswordEmailInput |
68 | > | 68 | > |
69 | </div> | 69 | </div> |
70 | 70 | ||
71 | <div class="form-group inputs"> | 71 | <div class="form-group inputs"> |
72 | <span class="action-button action-button-cancel" (click)="hideForgotPasswordModal()"> | 72 | <span i18n class="action-button action-button-cancel" (click)="hideForgotPasswordModal()"> |
73 | Cancel | 73 | Cancel |
74 | </span> | 74 | </span> |
75 | 75 | ||
76 | <input | 76 | <input |
77 | type="submit" value="Send me an email to reset my password" class="action-button-submit" | 77 | type="submit" i18n-value value="Send me an email to reset my password" class="action-button-submit" |
78 | (click)="askResetPassword()" [disabled]="!forgotPasswordEmailInput.validity.valid" | 78 | (click)="askResetPassword()" [disabled]="!forgotPasswordEmailInput.validity.valid" |
79 | > | 79 | > |
80 | </div> | 80 | </div> |
diff --git a/client/src/app/login/login.component.ts b/client/src/app/login/login.component.ts index 2514faf94..a14cb2eb7 100644 --- a/client/src/app/login/login.component.ts +++ b/client/src/app/login/login.component.ts | |||
@@ -7,6 +7,7 @@ import { NotificationsService } from 'angular2-notifications' | |||
7 | import { ModalDirective } from 'ngx-bootstrap/modal' | 7 | import { ModalDirective } from 'ngx-bootstrap/modal' |
8 | import { AuthService } from '../core' | 8 | import { AuthService } from '../core' |
9 | import { FormReactive } from '../shared' | 9 | import { FormReactive } from '../shared' |
10 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
10 | 11 | ||
11 | @Component({ | 12 | @Component({ |
12 | selector: 'my-login', | 13 | selector: 'my-login', |
@@ -35,12 +36,15 @@ export class LoginComponent extends FormReactive implements OnInit { | |||
35 | } | 36 | } |
36 | forgotPasswordEmail = '' | 37 | forgotPasswordEmail = '' |
37 | 38 | ||
38 | constructor (private authService: AuthService, | 39 | constructor ( |
39 | private userService: UserService, | 40 | private authService: AuthService, |
40 | private serverService: ServerService, | 41 | private userService: UserService, |
41 | private redirectService: RedirectService, | 42 | private serverService: ServerService, |
42 | private notificationsService: NotificationsService, | 43 | private redirectService: RedirectService, |
43 | private formBuilder: FormBuilder) { | 44 | private notificationsService: NotificationsService, |
45 | private formBuilder: FormBuilder, | ||
46 | private i18n: I18n | ||
47 | ) { | ||
44 | super() | 48 | super() |
45 | } | 49 | } |
46 | 50 | ||
@@ -78,12 +82,15 @@ export class LoginComponent extends FormReactive implements OnInit { | |||
78 | this.userService.askResetPassword(this.forgotPasswordEmail) | 82 | this.userService.askResetPassword(this.forgotPasswordEmail) |
79 | .subscribe( | 83 | .subscribe( |
80 | res => { | 84 | res => { |
81 | const message = `An email with the reset password instructions will be sent to ${this.forgotPasswordEmail}.` | 85 | const message = this.i18n( |
82 | this.notificationsService.success('Success', message) | 86 | 'An email with the reset password instructions will be sent to {{ email }}.', |
87 | { email: this.forgotPasswordEmail } | ||
88 | ) | ||
89 | this.notificationsService.success(this.i18n('Success'), message) | ||
83 | this.hideForgotPasswordModal() | 90 | this.hideForgotPasswordModal() |
84 | }, | 91 | }, |
85 | 92 | ||
86 | err => this.notificationsService.error('Error', err.message) | 93 | err => this.notificationsService.error(this.i18n('Error'), err.message) |
87 | ) | 94 | ) |
88 | } | 95 | } |
89 | 96 | ||