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/+admin/users/user-edit/user-update.component.ts | |
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/+admin/users/user-edit/user-update.component.ts')
-rw-r--r-- | client/src/app/+admin/users/user-edit/user-update.component.ts | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/client/src/app/+admin/users/user-edit/user-update.component.ts b/client/src/app/+admin/users/user-edit/user-update.component.ts index 870880fee..55bc7290e 100644 --- a/client/src/app/+admin/users/user-edit/user-update.component.ts +++ b/client/src/app/+admin/users/user-edit/user-update.component.ts | |||
@@ -4,7 +4,6 @@ import { ActivatedRoute, Router } from '@angular/router' | |||
4 | import { ConfigService } from '@app/+admin/config/shared/config.service' | 4 | import { ConfigService } from '@app/+admin/config/shared/config.service' |
5 | import { AuthService, Notifier, ScreenService, ServerService, User, UserService } from '@app/core' | 5 | import { AuthService, Notifier, ScreenService, ServerService, User, UserService } from '@app/core' |
6 | import { FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' | 6 | import { FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
8 | import { User as UserType, UserAdminFlag, UserRole, UserUpdate } from '@shared/models' | 7 | import { User as UserType, UserAdminFlag, UserRole, UserUpdate } from '@shared/models' |
9 | import { UserEdit } from './user-edit' | 8 | import { UserEdit } from './user-edit' |
10 | 9 | ||
@@ -28,9 +27,8 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy { | |||
28 | private route: ActivatedRoute, | 27 | private route: ActivatedRoute, |
29 | private router: Router, | 28 | private router: Router, |
30 | private notifier: Notifier, | 29 | private notifier: Notifier, |
31 | private userService: UserService, | 30 | private userService: UserService |
32 | private i18n: I18n | 31 | ) { |
33 | ) { | ||
34 | super() | 32 | super() |
35 | 33 | ||
36 | this.buildQuotaOptions() | 34 | this.buildQuotaOptions() |
@@ -79,7 +77,7 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy { | |||
79 | 77 | ||
80 | this.userService.updateUser(this.user.id, userUpdate).subscribe( | 78 | this.userService.updateUser(this.user.id, userUpdate).subscribe( |
81 | () => { | 79 | () => { |
82 | this.notifier.success(this.i18n('User {{username}} updated.', { username: this.user.username })) | 80 | this.notifier.success($localize`User ${this.user.username} updated.`) |
83 | this.router.navigate([ '/admin/users/list' ]) | 81 | this.router.navigate([ '/admin/users/list' ]) |
84 | }, | 82 | }, |
85 | 83 | ||
@@ -96,15 +94,13 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy { | |||
96 | } | 94 | } |
97 | 95 | ||
98 | getFormButtonTitle () { | 96 | getFormButtonTitle () { |
99 | return this.i18n('Update user') | 97 | return $localize`Update user` |
100 | } | 98 | } |
101 | 99 | ||
102 | resetPassword () { | 100 | resetPassword () { |
103 | this.userService.askResetPassword(this.user.email).subscribe( | 101 | this.userService.askResetPassword(this.user.email).subscribe( |
104 | () => { | 102 | () => { |
105 | this.notifier.success( | 103 | this.notifier.success($localize`An email asking for password reset has been sent to ${this.user.username}.`) |
106 | this.i18n('An email asking for password reset has been sent to {{username}}.', { username: this.user.username }) | ||
107 | ) | ||
108 | }, | 104 | }, |
109 | 105 | ||
110 | err => this.error = err.message | 106 | err => this.error = err.message |