diff options
author | Chocobozzz <me@florianbigard.com> | 2020-08-12 10:40:04 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-08-14 10:28:30 +0200 |
commit | 66357162f8e1227495f09bd4f68446aad7071c6d (patch) | |
tree | 7d4429506deb512b2fe1d0267f38a28cda20af55 /client/src/app/+login | |
parent | 8c360747995e17eb5520e22fc3d7bd4c3d26eeee (diff) | |
download | PeerTube-66357162f8e1227495f09bd4f68446aad7071c6d.tar.gz PeerTube-66357162f8e1227495f09bd4f68446aad7071c6d.tar.zst PeerTube-66357162f8e1227495f09bd4f68446aad7071c6d.zip |
Migrate to $localize
* Remove i18n polyfill to translate things in components
* Reduce bundle sizes
* Improve runtime perf
* Reduce a lot the time to make a full client build
* Reduce client build complexity
* We don't need a service to translate things anymore (so we will be able to translate title pages etc)
Unfortunately we may loose some translations in the migration process.
I'll put a message on weblate to notify translators
Diffstat (limited to 'client/src/app/+login')
-rw-r--r-- | client/src/app/+login/login.component.ts | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/client/src/app/+login/login.component.ts b/client/src/app/+login/login.component.ts index e5a382218..e9336172e 100644 --- a/client/src/app/+login/login.component.ts +++ b/client/src/app/+login/login.component.ts | |||
@@ -5,7 +5,6 @@ import { AuthService, Notifier, RedirectService, UserService } from '@app/core' | |||
5 | import { HooksService } from '@app/core/plugins/hooks.service' | 5 | import { HooksService } from '@app/core/plugins/hooks.service' |
6 | import { FormReactive, FormValidatorService, LoginValidatorsService } from '@app/shared/shared-forms' | 6 | import { FormReactive, FormValidatorService, LoginValidatorsService } from '@app/shared/shared-forms' |
7 | import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' | 7 | import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' |
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
9 | import { RegisteredExternalAuthConfig, ServerConfig } from '@shared/models' | 8 | import { RegisteredExternalAuthConfig, ServerConfig } from '@shared/models' |
10 | 9 | ||
11 | @Component({ | 10 | @Component({ |
@@ -37,9 +36,8 @@ export class LoginComponent extends FormReactive implements OnInit, AfterViewIni | |||
37 | private userService: UserService, | 36 | private userService: UserService, |
38 | private redirectService: RedirectService, | 37 | private redirectService: RedirectService, |
39 | private notifier: Notifier, | 38 | private notifier: Notifier, |
40 | private hooks: HooksService, | 39 | private hooks: HooksService |
41 | private i18n: I18n | 40 | ) { |
42 | ) { | ||
43 | super() | 41 | super() |
44 | } | 42 | } |
45 | 43 | ||
@@ -105,10 +103,9 @@ export class LoginComponent extends FormReactive implements OnInit, AfterViewIni | |||
105 | this.userService.askResetPassword(this.forgotPasswordEmail) | 103 | this.userService.askResetPassword(this.forgotPasswordEmail) |
106 | .subscribe( | 104 | .subscribe( |
107 | () => { | 105 | () => { |
108 | const message = this.i18n( | 106 | const message = $localize`An email with the reset password instructions will be sent to ${this.forgotPasswordEmail}. |
109 | 'An email with the reset password instructions will be sent to {{email}}. The link will expire within 1 hour.', | 107 | The link will expire within 1 hour.` |
110 | { email: this.forgotPasswordEmail } | 108 | |
111 | ) | ||
112 | this.notifier.success(message) | 109 | this.notifier.success(message) |
113 | this.hideForgotPasswordModal() | 110 | this.hideForgotPasswordModal() |
114 | }, | 111 | }, |
@@ -140,8 +137,8 @@ export class LoginComponent extends FormReactive implements OnInit, AfterViewIni | |||
140 | } | 137 | } |
141 | 138 | ||
142 | private handleError (err: any) { | 139 | private handleError (err: any) { |
143 | if (err.message.indexOf('credentials are invalid') !== -1) this.error = this.i18n('Incorrect username or password.') | 140 | if (err.message.indexOf('credentials are invalid') !== -1) this.error = $localize`Incorrect username or password.` |
144 | else if (err.message.indexOf('blocked') !== -1) this.error = this.i18n('Your account is blocked.') | 141 | else if (err.message.indexOf('blocked') !== -1) this.error = $localize`Your account is blocked.` |
145 | else this.error = err.message | 142 | else this.error = err.message |
146 | } | 143 | } |
147 | } | 144 | } |