Replace browser language detection in defaults.js with explicit 'auto' option

This commit is contained in:
Albin Larsson
2018-05-28 07:43:37 +02:00
parent c9298fde76
commit 812e07b734
3 changed files with 7 additions and 3 deletions

View File

@ -88,7 +88,11 @@ const captions = {
// Set language if it hasn't been set already
if (!this.language) {
this.language = this.storage.get('language') || (this.config.captions.language || '').toLowerCase();
let { language } = this.config.captions;
if (language === 'auto') {
[ language ] = (navigator.language || navigator.userLanguage).split('-');
}
this.language = this.storage.get('language') || (language || '').toLowerCase();
}
// Toggle the class hooks