Replace browser language detection in defaults.js with explicit 'auto' option
This commit is contained in:
@ -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
|
||||
|
@ -115,7 +115,7 @@ const defaults = {
|
||||
// Captions settings
|
||||
captions: {
|
||||
active: false,
|
||||
language: (navigator.language || navigator.userLanguage).split('-')[0],
|
||||
language: 'auto',
|
||||
// Listen to new tracks added after Plyr is initialized.
|
||||
// This is needed for streaming captions, but may result in unselectable options
|
||||
update: false,
|
||||
|
Reference in New Issue
Block a user