From 95d5113575ffe7872861352fec0adc35bbd8754d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 16 Aug 2018 11:11:20 +0200 Subject: [PATCH] Translate player according to the interface lang --- client/src/app/videos/+video-watch/video-watch.component.ts | 3 ++- client/src/assets/player/peertube-player.ts | 5 +++++ scripts/build/client.sh | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) 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 5fba1b12d..0909b13f5 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts @@ -407,7 +407,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy { peertubeLink: false, poster: this.video.previewUrl, startTime, - theaterMode: true + theaterMode: true, + language: this.localeId }) if (this.videojsLocaleLoaded === false) { diff --git a/client/src/assets/player/peertube-player.ts b/client/src/assets/player/peertube-player.ts index 1b1ec7a68..0b9303a73 100644 --- a/client/src/assets/player/peertube-player.ts +++ b/client/src/assets/player/peertube-player.ts @@ -35,6 +35,7 @@ function getVideojsOptions (options: { startTime: number | string theaterMode: boolean, videoCaptions: VideoJSCaption[], + language?: string, controls?: boolean, muted?: boolean, loop?: boolean @@ -74,6 +75,10 @@ function getVideojsOptions (options: { }) } + if (options.language && !isDefaultLocale(options.language)) { + Object.assign(videojsOptions, { language: options.language }) + } + return videojsOptions } diff --git a/scripts/build/client.sh b/scripts/build/client.sh index 3d1d0234e..a0277da01 100755 --- a/scripts/build/client.sh +++ b/scripts/build/client.sh @@ -16,6 +16,12 @@ post_build_hook () { rmdir "./src/locale/pending_target/" } +# Previous build failed +if [ ! -f client/src/locale/target/angular_fr_FR.xml ]; then + git checkout -- client/src/locale/target/ + rm -r client/src/locale/pending_target/ +fi + cd client rm -rf ./dist ./compiled -- 2.41.0