From a4f1fdec5d2c7770316ff465ed27ccd8b08f64f7 Mon Sep 17 00:00:00 2001 From: Albin Larsson Date: Sun, 12 Aug 2018 20:05:52 +0200 Subject: [PATCH] Fix #1153: Captions language fallback --- src/js/captions.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/js/captions.js b/src/js/captions.js index 4ad2a956..f31b5305 100644 --- a/src/js/captions.js +++ b/src/js/captions.js @@ -83,11 +83,8 @@ const captions = { // * active: The state preferred by user settings or config // * toggled: The real captions state - const languages = dedupe( - Array.from(navigator.languages || navigator.language || navigator.userLanguage).map( - language => language.split('-')[0], - ), - ); + const browserLanguages = navigator.languages || [navigator.language || navigator.userLanguage || 'en']; + const languages = dedupe(browserLanguages.map(language => language.split('-')[0])); let language = (this.storage.get('language') || this.config.captions.language || 'auto').toLowerCase();