aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/signup/signup.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/signup/signup.component.ts')
-rw-r--r--client/src/app/signup/signup.component.ts31
1 files changed, 16 insertions, 15 deletions
diff --git a/client/src/app/signup/signup.component.ts b/client/src/app/signup/signup.component.ts
index a40f42cb1..55ebb573e 100644
--- a/client/src/app/signup/signup.component.ts
+++ b/client/src/app/signup/signup.component.ts
@@ -17,18 +17,6 @@ export class SignupComponent extends FormReactive implements OnInit {
17 error: string = null 17 error: string = null
18 quotaHelpIndication = '' 18 quotaHelpIndication = ''
19 19
20 private static getApproximateTime (seconds: number) {
21 const hours = Math.floor(seconds / 3600)
22 let pluralSuffix = ''
23 if (hours > 1) pluralSuffix = 's'
24 if (hours > 0) return `~ ${hours} hour${pluralSuffix}`
25
26 const minutes = Math.floor(seconds % 3600 / 60)
27 if (minutes > 1) pluralSuffix = 's'
28
29 return `~ ${minutes} minute${pluralSuffix}`
30 }
31
32 constructor ( 20 constructor (
33 protected formValidatorService: FormValidatorService, 21 protected formValidatorService: FormValidatorService,
34 private userValidatorsService: UserValidatorsService, 22 private userValidatorsService: UserValidatorsService,
@@ -75,6 +63,19 @@ export class SignupComponent extends FormReactive implements OnInit {
75 ) 63 )
76 } 64 }
77 65
66 private getApproximateTime (seconds: number) {
67 const hours = Math.floor(seconds / 3600)
68 let pluralSuffix = ''
69 if (hours > 1) pluralSuffix = 's'
70 if (hours > 0) return `~ ${hours} hour${pluralSuffix}`
71
72 const minutes = Math.floor(seconds % 3600 / 60)
73 if (minutes > 1) pluralSuffix = 's'
74
75 return this.i18n('~ {{minutes}} {minutes, plural, =1 {minute} other {minutes}}', { minutes })
76 }
77
78
78 private buildQuotaHelpIndication () { 79 private buildQuotaHelpIndication () {
79 if (this.initialUserVideoQuota === -1) return 80 if (this.initialUserVideoQuota === -1) return
80 81
@@ -88,9 +89,9 @@ export class SignupComponent extends FormReactive implements OnInit {
88 const normalSeconds = initialUserVideoQuotaBit / (1.5 * 1000 * 1000) 89 const normalSeconds = initialUserVideoQuotaBit / (1.5 * 1000 * 1000)
89 90
90 const lines = [ 91 const lines = [
91 this.i18n('{{seconds}} of full HD videos', { seconds: SignupComponent.getApproximateTime(fullHdSeconds) }), 92 this.i18n('{{seconds}} of full HD videos', { seconds: this.getApproximateTime(fullHdSeconds) }),
92 this.i18n('{{seconds}} of HD videos', { seconds: SignupComponent.getApproximateTime(hdSeconds) }), 93 this.i18n('{{seconds}} of HD videos', { seconds: this.getApproximateTime(hdSeconds) }),
93 this.i18n('{{seconds}} of average quality videos', { seconds: SignupComponent.getApproximateTime(normalSeconds) }) 94 this.i18n('{{seconds}} of average quality videos', { seconds: this.getApproximateTime(normalSeconds) })
94 ] 95 ]
95 96
96 this.quotaHelpIndication = lines.join('<br />') 97 this.quotaHelpIndication = lines.join('<br />')