mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2025-01-13 23:53:54 +08:00
lang
This commit is contained in:
parent
341e57ae2d
commit
f37f8c664c
0
docs/README.md
Normal file
0
docs/README.md
Normal file
@ -58,9 +58,9 @@
|
||||
语言/Language
|
||||
</span>
|
||||
<div class="dropdown-content ">
|
||||
<a class="goodlink buttonsize" href="#/zh/">简体中文<br></a>
|
||||
<a class="goodlink buttonsize" href="#/en/">English<br></a>
|
||||
<a class="goodlink buttonsize" href="#/ru/">Русский язык<br></a>
|
||||
<a class="goodlink buttonsize" onclick="switchlang(`zh`)">简体中文<br></a>
|
||||
<a class="goodlink buttonsize" onclick="switchlang(`en`)">English<br></a>
|
||||
<a class="goodlink buttonsize" onclick="switchlang(`ru`)">Русский язык<br></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
16
docs/main.js
16
docs/main.js
@ -4,7 +4,7 @@ window.$docsify = {
|
||||
requestHeaders: {
|
||||
'cache-control': 'max-age=0',
|
||||
},
|
||||
|
||||
notFoundPage: 'redirect.html',
|
||||
pagination: {
|
||||
previousText: '上一节',
|
||||
nextText: '下一节',
|
||||
@ -37,11 +37,10 @@ window.$docsify = {
|
||||
}
|
||||
},
|
||||
|
||||
executeScript: true
|
||||
executeScript: true,
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
let dropdowns = document.getElementsByClassName('dropdown')
|
||||
for (let i = 0; i < dropdowns.length; i++) {
|
||||
|
||||
@ -87,11 +86,14 @@ function getcurrlang(url) {
|
||||
}
|
||||
return ''
|
||||
}
|
||||
function switchlang(lang) {
|
||||
window.location.href = window.location.href.replace('/' + currentlang + '/', '/' + lang + '/')
|
||||
}
|
||||
window.onpopstate = function (event) {
|
||||
let url = window.location.href;
|
||||
console.log(url)
|
||||
if (url.endsWith('/#/')) {
|
||||
window.location.href += 'zh/'
|
||||
let lang = window.localStorage.currentlang ? window.localStorage.currentlang : 'zh'
|
||||
window.location.href += lang + '/'
|
||||
return
|
||||
}
|
||||
for (let key in navitexts) {
|
||||
@ -101,9 +103,9 @@ window.onpopstate = function (event) {
|
||||
}
|
||||
}
|
||||
let thislang = getcurrlang(url)
|
||||
window.localStorage.currentlang = thislang
|
||||
if (thislang != currentlang) {
|
||||
currentlang = thislang
|
||||
console.log(navitexts[currentlang])
|
||||
|
||||
for (let key in navitexts[currentlang]) {
|
||||
document.getElementById(key).innerText = navitexts[currentlang][key]
|
||||
|
1
docs/redirect.html
Normal file
1
docs/redirect.html
Normal file
@ -0,0 +1 @@
|
||||
<meta http-equiv="refresh" content="0; URL=/#/">
|
Loading…
x
Reference in New Issue
Block a user