diff options
Diffstat (limited to 'client/src/app/+videos/+video-watch/video-watch.component.ts')
-rw-r--r-- | client/src/app/+videos/+video-watch/video-watch.component.ts | 55 |
1 files changed, 25 insertions, 30 deletions
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts index a53af210a..fb89bf6cd 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts | |||
@@ -14,7 +14,6 @@ import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription' | |||
14 | import { VideoDownloadComponent } from '@app/shared/shared-video-miniature' | 14 | import { VideoDownloadComponent } from '@app/shared/shared-video-miniature' |
15 | import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' | 15 | import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' |
16 | import { MetaService } from '@ngx-meta/core' | 16 | import { MetaService } from '@ngx-meta/core' |
17 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
18 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' | 17 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' |
19 | import { ServerConfig, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '@shared/models' | 18 | import { ServerConfig, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '@shared/models' |
20 | import { getStoredP2PEnabled, getStoredTheater } from '../../../assets/player/peertube-player-local-storage' | 19 | import { getStoredP2PEnabled, getStoredTheater } from '../../../assets/player/peertube-player-local-storage' |
@@ -97,16 +96,15 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
97 | private zone: NgZone, | 96 | private zone: NgZone, |
98 | private redirectService: RedirectService, | 97 | private redirectService: RedirectService, |
99 | private videoCaptionService: VideoCaptionService, | 98 | private videoCaptionService: VideoCaptionService, |
100 | private i18n: I18n, | ||
101 | private hotkeysService: HotkeysService, | 99 | private hotkeysService: HotkeysService, |
102 | private hooks: HooksService, | 100 | private hooks: HooksService, |
103 | private location: PlatformLocation, | 101 | private location: PlatformLocation, |
104 | @Inject(LOCALE_ID) private localeId: string | 102 | @Inject(LOCALE_ID) private localeId: string |
105 | ) { | 103 | ) { |
106 | this.tooltipLike = this.i18n('Like this video') | 104 | this.tooltipLike = $localize`Like this video` |
107 | this.tooltipDislike = this.i18n('Dislike this video') | 105 | this.tooltipDislike = $localize`Dislike this video` |
108 | this.tooltipSupport = this.i18n('Support options for this video') | 106 | this.tooltipSupport = $localize`Support options for this video` |
109 | this.tooltipSaveToPlaylist = this.i18n('Save to playlist') | 107 | this.tooltipSaveToPlaylist = $localize`Save to playlist` |
110 | } | 108 | } |
111 | 109 | ||
112 | get user () { | 110 | get user () { |
@@ -188,7 +186,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
188 | getRatePopoverText () { | 186 | getRatePopoverText () { |
189 | if (this.isUserLoggedIn()) return undefined | 187 | if (this.isUserLoggedIn()) return undefined |
190 | 188 | ||
191 | return this.i18n('You need to be connected to rate this content.') | 189 | return $localize`You need to be connected to rate this content.` |
192 | } | 190 | } |
193 | 191 | ||
194 | showMoreDescription () { | 192 | showMoreDescription () { |
@@ -409,10 +407,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
409 | } | 407 | } |
410 | 408 | ||
411 | private setVideoLikesBarTooltipText () { | 409 | private setVideoLikesBarTooltipText () { |
412 | this.likesBarTooltipText = this.i18n('{{likesNumber}} likes / {{dislikesNumber}} dislikes', { | 410 | this.likesBarTooltipText = `${this.video.likes} likes / ${this.video.dislikes} dislikes` |
413 | likesNumber: this.video.likes, | ||
414 | dislikesNumber: this.video.dislikes | ||
415 | }) | ||
416 | } | 411 | } |
417 | 412 | ||
418 | private handleError (err: any) { | 413 | private handleError (err: any) { |
@@ -465,8 +460,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
465 | 460 | ||
466 | if (this.isVideoBlur(this.video)) { | 461 | if (this.isVideoBlur(this.video)) { |
467 | const res = await this.confirmService.confirm( | 462 | const res = await this.confirmService.confirm( |
468 | this.i18n('This video contains mature or explicit content. Are you sure you want to watch it?'), | 463 | $localize`This video contains mature or explicit content. Are you sure you want to watch it?`, |
469 | this.i18n('Mature or explicit content') | 464 | $localize`Mature or explicit content` |
470 | ) | 465 | ) |
471 | if (res === false) return this.location.back() | 466 | if (res === false) return this.location.back() |
472 | } | 467 | } |
@@ -515,9 +510,9 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
515 | */ | 510 | */ |
516 | this.player.upnext({ | 511 | this.player.upnext({ |
517 | timeout: 10000, // 10s | 512 | timeout: 10000, // 10s |
518 | headText: this.i18n('Up Next'), | 513 | headText: $localize`Up Next`, |
519 | cancelText: this.i18n('Cancel'), | 514 | cancelText: $localize`Cancel`, |
520 | suspendedText: this.i18n('Autoplay is suspended'), | 515 | suspendedText: $localize`Autoplay is suspended`, |
521 | getTitle: () => this.nextVideoTitle, | 516 | getTitle: () => this.nextVideoTitle, |
522 | next: () => this.zone.run(() => this.autoplayNext()), | 517 | next: () => this.zone.run(() => this.autoplayNext()), |
523 | condition: () => { | 518 | condition: () => { |
@@ -781,22 +776,22 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
781 | private initHotkeys () { | 776 | private initHotkeys () { |
782 | this.hotkeys = [ | 777 | this.hotkeys = [ |
783 | // These hotkeys are managed by the player | 778 | // These hotkeys are managed by the player |
784 | new Hotkey('f', e => e, undefined, this.i18n('Enter/exit fullscreen (requires player focus)')), | 779 | new Hotkey('f', e => e, undefined, $localize`Enter/exit fullscreen (requires player focus)`), |
785 | new Hotkey('space', e => e, undefined, this.i18n('Play/Pause the video (requires player focus)')), | 780 | new Hotkey('space', e => e, undefined, $localize`Play/Pause the video (requires player focus)`), |
786 | new Hotkey('m', e => e, undefined, this.i18n('Mute/unmute the video (requires player focus)')), | 781 | new Hotkey('m', e => e, undefined, $localize`Mute/unmute the video (requires player focus)`), |
787 | 782 | ||
788 | new Hotkey('0-9', e => e, undefined, this.i18n('Skip to a percentage of the video: 0 is 0% and 9 is 90% (requires player focus)')), | 783 | new Hotkey('0-9', e => e, undefined, $localize`Skip to a percentage of the video: 0 is 0% and 9 is 90% (requires player focus)`), |
789 | 784 | ||
790 | new Hotkey('up', e => e, undefined, this.i18n('Increase the volume (requires player focus)')), | 785 | new Hotkey('up', e => e, undefined, $localize`Increase the volume (requires player focus)`), |
791 | new Hotkey('down', e => e, undefined, this.i18n('Decrease the volume (requires player focus)')), | 786 | new Hotkey('down', e => e, undefined, $localize`Decrease the volume (requires player focus)`), |
792 | 787 | ||
793 | new Hotkey('right', e => e, undefined, this.i18n('Seek the video forward (requires player focus)')), | 788 | new Hotkey('right', e => e, undefined, $localize`Seek the video forward (requires player focus)`), |
794 | new Hotkey('left', e => e, undefined, this.i18n('Seek the video backward (requires player focus)')), | 789 | new Hotkey('left', e => e, undefined, $localize`Seek the video backward (requires player focus)`), |
795 | 790 | ||
796 | new Hotkey('>', e => e, undefined, this.i18n('Increase playback rate (requires player focus)')), | 791 | new Hotkey('>', e => e, undefined, $localize`Increase playback rate (requires player focus)`), |
797 | new Hotkey('<', e => e, undefined, this.i18n('Decrease playback rate (requires player focus)')), | 792 | new Hotkey('<', e => e, undefined, $localize`Decrease playback rate (requires player focus)`), |
798 | 793 | ||
799 | new Hotkey('.', e => e, undefined, this.i18n('Navigate in the video frame by frame (requires player focus)')) | 794 | new Hotkey('.', e => e, undefined, $localize`Navigate in the video frame by frame (requires player focus)`) |
800 | ] | 795 | ] |
801 | 796 | ||
802 | if (this.isUserLoggedIn()) { | 797 | if (this.isUserLoggedIn()) { |
@@ -804,17 +799,17 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
804 | new Hotkey('shift+l', () => { | 799 | new Hotkey('shift+l', () => { |
805 | this.setLike() | 800 | this.setLike() |
806 | return false | 801 | return false |
807 | }, undefined, this.i18n('Like the video')), | 802 | }, undefined, $localize`Like the video`), |
808 | 803 | ||
809 | new Hotkey('shift+d', () => { | 804 | new Hotkey('shift+d', () => { |
810 | this.setDislike() | 805 | this.setDislike() |
811 | return false | 806 | return false |
812 | }, undefined, this.i18n('Dislike the video')), | 807 | }, undefined, $localize`Dislike the video`), |
813 | 808 | ||
814 | new Hotkey('shift+s', () => { | 809 | new Hotkey('shift+s', () => { |
815 | this.subscribeButton.subscribed ? this.subscribeButton.unsubscribe() : this.subscribeButton.subscribe() | 810 | this.subscribeButton.subscribed ? this.subscribeButton.unsubscribe() : this.subscribeButton.subscribe() |
816 | return false | 811 | return false |
817 | }, undefined, this.i18n('Subscribe to the account')) | 812 | }, undefined, $localize`Subscribe to the account`) |
818 | ]) | 813 | ]) |
819 | } | 814 | } |
820 | 815 | ||