aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/captions.js
diff options
context:
space:
mode:
authorAlbin Larsson <mail@albinlarsson.com>2018-05-28 07:43:37 +0200
committerAlbin Larsson <mail@albinlarsson.com>2018-05-28 07:43:37 +0200
commit812e07b7347bc9d9a212b0204af1d90c92ee0c13 (patch)
treeb97d54b1acee49879e61eab6f700994a93a75576 /src/js/captions.js
parentc9298fde768d14975a41ce8018fd0f10116943aa (diff)
downloadplyr-812e07b7347bc9d9a212b0204af1d90c92ee0c13.tar.lz
plyr-812e07b7347bc9d9a212b0204af1d90c92ee0c13.tar.xz
plyr-812e07b7347bc9d9a212b0204af1d90c92ee0c13.zip
Replace browser language detection in defaults.js with explicit 'auto' option
Diffstat (limited to 'src/js/captions.js')
-rw-r--r--src/js/captions.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/js/captions.js b/src/js/captions.js
index f62b2d4f..f8083b65 100644
--- a/src/js/captions.js
+++ b/src/js/captions.js
@@ -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