aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core/users/user.service.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-08-12 10:40:04 +0200
committerChocobozzz <me@florianbigard.com>2020-08-14 10:28:30 +0200
commit66357162f8e1227495f09bd4f68446aad7071c6d (patch)
tree7d4429506deb512b2fe1d0267f38a28cda20af55 /client/src/app/core/users/user.service.ts
parent8c360747995e17eb5520e22fc3d7bd4c3d26eeee (diff)
downloadPeerTube-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/user.service.ts')
-rw-r--r--client/src/app/core/users/user.service.ts12
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'
5import { Injectable } from '@angular/core' 5import { Injectable } from '@angular/core'
6import { AuthService } from '@app/core/auth' 6import { AuthService } from '@app/core/auth'
7import { BytesPipe } from '@app/shared/shared-main' 7import { BytesPipe } from '@app/shared/shared-main'
8import { I18n } from '@ngx-translate/i18n-polyfill'
9import { UserLocalStorageKeys } from '@root-helpers/users' 8import { UserLocalStorageKeys } from '@root-helpers/users'
10import { 9import {
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, {