Commit 046ad545 authored by Marcel Stör's avatar Marcel Stör
Browse files

Fix String#split to determine selected language code

parent 3e68026d
...@@ -74,7 +74,8 @@ var nodemcu = nodemcu || {}; ...@@ -74,7 +74,8 @@ var nodemcu = nodemcu || {};
var selectedLanguageCode, path = window.location.pathname; var selectedLanguageCode, path = window.location.pathname;
if (window.location.origin.indexOf('readthedocs') > -1) { if (window.location.origin.indexOf('readthedocs') > -1) {
// path is like /en/<branch>/<lang>/build/ -> extract 'lang' // path is like /en/<branch>/<lang>/build/ -> extract 'lang'
selectedLanguageCode = path.split('/')[2]; // split[0] is an '' because the path starts with the separator
selectedLanguageCode = path.split('/')[3];
} else { } else {
// path is like /<lang>/build/ -> extract 'lang' // path is like /<lang>/build/ -> extract 'lang'
selectedLanguageCode = path.substr(1, 2); selectedLanguageCode = path.substr(1, 2);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment