X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-main%2Fvideo%2Fvideo.model.ts;h=2e4ab87d75ce0f65ef1f441f63f6c659db70ad81;hb=83b1b7eaf1c04837f92de497e74895bee808eb83;hp=022bb95ad5020892e5d9cdcc7494fa8458a45e9b;hpb=384ba8b77a8e4805c099f5ea12b41c2ca5776e26;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts index 022bb95ad..2e4ab87d7 100644 --- a/client/src/app/shared/shared-main/video/video.model.ts +++ b/client/src/app/shared/shared-main/video/video.model.ts @@ -1,6 +1,6 @@ import { AuthUser } from '@app/core' import { User } from '@app/core/users/user.model' -import { durationToString, getAbsoluteAPIUrl, getAbsoluteEmbedUrl } from '@app/helpers' +import { durationToString, prepareIcu, getAbsoluteAPIUrl, getAbsoluteEmbedUrl } from '@app/helpers' import { Actor } from '@app/shared/shared-main/account/actor.model' import { buildVideoWatchPath } from '@shared/core-utils' import { peertubeTranslate } from '@shared/core-utils/i18n' @@ -19,6 +19,9 @@ import { } from '@shared/models' export class Video implements VideoServerModel { + private static readonly viewsICU = prepareIcu($localize`{views, plural, =0 {No view} =1 {1 view} other {{views} views}}`) + private static readonly viewersICU = prepareIcu($localize`{viewers, plural, =0 {No viewers} =1 {1 viewer} other {{viewers} viewers}}`) + byVideoChannel: string byAccount: string @@ -269,12 +272,10 @@ export class Video implements VideoServerModel { } getExactNumberOfViews () { - if (this.views < 1000) return '' - if (this.isLive) { - return $localize`${this.views} viewers` + return Video.viewersICU({ viewers: this.viewers }, $localize`${this.viewers} viewer(s)`) } - return $localize`${this.views} views` + return Video.viewsICU({ views: this.views }, $localize`{${this.views} view(s)}`) } }