import { Component, OnInit } from '@angular/core'
import { ServerService } from '@app/core'
+import { prepareIcu } from '@app/helpers'
import { ServerConfig } from '@shared/models'
import { PeertubeModalService } from '../shared-main/peertube-modal/peertube-modal.service'
}
ngOnInit () {
- this.serverConfig = this.serverService.getTmpConfig()
this.serverService.getConfig()
.subscribe(config => {
this.serverConfig = config
private getApproximateTime (seconds: number) {
const hours = Math.floor(seconds / 3600)
- let pluralSuffix = ''
- if (hours > 1) pluralSuffix = 's'
- if (hours > 0) return `~ ${hours} hour${pluralSuffix}`
- const minutes = Math.floor(seconds % 3600 / 60)
+ if (hours !== 0) {
+ return prepareIcu($localize`~ {hours, plural, =1 {1 hour} other {{hours} hours}}`)(
+ { hours },
+ $localize`~ ${hours} hours`
+ )
+ }
- if (minutes === 1) return $localize`~ 1 minute`
+ const minutes = Math.floor(seconds % 3600 / 60)
- return $localize`~ ${minutes} minutes`
+ return prepareIcu($localize`~ {minutes, plural, =1 {1 minute} other {{minutes} minutes}}`)(
+ { minutes },
+ $localize`~ ${minutes} minutes`
+ )
}
private buildQuotaHelpIndication () {