import { Component, OnInit, ViewChild } from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router'
import { AuthService, ConfirmService, Notifier, RestPagination, RestTable } from '@app/core'
+import { prepareIcu } from '@app/helpers'
import { AdvancedInputFilter } from '@app/shared/shared-forms'
import { DropdownAction, Video, VideoService } from '@app/shared/shared-main'
import { VideoBlockComponent, VideoBlockService } from '@app/shared/shared-moderation'
}
private async removeVideos (videos: Video[]) {
- const message = $localize`Are you sure you want to delete these ${videos.length} videos?`
+ const message = prepareIcu($localize`Are you sure you want to delete {count, plural, =1 {this video} other {these {count} videos}}?`)(
+ { count: videos.length },
+ $localize`Are you sure you want to delete these ${videos.length} videos?`
+ )
+
const res = await this.confirmService.confirm(message, $localize`Delete`)
if (res === false) return
this.videoService.removeVideo(videos.map(v => v.id))
.subscribe({
next: () => {
- this.notifier.success($localize`Deleted ${videos.length} videos.`)
+ this.notifier.success(
+ prepareIcu($localize`Deleted {count, plural, =1 {1 video} other {{count} videos}}.`)(
+ { count: videos.length },
+ $localize`Deleted ${videos.length} videos.`
+ )
+ )
+
this.reloadData()
},
this.videoBlockService.unblockVideo(videos.map(v => v.id))
.subscribe({
next: () => {
- this.notifier.success($localize`Unblocked ${videos.length} videos.`)
+ this.notifier.success(
+ prepareIcu($localize`Unblocked {count, plural, =1 {1 video} other {{count} videos}}.`)(
+ { count: videos.length },
+ $localize`Unblocked ${videos.length} videos.`
+ )
+ )
+
this.reloadData()
},
}
private async removeVideoFiles (videos: Video[], type: 'hls' | 'webtorrent') {
- const message = type === 'hls'
- ? $localize`Are you sure you want to delete ${videos.length} HLS streaming playlists?`
- : $localize`Are you sure you want to delete WebTorrent files of ${videos.length} videos?`
+ let message: string
+
+ if (type === 'hls') {
+ // eslint-disable-next-line max-len
+ message = prepareIcu($localize`Are you sure you want to delete {count, plural, =1 {1 HLS streaming playlist} other {{count} HLS streaming playlists}}?`)(
+ { count: videos.length },
+ $localize`Are you sure you want to delete ${videos.length} HLS streaming playlists?`
+ )
+ } else {
+ // eslint-disable-next-line max-len
+ message = prepareIcu($localize`Are you sure you want to delete WebTorrent files of {count, plural, =1 {1 video} other {{count} videos}}?`)(
+ { count: videos.length },
+ $localize`Are you sure you want to delete WebTorrent files of ${videos.length} videos?`
+ )
+ }
const res = await this.confirmService.confirm(message, $localize`Delete`)
if (res === false) return