Skip to content

Commit

Permalink
issue cucumber#637 - saving and retrieving the preferred language fro…
Browse files Browse the repository at this point in the history
…m local storage
  • Loading branch information
10xtechie committed Jun 24, 2022
1 parent cad08c9 commit eb6f0d4
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions themes/cucumber-sb/static/js/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,19 @@ var supportedLanguages = [
"scala"
]

var defaulLanguage = 'java'

ready(function() {
var selectedLang = getLangFromUrl();
if(selectedLang != '' && selectedLang != null && supportedLanguages.includes(selectedLang)){
showOnly(selectedLang)
if((selectedLang == '' || selectedLang == null)){
if(localStorage.getItem('language') == ''){
showOnly(defaulLanguage)
localStorage.setItem('language', defaulLanguage)
}else{
showOnly(localStorage.getItem('language'))
}
}else{
//setting default language
showOnly("java")
showOnly(selectedLang)
}

each(document, '.tabs li', function(li) {
Expand Down

0 comments on commit eb6f0d4

Please sign in to comment.