in da beginning

This commit is contained in:
Tavyza
2026-05-04 20:41:30 -04:00
commit 2cbc177ac8
10 changed files with 286 additions and 0 deletions

12
resources/lang/getlang.js Normal file
View File

@@ -0,0 +1,12 @@
// get the language
function getlang() {
// i can type
lang = localStorage.getItem("lang");
document.getElementById("language").value = lang;
console.log("the language is set to " + lang)
}
document.getElementById("language").addEventListener('change', function(e){localStorage.setItem("lang", e.eventTarget.value);})
getlang()

47
resources/lang/lang.js Normal file
View File

@@ -0,0 +1,47 @@
// languaging ???
async function localize(params) {
let lang = document.getElementById("language");
if (lang == null) {
console.log("lang doesn't exist waaahhh");
let temp1 = document.getElementById('naviframe');
let temp2 = temp1.contentDocument || temp1.contentWindow.document;
console.log(temp2)
lang = temp2.getElementById('language')
console.log(lang)
}
lang = lang.value;
//localStorage.setItem("lang", lang);
thing = document.querySelectorAll("*");
file = await fetch("/resources/lang/lang.json");
console.log("EXISTANCE !!!")
if (file.ok) {
contents = await file.json();
// contents.<lang>.<key>
thing.forEach(element => {
key = element.getAttribute("key");
if (key != null) {
console.log(contents[lang][key]);
element.innerHTML = contents[lang][key];
}
});
} else {
console.log("oopsie !!!")
}
}
if (lang_element != null) {
localize()
lang_element.addEventListener('change', localize)
}
function onFrameLoad(frame) {
let frame_doc = frame.contentDocument || frame.contentWindow.document;
let frame_lang_element = frame_doc.getElementById('language');
frame_lang_element .addEventListener('change', localize);
localize()
}

64
resources/lang/lang.json Normal file
View File

@@ -0,0 +1,64 @@
{
"eng":{
"lang-info":{
"numbers":{
"numberbase":10,
"digits": {
"0": "0",
"1": "1",
"2": "2",
"3": "3",
"4": "4",
"5": "5",
"6": "6",
"7": "7",
"8": "8",
"9": "9"
},
"frac": ".",
"neg-pref": "-",
"neg-sufx": ""
}
},
"index":"Home",
"conlangs":"Conlanging",
"coding":"Coding",
"poetry-stories":"Poetry &amp; Stories",
"about":"About Tavyza",
"dx1":"Hello. This website is under construction. Feel free to give suggestions in <a href=\"//git.tavyza.org/Theros/tavyza-website\">the git repository</a>. Please expect issues with formatting, translation errors, the like.",
"dx2":"This website was proudly built without AI assistance.",
"tp1":"This is a template page."
},
"isl":{
"lang-info":{
"numbers":{
"numberbase":10,
"digits": {
"0": "0",
"1": "1",
"2": "2",
"3": "3",
"4": "4",
"5": "5",
"6": "6",
"7": "7",
"8": "8",
"9": "9"
},
"frac": ".",
"neg-pref": "-",
"neg-sufx": ""
}
},
"index":"Heim",
"conlangs":"Conlanging",
"coding":"Coding",
"poetry-stories":"Poetry &amp; Stories",
"about":"About Tavyza",
"dx1":"Halló. This website is under construction. Feel free to give suggestions in <a href=\"//git.tavyza.org/Theros/tavyza-website\">the git repository</a>. Please expect issues with formatting, translation errors, the like.",
"dx2":"This website was proudly built without AI assistance."
}
}