aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/config
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/+admin/config
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/+admin/config')
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts24
-rw-r--r--client/src/app/+admin/config/shared/config.service.ts38
2 files changed, 29 insertions, 33 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
index 00a0bfad2..3a60b144f 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
+++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
@@ -12,7 +12,6 @@ import {
12 UserValidatorsService 12 UserValidatorsService
13} from '@app/shared/shared-forms' 13} from '@app/shared/shared-forms'
14import { NgbNav } from '@ng-bootstrap/ng-bootstrap' 14import { NgbNav } from '@ng-bootstrap/ng-bootstrap'
15import { I18n } from '@ngx-translate/i18n-polyfill'
16import { CustomConfig, ServerConfig } from '@shared/models' 15import { CustomConfig, ServerConfig } from '@shared/models'
17 16
18@Component({ 17@Component({
@@ -42,45 +41,44 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
42 private userValidatorsService: UserValidatorsService, 41 private userValidatorsService: UserValidatorsService,
43 private notifier: Notifier, 42 private notifier: Notifier,
44 private configService: ConfigService, 43 private configService: ConfigService,
45 private serverService: ServerService, 44 private serverService: ServerService
46 private i18n: I18n
47 ) { 45 ) {
48 super() 46 super()
49 47
50 this.resolutions = [ 48 this.resolutions = [
51 { 49 {
52 id: '0p', 50 id: '0p',
53 label: this.i18n('Audio-only'), 51 label: $localize`Audio-only`,
54 description: this.i18n('A <code>.mp4</code> that keeps the original audio track, with no video') 52 description: $localize`A <code>.mp4</code> that keeps the original audio track, with no video`
55 }, 53 },
56 { 54 {
57 id: '240p', 55 id: '240p',
58 label: this.i18n('240p') 56 label: $localize`240p`
59 }, 57 },
60 { 58 {
61 id: '360p', 59 id: '360p',
62 label: this.i18n('360p') 60 label: $localize`360p`
63 }, 61 },
64 { 62 {
65 id: '480p', 63 id: '480p',
66 label: this.i18n('480p') 64 label: $localize`480p`
67 }, 65 },
68 { 66 {
69 id: '720p', 67 id: '720p',
70 label: this.i18n('720p') 68 label: $localize`720p`
71 }, 69 },
72 { 70 {
73 id: '1080p', 71 id: '1080p',
74 label: this.i18n('1080p') 72 label: $localize`1080p`
75 }, 73 },
76 { 74 {
77 id: '2160p', 75 id: '2160p',
78 label: this.i18n('2160p') 76 label: $localize`2160p`
79 } 77 }
80 ] 78 ]
81 79
82 this.transcodingThreadOptions = [ 80 this.transcodingThreadOptions = [
83 { value: 0, label: this.i18n('Auto (via ffmpeg)') }, 81 { value: 0, label: $localize`Auto (via ffmpeg)` },
84 { value: 1, label: '1' }, 82 { value: 1, label: '1' },
85 { value: 2, label: '2' }, 83 { value: 2, label: '2' },
86 { value: 4, label: '4' }, 84 { value: 4, label: '4' },
@@ -288,7 +286,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
288 286
289 this.updateForm() 287 this.updateForm()
290 288
291 this.notifier.success(this.i18n('Configuration updated.')) 289 this.notifier.success($localize`Configuration updated.`)
292 }, 290 },
293 291
294 err => this.notifier.error(err.message) 292 err => this.notifier.error(err.message)
diff --git a/client/src/app/+admin/config/shared/config.service.ts b/client/src/app/+admin/config/shared/config.service.ts
index f182946b8..5f98aa545 100644
--- a/client/src/app/+admin/config/shared/config.service.ts
+++ b/client/src/app/+admin/config/shared/config.service.ts
@@ -2,7 +2,6 @@ import { catchError } from 'rxjs/operators'
2import { HttpClient } from '@angular/common/http' 2import { HttpClient } from '@angular/common/http'
3import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
4import { RestExtractor } from '@app/core' 4import { RestExtractor } from '@app/core'
5import { I18n } from '@ngx-translate/i18n-polyfill'
6import { CustomConfig } from '@shared/models' 5import { CustomConfig } from '@shared/models'
7import { environment } from '../../../../environments/environment' 6import { environment } from '../../../../environments/environment'
8 7
@@ -15,33 +14,32 @@ export class ConfigService {
15 14
16 constructor ( 15 constructor (
17 private authHttp: HttpClient, 16 private authHttp: HttpClient,
18 private restExtractor: RestExtractor, 17 private restExtractor: RestExtractor
19 private i18n: I18n 18 ) {
20 ) {
21 this.videoQuotaOptions = [ 19 this.videoQuotaOptions = [
22 { value: undefined, label: 'Default quota', disabled: true }, 20 { value: undefined, label: 'Default quota', disabled: true },
23 { value: -1, label: this.i18n('Unlimited') }, 21 { value: -1, label: $localize`Unlimited` },
24 { value: undefined, label: '─────', disabled: true }, 22 { value: undefined, label: '─────', disabled: true },
25 { value: 0, label: this.i18n('None - no upload possible') }, 23 { value: 0, label: $localize`None - no upload possible` },
26 { value: 100 * 1024 * 1024, label: this.i18n('100MB') }, 24 { value: 100 * 1024 * 1024, label: $localize`100MB` },
27 { value: 500 * 1024 * 1024, label: this.i18n('500MB') }, 25 { value: 500 * 1024 * 1024, label: $localize`500MB` },
28 { value: 1024 * 1024 * 1024, label: this.i18n('1GB') }, 26 { value: 1024 * 1024 * 1024, label: $localize`1GB` },
29 { value: 5 * 1024 * 1024 * 1024, label: this.i18n('5GB') }, 27 { value: 5 * 1024 * 1024 * 1024, label: $localize`5GB` },
30 { value: 20 * 1024 * 1024 * 1024, label: this.i18n('20GB') }, 28 { value: 20 * 1024 * 1024 * 1024, label: $localize`20GB` },
31 { value: 50 * 1024 * 1024 * 1024, label: this.i18n('50GB') } 29 { value: 50 * 1024 * 1024 * 1024, label: $localize`50GB` }
32 ] 30 ]
33 31
34 this.videoQuotaDailyOptions = [ 32 this.videoQuotaDailyOptions = [
35 { value: undefined, label: 'Default daily upload limit', disabled: true }, 33 { value: undefined, label: 'Default daily upload limit', disabled: true },
36 { value: -1, label: this.i18n('Unlimited') }, 34 { value: -1, label: $localize`Unlimited` },
37 { value: undefined, label: '─────', disabled: true }, 35 { value: undefined, label: '─────', disabled: true },
38 { value: 0, label: this.i18n('None - no upload possible') }, 36 { value: 0, label: $localize`None - no upload possible` },
39 { value: 10 * 1024 * 1024, label: this.i18n('10MB') }, 37 { value: 10 * 1024 * 1024, label: $localize`10MB` },
40 { value: 50 * 1024 * 1024, label: this.i18n('50MB') }, 38 { value: 50 * 1024 * 1024, label: $localize`50MB` },
41 { value: 100 * 1024 * 1024, label: this.i18n('100MB') }, 39 { value: 100 * 1024 * 1024, label: $localize`100MB` },
42 { value: 500 * 1024 * 1024, label: this.i18n('500MB') }, 40 { value: 500 * 1024 * 1024, label: $localize`500MB` },
43 { value: 2 * 1024 * 1024 * 1024, label: this.i18n('2GB') }, 41 { value: 2 * 1024 * 1024 * 1024, label: $localize`2GB` },
44 { value: 5 * 1024 * 1024 * 1024, label: this.i18n('5GB') } 42 { value: 5 * 1024 * 1024 * 1024, label: $localize`5GB` }
45 ] 43 ]
46 } 44 }
47 45