diff options
author | Chocobozzz <me@florianbigard.com> | 2020-08-12 10:40:04 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-08-14 10:28:30 +0200 |
commit | 66357162f8e1227495f09bd4f68446aad7071c6d (patch) | |
tree | 7d4429506deb512b2fe1d0267f38a28cda20af55 /client/src/app/shared/shared-video-miniature | |
parent | 8c360747995e17eb5520e22fc3d7bd4c3d26eeee (diff) | |
download | PeerTube-66357162f8e1227495f09bd4f68446aad7071c6d.tar.gz PeerTube-66357162f8e1227495f09bd4f68446aad7071c6d.tar.zst PeerTube-66357162f8e1227495f09bd4f68446aad7071c6d.zip |
Migrate to $localize
* Remove i18n polyfill to translate things in components
* Reduce bundle sizes
* Improve runtime perf
* Reduce a lot the time to make a full client build
* Reduce client build complexity
* We don't need a service to translate things anymore (so we will be able to translate title pages etc)
Unfortunately we may loose some translations in the migration process.
I'll put a message on weblate to notify translators
Diffstat (limited to 'client/src/app/shared/shared-video-miniature')
5 files changed, 57 insertions, 65 deletions
diff --git a/client/src/app/shared/shared-video-miniature/abstract-video-list.ts b/client/src/app/shared/shared-video-miniature/abstract-video-list.ts index e18002b74..1b5b8a64b 100644 --- a/client/src/app/shared/shared-video-miniature/abstract-video-list.ts +++ b/client/src/app/shared/shared-video-miniature/abstract-video-list.ts | |||
@@ -14,7 +14,6 @@ import { | |||
14 | } from '@app/core' | 14 | } from '@app/core' |
15 | import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook' | 15 | import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook' |
16 | import { GlobalIconName } from '@app/shared/shared-icons' | 16 | import { GlobalIconName } from '@app/shared/shared-icons' |
17 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
18 | import { isLastMonth, isLastWeek, isToday, isYesterday } from '@shared/core-utils/miscs/date' | 17 | import { isLastMonth, isLastWeek, isToday, isYesterday } from '@shared/core-utils/miscs/date' |
19 | import { ServerConfig, VideoSortField } from '@shared/models' | 18 | import { ServerConfig, VideoSortField } from '@shared/models' |
20 | import { NSFWPolicyType } from '@shared/models/videos/nsfw-policy.type' | 19 | import { NSFWPolicyType } from '@shared/models/videos/nsfw-policy.type' |
@@ -89,7 +88,6 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor | |||
89 | protected abstract screenService: ScreenService | 88 | protected abstract screenService: ScreenService |
90 | protected abstract storageService: LocalStorageService | 89 | protected abstract storageService: LocalStorageService |
91 | protected abstract router: Router | 90 | protected abstract router: Router |
92 | protected abstract i18n: I18n | ||
93 | abstract titlePage: string | 91 | abstract titlePage: string |
94 | 92 | ||
95 | private resizeSubscription: Subscription | 93 | private resizeSubscription: Subscription |
@@ -111,11 +109,11 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor | |||
111 | 109 | ||
112 | this.groupedDateLabels = { | 110 | this.groupedDateLabels = { |
113 | [GroupDate.UNKNOWN]: null, | 111 | [GroupDate.UNKNOWN]: null, |
114 | [GroupDate.TODAY]: this.i18n('Today'), | 112 | [GroupDate.TODAY]: $localize`Today`, |
115 | [GroupDate.YESTERDAY]: this.i18n('Yesterday'), | 113 | [GroupDate.YESTERDAY]: $localize`Yesterday`, |
116 | [GroupDate.LAST_WEEK]: this.i18n('Last week'), | 114 | [GroupDate.LAST_WEEK]: $localize`Last week`, |
117 | [GroupDate.LAST_MONTH]: this.i18n('Last month'), | 115 | [GroupDate.LAST_MONTH]: $localize`Last month`, |
118 | [GroupDate.OLDER]: this.i18n('Older') | 116 | [GroupDate.OLDER]: $localize`Older` |
119 | } | 117 | } |
120 | 118 | ||
121 | // Subscribe to route changes | 119 | // Subscribe to route changes |
@@ -192,7 +190,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor | |||
192 | }, | 190 | }, |
193 | 191 | ||
194 | error => { | 192 | error => { |
195 | const message = this.i18n('Cannot load more videos. Try again later.') | 193 | const message = $localize`Cannot load more videos. Try again later.` |
196 | 194 | ||
197 | console.error(message, { error }) | 195 | console.error(message, { error }) |
198 | this.notifier.error(message) | 196 | this.notifier.error(message) |
diff --git a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts index 3d1fc8690..39358e08b 100644 --- a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts | |||
@@ -1,10 +1,18 @@ | |||
1 | import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core' | 1 | import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core' |
2 | import { AuthService, ConfirmService, Notifier, ScreenService } from '@app/core' | 2 | import { AuthService, ConfirmService, Notifier, ScreenService } from '@app/core' |
3 | import { VideoBlockComponent, VideoBlockService, VideoReportComponent, BlocklistService } from '@app/shared/shared-moderation' | 3 | import { BlocklistService, VideoBlockComponent, VideoBlockService, VideoReportComponent } from '@app/shared/shared-moderation' |
4 | import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' | 4 | import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
6 | import { VideoCaption } from '@shared/models' | 5 | import { VideoCaption } from '@shared/models' |
7 | import { DropdownAction, DropdownButtonSize, DropdownDirection, RedundancyService, Video, VideoDetails, VideoService, Actor } from '../shared-main' | 6 | import { |
7 | Actor, | ||
8 | DropdownAction, | ||
9 | DropdownButtonSize, | ||
10 | DropdownDirection, | ||
11 | RedundancyService, | ||
12 | Video, | ||
13 | VideoDetails, | ||
14 | VideoService | ||
15 | } from '../shared-main' | ||
8 | import { VideoAddToPlaylistComponent } from '../shared-video-playlist' | 16 | import { VideoAddToPlaylistComponent } from '../shared-video-playlist' |
9 | import { VideoDownloadComponent } from './video-download.component' | 17 | import { VideoDownloadComponent } from './video-download.component' |
10 | 18 | ||
@@ -71,8 +79,7 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
71 | private videoBlocklistService: VideoBlockService, | 79 | private videoBlocklistService: VideoBlockService, |
72 | private screenService: ScreenService, | 80 | private screenService: ScreenService, |
73 | private videoService: VideoService, | 81 | private videoService: VideoService, |
74 | private redundancyService: RedundancyService, | 82 | private redundancyService: RedundancyService |
75 | private i18n: I18n | ||
76 | ) { } | 83 | ) { } |
77 | 84 | ||
78 | get user () { | 85 | get user () { |
@@ -153,17 +160,15 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
153 | /* Action handlers */ | 160 | /* Action handlers */ |
154 | 161 | ||
155 | async unblockVideo () { | 162 | async unblockVideo () { |
156 | const confirmMessage = this.i18n( | 163 | const confirmMessage = $localize`Do you really want to unblock this video? It will be available again in the videos list.` |
157 | 'Do you really want to unblock this video? It will be available again in the videos list.' | ||
158 | ) | ||
159 | 164 | ||
160 | const res = await this.confirmService.confirm(confirmMessage, this.i18n('Unblock')) | 165 | const res = await this.confirmService.confirm(confirmMessage, $localize`Unblock`) |
161 | if (res === false) return | 166 | if (res === false) return |
162 | 167 | ||
163 | this.videoBlocklistService.unblockVideo(this.video.id) | 168 | this.videoBlocklistService.unblockVideo(this.video.id) |
164 | .subscribe( | 169 | .subscribe( |
165 | () => { | 170 | () => { |
166 | this.notifier.success(this.i18n('Video {{name}} unblocked.', { name: this.video.name })) | 171 | this.notifier.success($localize`Video ${this.video.name} unblocked.`) |
167 | 172 | ||
168 | this.video.blacklisted = false | 173 | this.video.blacklisted = false |
169 | this.video.blockedReason = null | 174 | this.video.blockedReason = null |
@@ -178,14 +183,13 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
178 | async removeVideo () { | 183 | async removeVideo () { |
179 | this.modalOpened.emit() | 184 | this.modalOpened.emit() |
180 | 185 | ||
181 | const res = await this.confirmService.confirm(this.i18n('Do you really want to delete this video?'), this.i18n('Delete')) | 186 | const res = await this.confirmService.confirm($localize`Do you really want to delete this video?`, $localize`Delete`) |
182 | if (res === false) return | 187 | if (res === false) return |
183 | 188 | ||
184 | this.videoService.removeVideo(this.video.id) | 189 | this.videoService.removeVideo(this.video.id) |
185 | .subscribe( | 190 | .subscribe( |
186 | () => { | 191 | () => { |
187 | this.notifier.success(this.i18n('Video {{videoName}} deleted.', { videoName: this.video.name })) | 192 | this.notifier.success($localize`Video ${this.video.name} deleted.`) |
188 | |||
189 | this.videoRemoved.emit() | 193 | this.videoRemoved.emit() |
190 | }, | 194 | }, |
191 | 195 | ||
@@ -197,7 +201,7 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
197 | this.redundancyService.addVideoRedundancy(this.video) | 201 | this.redundancyService.addVideoRedundancy(this.video) |
198 | .subscribe( | 202 | .subscribe( |
199 | () => { | 203 | () => { |
200 | const message = this.i18n('This video will be duplicated by your instance.') | 204 | const message = $localize`This video will be duplicated by your instance.` |
201 | this.notifier.success(message) | 205 | this.notifier.success(message) |
202 | }, | 206 | }, |
203 | 207 | ||
@@ -211,8 +215,7 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
211 | this.blocklistService.blockAccountByUser(params) | 215 | this.blocklistService.blockAccountByUser(params) |
212 | .subscribe( | 216 | .subscribe( |
213 | () => { | 217 | () => { |
214 | this.notifier.success(this.i18n('Account {{nameWithHost}} muted.', params)) | 218 | this.notifier.success($localize`Account ${params.nameWithHost} muted.`) |
215 | |||
216 | this.videoAccountMuted.emit() | 219 | this.videoAccountMuted.emit() |
217 | }, | 220 | }, |
218 | 221 | ||
@@ -236,7 +239,7 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
236 | this.videoActions = [ | 239 | this.videoActions = [ |
237 | [ | 240 | [ |
238 | { | 241 | { |
239 | label: this.i18n('Save to playlist'), | 242 | label: $localize`Save to playlist`, |
240 | handler: () => this.playlistDropdown.toggle(), | 243 | handler: () => this.playlistDropdown.toggle(), |
241 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.playlist, | 244 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.playlist, |
242 | iconName: 'playlist-add' | 245 | iconName: 'playlist-add' |
@@ -244,43 +247,43 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
244 | ], | 247 | ], |
245 | [ // actions regarding the video | 248 | [ // actions regarding the video |
246 | { | 249 | { |
247 | label: this.i18n('Download'), | 250 | label: $localize`Download`, |
248 | handler: () => this.showDownloadModal(), | 251 | handler: () => this.showDownloadModal(), |
249 | isDisplayed: () => this.displayOptions.download && this.isVideoDownloadable(), | 252 | isDisplayed: () => this.displayOptions.download && this.isVideoDownloadable(), |
250 | iconName: 'download' | 253 | iconName: 'download' |
251 | }, | 254 | }, |
252 | { | 255 | { |
253 | label: this.i18n('Update'), | 256 | label: $localize`Update`, |
254 | linkBuilder: ({ video }) => [ '/videos/update', video.uuid ], | 257 | linkBuilder: ({ video }) => [ '/videos/update', video.uuid ], |
255 | iconName: 'edit', | 258 | iconName: 'edit', |
256 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.update && this.isVideoUpdatable() | 259 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.update && this.isVideoUpdatable() |
257 | }, | 260 | }, |
258 | { | 261 | { |
259 | label: this.i18n('Block'), | 262 | label: $localize`Block`, |
260 | handler: () => this.showBlockModal(), | 263 | handler: () => this.showBlockModal(), |
261 | iconName: 'no', | 264 | iconName: 'no', |
262 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.blacklist && this.isVideoBlockable() | 265 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.blacklist && this.isVideoBlockable() |
263 | }, | 266 | }, |
264 | { | 267 | { |
265 | label: this.i18n('Unblock'), | 268 | label: $localize`Unblock`, |
266 | handler: () => this.unblockVideo(), | 269 | handler: () => this.unblockVideo(), |
267 | iconName: 'undo', | 270 | iconName: 'undo', |
268 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.blacklist && this.isVideoUnblockable() | 271 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.blacklist && this.isVideoUnblockable() |
269 | }, | 272 | }, |
270 | { | 273 | { |
271 | label: this.i18n('Mirror'), | 274 | label: $localize`Mirror`, |
272 | handler: () => this.duplicateVideo(), | 275 | handler: () => this.duplicateVideo(), |
273 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.duplicate && this.canVideoBeDuplicated(), | 276 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.duplicate && this.canVideoBeDuplicated(), |
274 | iconName: 'cloud-download' | 277 | iconName: 'cloud-download' |
275 | }, | 278 | }, |
276 | { | 279 | { |
277 | label: this.i18n('Delete'), | 280 | label: $localize`Delete`, |
278 | handler: () => this.removeVideo(), | 281 | handler: () => this.removeVideo(), |
279 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.delete && this.isVideoRemovable(), | 282 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.delete && this.isVideoRemovable(), |
280 | iconName: 'delete' | 283 | iconName: 'delete' |
281 | }, | 284 | }, |
282 | { | 285 | { |
283 | label: this.i18n('Report'), | 286 | label: $localize`Report`, |
284 | handler: () => this.showReportModal(), | 287 | handler: () => this.showReportModal(), |
285 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.report, | 288 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.report, |
286 | iconName: 'flag' | 289 | iconName: 'flag' |
@@ -288,7 +291,7 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
288 | ], | 291 | ], |
289 | [ // actions regarding the account/its server | 292 | [ // actions regarding the account/its server |
290 | { | 293 | { |
291 | label: this.i18n('Mute account'), | 294 | label: $localize`Mute account`, |
292 | handler: () => this.muteVideoAccount(), | 295 | handler: () => this.muteVideoAccount(), |
293 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.mute && this.isVideoAccountMutable(), | 296 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.mute && this.isVideoAccountMutable(), |
294 | iconName: 'no' | 297 | iconName: 'no' |
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 | ||
diff --git a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts index 3c7046de5..cc5665ab1 100644 --- a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts | |||
@@ -11,7 +11,6 @@ import { | |||
11 | Output | 11 | Output |
12 | } from '@angular/core' | 12 | } from '@angular/core' |
13 | import { AuthService, ScreenService, ServerService, User } from '@app/core' | 13 | import { AuthService, ScreenService, ServerService, User } from '@app/core' |
14 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
15 | import { ServerConfig, VideoPlaylistType, VideoPrivacy, VideoState } from '@shared/models' | 14 | import { ServerConfig, VideoPlaylistType, VideoPrivacy, VideoState } from '@shared/models' |
16 | import { Video } from '../shared-main' | 15 | import { Video } from '../shared-main' |
17 | import { VideoPlaylistService } from '../shared-video-playlist' | 16 | import { VideoPlaylistService } from '../shared-video-playlist' |
@@ -95,7 +94,6 @@ export class VideoMiniatureComponent implements OnInit { | |||
95 | constructor ( | 94 | constructor ( |
96 | private screenService: ScreenService, | 95 | private screenService: ScreenService, |
97 | private serverService: ServerService, | 96 | private serverService: ServerService, |
98 | private i18n: I18n, | ||
99 | private authService: AuthService, | 97 | private authService: AuthService, |
100 | private videoPlaylistService: VideoPlaylistService, | 98 | private videoPlaylistService: VideoPlaylistService, |
101 | private cd: ChangeDetectorRef, | 99 | private cd: ChangeDetectorRef, |
@@ -116,10 +114,7 @@ export class VideoMiniatureComponent implements OnInit { | |||
116 | 114 | ||
117 | this.setUpBy() | 115 | this.setUpBy() |
118 | 116 | ||
119 | this.channelLinkTitle = this.i18n( | 117 | this.channelLinkTitle = $localize`${this.video.channel.name} (channel page)` |
120 | '{{name}} (channel page)', | ||
121 | { name: this.video.channel.name, handle: this.video.byVideoChannel } | ||
122 | ) | ||
123 | 118 | ||
124 | // We rely on mouseenter to lazy load actions | 119 | // We rely on mouseenter to lazy load actions |
125 | if (this.screenService.isInTouchScreen()) { | 120 | if (this.screenService.isInTouchScreen()) { |
@@ -164,24 +159,24 @@ export class VideoMiniatureComponent implements OnInit { | |||
164 | if (!video.state) return '' | 159 | if (!video.state) return '' |
165 | 160 | ||
166 | if (video.privacy.id !== VideoPrivacy.PRIVATE && video.state.id === VideoState.PUBLISHED) { | 161 | if (video.privacy.id !== VideoPrivacy.PRIVATE && video.state.id === VideoState.PUBLISHED) { |
167 | return this.i18n('Published') | 162 | return $localize`Published` |
168 | } | 163 | } |
169 | 164 | ||
170 | if (video.scheduledUpdate) { | 165 | if (video.scheduledUpdate) { |
171 | const updateAt = new Date(video.scheduledUpdate.updateAt.toString()).toLocaleString(this.localeId) | 166 | const updateAt = new Date(video.scheduledUpdate.updateAt.toString()).toLocaleString(this.localeId) |
172 | return this.i18n('Publication scheduled on ') + updateAt | 167 | return $localize`Publication scheduled on ` + updateAt |
173 | } | 168 | } |
174 | 169 | ||
175 | if (video.state.id === VideoState.TO_TRANSCODE && video.waitTranscoding === true) { | 170 | if (video.state.id === VideoState.TO_TRANSCODE && video.waitTranscoding === true) { |
176 | return this.i18n('Waiting transcoding') | 171 | return $localize`Waiting transcoding` |
177 | } | 172 | } |
178 | 173 | ||
179 | if (video.state.id === VideoState.TO_TRANSCODE) { | 174 | if (video.state.id === VideoState.TO_TRANSCODE) { |
180 | return this.i18n('To transcode') | 175 | return $localize`To transcode` |
181 | } | 176 | } |
182 | 177 | ||
183 | if (video.state.id === VideoState.TO_IMPORT) { | 178 | if (video.state.id === VideoState.TO_IMPORT) { |
184 | return this.i18n('To import') | 179 | return $localize`To import` |
185 | } | 180 | } |
186 | 181 | ||
187 | return '' | 182 | return '' |
diff --git a/client/src/app/shared/shared-video-miniature/videos-selection.component.ts b/client/src/app/shared/shared-video-miniature/videos-selection.component.ts index 3e0e3b983..2b060b130 100644 --- a/client/src/app/shared/shared-video-miniature/videos-selection.component.ts +++ b/client/src/app/shared/shared-video-miniature/videos-selection.component.ts | |||
@@ -13,7 +13,6 @@ import { | |||
13 | } from '@angular/core' | 13 | } from '@angular/core' |
14 | import { ActivatedRoute, Router } from '@angular/router' | 14 | import { ActivatedRoute, Router } from '@angular/router' |
15 | import { AuthService, ComponentPagination, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' | 15 | import { AuthService, ComponentPagination, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' |
16 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
17 | import { ResultList, VideoSortField } from '@shared/models' | 16 | import { ResultList, VideoSortField } from '@shared/models' |
18 | import { PeerTubeTemplateDirective, Video } from '../shared-main' | 17 | import { PeerTubeTemplateDirective, Video } from '../shared-main' |
19 | import { AbstractVideoList } from './abstract-video-list' | 18 | import { AbstractVideoList } from './abstract-video-list' |
@@ -45,7 +44,6 @@ export class VideosSelectionComponent extends AbstractVideoList implements OnIni | |||
45 | globalButtonsTemplate: TemplateRef<any> | 44 | globalButtonsTemplate: TemplateRef<any> |
46 | 45 | ||
47 | constructor ( | 46 | constructor ( |
48 | protected i18n: I18n, | ||
49 | protected router: Router, | 47 | protected router: Router, |
50 | protected route: ActivatedRoute, | 48 | protected route: ActivatedRoute, |
51 | protected notifier: Notifier, | 49 | protected notifier: Notifier, |