1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-03 17:59:37 +02:00

Support ICU in TS components

This commit is contained in:
Chocobozzz 2022-05-24 16:29:01 +02:00
parent e435cf44c0
commit eaa529528c
No known key found for this signature in database
GPG key ID: 583A612D890159BE
29 changed files with 392 additions and 158 deletions

View file

@ -1,5 +1,6 @@
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'
@ -65,15 +66,20 @@ export class InstanceFeaturesTableComponent implements OnInit {
private getApproximateTime (seconds: number) {
const hours = Math.floor(seconds / 3600)
let pluralSuffix = ''
if (hours > 1) pluralSuffix = 's'
if (hours > 0) return `~ ${hours} hour${pluralSuffix}`
if (hours !== 0) {
return prepareIcu($localize`~ {hours, plural, =1 {1 hour} other {{hours} hours}}`)(
{ hours },
$localize`~ ${hours} hours`
)
}
const minutes = Math.floor(seconds % 3600 / 60)
if (minutes === 1) return $localize`~ 1 minute`
return $localize`~ ${minutes} minutes`
return prepareIcu($localize`~ {minutes, plural, =1 {1 minute} other {{minutes} minutes}}`)(
{ minutes },
$localize`~ ${minutes} minutes`
)
}
private buildQuotaHelpIndication () {