mirror of
https://github.com/danbulant/api_docs
synced 2026-05-24 12:27:29 +00:00
Fix default language selection bug
This commit is contained in:
parent
0f93ffcc2b
commit
d1fdd685a6
1 changed files with 3 additions and 1 deletions
|
|
@ -41,6 +41,9 @@ under the License.
|
||||||
hash = hash.replace(/^#+/, '');
|
hash = hash.replace(/^#+/, '');
|
||||||
}
|
}
|
||||||
history.pushState({}, '', '?' + language + '#' + hash);
|
history.pushState({}, '', '?' + language + '#' + hash);
|
||||||
|
|
||||||
|
// save language as next default
|
||||||
|
localStorage.setItem("language", language);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupLanguages(l) {
|
function setupLanguages(l) {
|
||||||
|
|
@ -53,7 +56,6 @@ under the License.
|
||||||
// the language is in the URL, so use that language!
|
// the language is in the URL, so use that language!
|
||||||
activateLanguage(location.search.substr(1));
|
activateLanguage(location.search.substr(1));
|
||||||
|
|
||||||
// set this language as the default for next time, if the URL has no language
|
|
||||||
localStorage.setItem("language", location.search.substr(1));
|
localStorage.setItem("language", location.search.substr(1));
|
||||||
} else if ((defaultLanguage !== null) && (jQuery.inArray(defaultLanguage, languages) != -1)) {
|
} else if ((defaultLanguage !== null) && (jQuery.inArray(defaultLanguage, languages) != -1)) {
|
||||||
// the language was the last selected one saved in localstorage, so use that language!
|
// the language was the last selected one saved in localstorage, so use that language!
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue