From 49aab11acb8db0d636b55bc795177ed63177aea0 Mon Sep 17 00:00:00 2001 From: Luca Date: Mon, 12 Apr 2021 23:00:07 +0200 Subject: [PATCH] Svallinns locale fix --- src/renderer/views/Watch/Watch.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/renderer/views/Watch/Watch.js b/src/renderer/views/Watch/Watch.js index 180096d8..ea97a86b 100644 --- a/src/renderer/views/Watch/Watch.js +++ b/src/renderer/views/Watch/Watch.js @@ -385,14 +385,17 @@ export default Vue.extend({ .captionTracks if (typeof captionTracks !== 'undefined') { - const standardLocale = localStorage.getItem('locale').replace('_', '-') - const noLocaleCaption = !captionTracks.some(track => - track.languageCode === standardLocale && track.kind !== 'asr' - ) + const locale = localStorage.getItem('locale') + if (locale !== null) { + const standardLocale = locale.replace('_', '-') + const noLocaleCaption = !captionTracks.some(track => + track.languageCode === standardLocale && track.kind !== 'asr' + ) - if (!standardLocale.startsWith('en') && noLocaleCaption) { - const baseUrl = result.player_response.captions.playerCaptionsRenderer.baseUrl - this.tryAddingTranslatedLocaleCaption(captionTracks, standardLocale, baseUrl) + if (!standardLocale.startsWith('en') && noLocaleCaption) { + const baseUrl = result.player_response.captions.playerCaptionsRenderer.baseUrl + this.tryAddingTranslatedLocaleCaption(captionTracks, standardLocale, baseUrl) + } } this.captionHybridList = this.createCaptionPromiseList(captionTracks)