Merge pull request #1195 from GilgusMaximus/development

Svallinns locale fix
This commit is contained in:
Luca Hohmann 2021-04-12 23:04:28 +02:00 committed by GitHub
commit 60c70e14dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 7 deletions

View File

@ -385,14 +385,17 @@ export default Vue.extend({
.captionTracks .captionTracks
if (typeof captionTracks !== 'undefined') { if (typeof captionTracks !== 'undefined') {
const standardLocale = localStorage.getItem('locale').replace('_', '-') const locale = localStorage.getItem('locale')
const noLocaleCaption = !captionTracks.some(track => if (locale !== null) {
track.languageCode === standardLocale && track.kind !== 'asr' const standardLocale = locale.replace('_', '-')
) const noLocaleCaption = !captionTracks.some(track =>
track.languageCode === standardLocale && track.kind !== 'asr'
)
if (!standardLocale.startsWith('en') && noLocaleCaption) { if (!standardLocale.startsWith('en') && noLocaleCaption) {
const baseUrl = result.player_response.captions.playerCaptionsRenderer.baseUrl const baseUrl = result.player_response.captions.playerCaptionsRenderer.baseUrl
this.tryAddingTranslatedLocaleCaption(captionTracks, standardLocale, baseUrl) this.tryAddingTranslatedLocaleCaption(captionTracks, standardLocale, baseUrl)
}
} }
this.captionHybridList = this.createCaptionPromiseList(captionTracks) this.captionHybridList = this.createCaptionPromiseList(captionTracks)