diff options
Diffstat (limited to 'client/src/app/shared/shared-video-miniature/video-download.component.ts')
-rw-r--r-- | client/src/app/shared/shared-video-miniature/video-download.component.ts | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/client/src/app/shared/shared-video-miniature/video-download.component.ts b/client/src/app/shared/shared-video-miniature/video-download.component.ts index e3d6a1969..99838f712 100644 --- a/client/src/app/shared/shared-video-miniature/video-download.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-download.component.ts | |||
@@ -2,7 +2,6 @@ import { mapValues, pick } from 'lodash-es' | |||
2 | import { Component, ElementRef, ViewChild } from '@angular/core' | 2 | import { Component, ElementRef, ViewChild } from '@angular/core' |
3 | import { AuthService, Notifier } from '@app/core' | 3 | import { AuthService, Notifier } from '@app/core' |
4 | import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap' | 4 | import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
6 | import { VideoCaption, VideoFile, VideoPrivacy } from '@shared/models' | 5 | import { VideoCaption, VideoFile, VideoPrivacy } from '@shared/models' |
7 | import { BytesPipe, NumberFormatterPipe, VideoDetails, VideoService } from '../shared-main' | 6 | import { BytesPipe, NumberFormatterPipe, VideoDetails, VideoService } from '../shared-main' |
8 | 7 | ||
@@ -38,8 +37,7 @@ export class VideoDownloadComponent { | |||
38 | private notifier: Notifier, | 37 | private notifier: Notifier, |
39 | private modalService: NgbModal, | 38 | private modalService: NgbModal, |
40 | private videoService: VideoService, | 39 | private videoService: VideoService, |
41 | private auth: AuthService, | 40 | private auth: AuthService |
42 | private i18n: I18n | ||
43 | ) { | 41 | ) { |
44 | this.bytesPipe = new BytesPipe() | 42 | this.bytesPipe = new BytesPipe() |
45 | this.numbersPipe = new NumberFormatterPipe() | 43 | this.numbersPipe = new NumberFormatterPipe() |
@@ -47,8 +45,8 @@ export class VideoDownloadComponent { | |||
47 | 45 | ||
48 | get typeText () { | 46 | get typeText () { |
49 | return this.type === 'video' | 47 | return this.type === 'video' |
50 | ? this.i18n('video') | 48 | ? $localize`video` |
51 | : this.i18n('subtitles') | 49 | : $localize`subtitles` |
52 | } | 50 | } |
53 | 51 | ||
54 | getVideoFiles () { | 52 | getVideoFiles () { |
@@ -135,7 +133,7 @@ export class VideoDownloadComponent { | |||
135 | } | 133 | } |
136 | 134 | ||
137 | activateCopiedMessage () { | 135 | activateCopiedMessage () { |
138 | this.notifier.success(this.i18n('Copied')) | 136 | this.notifier.success($localize`Copied`) |
139 | } | 137 | } |
140 | 138 | ||
141 | switchToType (type: DownloadType) { | 139 | switchToType (type: DownloadType) { |
@@ -144,11 +142,11 @@ export class VideoDownloadComponent { | |||
144 | 142 | ||
145 | getMetadataFormat (format: any) { | 143 | getMetadataFormat (format: any) { |
146 | const keyToTranslateFunction = { | 144 | const keyToTranslateFunction = { |
147 | 'encoder': (value: string) => ({ label: this.i18n('Encoder'), value }), | 145 | 'encoder': (value: string) => ({ label: $localize`Encoder`, value }), |
148 | 'format_long_name': (value: string) => ({ label: this.i18n('Format name'), value }), | 146 | 'format_long_name': (value: string) => ({ label: $localize`Format name`, value }), |
149 | 'size': (value: number) => ({ label: this.i18n('Size'), value: this.bytesPipe.transform(value, 2) }), | 147 | 'size': (value: number) => ({ label: $localize`Size`, value: this.bytesPipe.transform(value, 2) }), |
150 | 'bit_rate': (value: number) => ({ | 148 | 'bit_rate': (value: number) => ({ |
151 | label: this.i18n('Bitrate'), | 149 | label: $localize`Bitrate`, |
152 | value: `${this.numbersPipe.transform(value)}bps` | 150 | value: `${this.numbersPipe.transform(value)}bps` |
153 | }) | 151 | }) |
154 | } | 152 | } |
@@ -168,25 +166,25 @@ export class VideoDownloadComponent { | |||
168 | if (!stream) return undefined | 166 | if (!stream) return undefined |
169 | 167 | ||
170 | let keyToTranslateFunction = { | 168 | let keyToTranslateFunction = { |
171 | 'codec_long_name': (value: string) => ({ label: this.i18n('Codec'), value }), | 169 | 'codec_long_name': (value: string) => ({ label: $localize`Codec`, value }), |
172 | 'profile': (value: string) => ({ label: this.i18n('Profile'), value }), | 170 | 'profile': (value: string) => ({ label: $localize`Profile`, value }), |
173 | 'bit_rate': (value: number) => ({ | 171 | 'bit_rate': (value: number) => ({ |
174 | label: this.i18n('Bitrate'), | 172 | label: $localize`Bitrate`, |
175 | value: `${this.numbersPipe.transform(value)}bps` | 173 | value: `${this.numbersPipe.transform(value)}bps` |
176 | }) | 174 | }) |
177 | } | 175 | } |
178 | 176 | ||
179 | if (type === 'video') { | 177 | if (type === 'video') { |
180 | keyToTranslateFunction = Object.assign(keyToTranslateFunction, { | 178 | keyToTranslateFunction = Object.assign(keyToTranslateFunction, { |
181 | 'width': (value: number) => ({ label: this.i18n('Resolution'), value: `${value}x${stream.height}` }), | 179 | 'width': (value: number) => ({ label: $localize`Resolution`, value: `${value}x${stream.height}` }), |
182 | 'display_aspect_ratio': (value: string) => ({ label: this.i18n('Aspect ratio'), value }), | 180 | 'display_aspect_ratio': (value: string) => ({ label: $localize`Aspect ratio`, value }), |
183 | 'avg_frame_rate': (value: string) => ({ label: this.i18n('Average frame rate'), value }), | 181 | 'avg_frame_rate': (value: string) => ({ label: $localize`Average frame rate`, value }), |
184 | 'pix_fmt': (value: string) => ({ label: this.i18n('Pixel format'), value }) | 182 | 'pix_fmt': (value: string) => ({ label: $localize`Pixel format`, value }) |
185 | }) | 183 | }) |
186 | } else { | 184 | } else { |
187 | keyToTranslateFunction = Object.assign(keyToTranslateFunction, { | 185 | keyToTranslateFunction = Object.assign(keyToTranslateFunction, { |
188 | 'sample_rate': (value: number) => ({ label: this.i18n('Sample rate'), value }), | 186 | 'sample_rate': (value: number) => ({ label: $localize`Sample rate`, value }), |
189 | 'channel_layout': (value: number) => ({ label: this.i18n('Channel Layout'), value }) | 187 | 'channel_layout': (value: number) => ({ label: $localize`Channel Layout`, value }) |
190 | }) | 188 | }) |
191 | } | 189 | } |
192 | 190 | ||