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/core/users | |
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/core/users')
-rw-r--r-- | client/src/app/core/users/user.service.ts | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/client/src/app/core/users/user.service.ts b/client/src/app/core/users/user.service.ts index 6e7a48519..01c9be5bf 100644 --- a/client/src/app/core/users/user.service.ts +++ b/client/src/app/core/users/user.service.ts | |||
@@ -5,7 +5,6 @@ import { HttpClient, HttpParams } from '@angular/common/http' | |||
5 | import { Injectable } from '@angular/core' | 5 | import { Injectable } from '@angular/core' |
6 | import { AuthService } from '@app/core/auth' | 6 | import { AuthService } from '@app/core/auth' |
7 | import { BytesPipe } from '@app/shared/shared-main' | 7 | import { BytesPipe } from '@app/shared/shared-main' |
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
9 | import { UserLocalStorageKeys } from '@root-helpers/users' | 8 | import { UserLocalStorageKeys } from '@root-helpers/users' |
10 | import { | 9 | import { |
11 | Avatar, | 10 | Avatar, |
@@ -38,9 +37,8 @@ export class UserService { | |||
38 | private restExtractor: RestExtractor, | 37 | private restExtractor: RestExtractor, |
39 | private restService: RestService, | 38 | private restService: RestService, |
40 | private localStorageService: LocalStorageService, | 39 | private localStorageService: LocalStorageService, |
41 | private sessionStorageService: SessionStorageService, | 40 | private sessionStorageService: SessionStorageService |
42 | private i18n: I18n | 41 | ) { } |
43 | ) { } | ||
44 | 42 | ||
45 | changePassword (currentPassword: string, newPassword: string) { | 43 | changePassword (currentPassword: string, newPassword: string) { |
46 | const url = UserService.BASE_USERS_URL + 'me' | 44 | const url = UserService.BASE_USERS_URL + 'me' |
@@ -383,9 +381,9 @@ export class UserService { | |||
383 | } | 381 | } |
384 | 382 | ||
385 | const roleLabels: { [ id in UserRole ]: string } = { | 383 | const roleLabels: { [ id in UserRole ]: string } = { |
386 | [UserRole.USER]: this.i18n('User'), | 384 | [UserRole.USER]: $localize`User`, |
387 | [UserRole.ADMINISTRATOR]: this.i18n('Administrator'), | 385 | [UserRole.ADMINISTRATOR]: $localize`Administrator`, |
388 | [UserRole.MODERATOR]: this.i18n('Moderator') | 386 | [UserRole.MODERATOR]: $localize`Moderator` |
389 | } | 387 | } |
390 | 388 | ||
391 | return Object.assign(user, { | 389 | return Object.assign(user, { |