aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-instance
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/shared/shared-instance
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/shared/shared-instance')
-rw-r--r--client/src/app/shared/shared-instance/instance-features-table.component.ts23
1 files changed, 10 insertions, 13 deletions
diff --git a/client/src/app/shared/shared-instance/instance-features-table.component.ts b/client/src/app/shared/shared-instance/instance-features-table.component.ts
index 8fd15ebad..76b595c20 100644
--- a/client/src/app/shared/shared-instance/instance-features-table.component.ts
+++ b/client/src/app/shared/shared-instance/instance-features-table.component.ts
@@ -1,6 +1,5 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2import { ServerService } from '@app/core' 2import { ServerService } from '@app/core'
3import { I18n } from '@ngx-translate/i18n-polyfill'
4import { ServerConfig } from '@shared/models' 3import { ServerConfig } from '@shared/models'
5 4
6@Component({ 5@Component({
@@ -12,11 +11,7 @@ export class InstanceFeaturesTableComponent implements OnInit {
12 quotaHelpIndication = '' 11 quotaHelpIndication = ''
13 serverConfig: ServerConfig 12 serverConfig: ServerConfig
14 13
15 constructor ( 14 constructor (private serverService: ServerService) { }
16 private i18n: I18n,
17 private serverService: ServerService
18 ) {
19 }
20 15
21 get initialUserVideoQuota () { 16 get initialUserVideoQuota () {
22 return this.serverConfig.user.videoQuota 17 return this.serverConfig.user.videoQuota
@@ -38,9 +33,9 @@ export class InstanceFeaturesTableComponent implements OnInit {
38 buildNSFWLabel () { 33 buildNSFWLabel () {
39 const policy = this.serverConfig.instance.defaultNSFWPolicy 34 const policy = this.serverConfig.instance.defaultNSFWPolicy
40 35
41 if (policy === 'do_not_list') return this.i18n('Hidden') 36 if (policy === 'do_not_list') return $localize`Hidden`
42 if (policy === 'blur') return this.i18n('Blurred with confirmation request') 37 if (policy === 'blur') return $localize`Blurred with confirmation request`
43 if (policy === 'display') return this.i18n('Displayed') 38 if (policy === 'display') return $localize`Displayed`
44 } 39 }
45 40
46 getServerVersionAndCommit () { 41 getServerVersionAndCommit () {
@@ -55,7 +50,9 @@ export class InstanceFeaturesTableComponent implements OnInit {
55 50
56 const minutes = Math.floor(seconds % 3600 / 60) 51 const minutes = Math.floor(seconds % 3600 / 60)
57 52
58 return this.i18n('~ {{minutes}} {minutes, plural, =1 {minute} other {minutes}}', { minutes }) 53 if (minutes === 1) return $localize`~ 1 minute`
54
55 return $localize`~ ${minutes} minutes`
59 } 56 }
60 57
61 private buildQuotaHelpIndication () { 58 private buildQuotaHelpIndication () {
@@ -71,9 +68,9 @@ export class InstanceFeaturesTableComponent implements OnInit {
71 const normalSeconds = initialUserVideoQuotaBit / (1.5 * 1000 * 1000) 68 const normalSeconds = initialUserVideoQuotaBit / (1.5 * 1000 * 1000)
72 69
73 const lines = [ 70 const lines = [
74 this.i18n('{{seconds}} of full HD videos', { seconds: this.getApproximateTime(fullHdSeconds) }), 71 $localize`${this.getApproximateTime(fullHdSeconds)} of full HD videos`,
75 this.i18n('{{seconds}} of HD videos', { seconds: this.getApproximateTime(hdSeconds) }), 72 $localize`${this.getApproximateTime(hdSeconds)} of HD videos`,
76 this.i18n('{{seconds}} of average quality videos', { seconds: this.getApproximateTime(normalSeconds) }) 73 $localize`${this.getApproximateTime(normalSeconds)} of average quality videos`
77 ] 74 ]
78 75
79 this.quotaHelpIndication = lines.join('<br />') 76 this.quotaHelpIndication = lines.join('<br />')