added language switcher and defualt language finder

This commit is contained in:
MathMan05
2024-11-01 13:31:15 -05:00
parent 3fb4920ab0
commit 9a7c70bd55
3 changed files with 50 additions and 21 deletions

View File

@@ -1243,25 +1243,7 @@ class Localuser{
{ initColor: userinfos.accent_color }
);
}
{
const box=tas.addCheckboxInput(I18n.getTranslation("localuser.enableEVoice"),()=>{},{initState:Boolean(localStorage.getItem("Voice enabled"))});
box.onchange=(e)=>{
if(e){
if(confirm(I18n.getTranslation("localuser.VoiceWarning"))){
localStorage.setItem("Voice enabled","true")
}else{
box.value=true;
const checkbox=box.input.deref();
if(checkbox){
checkbox.checked=false;
}
}
}else{
localStorage.removeItem("Voice enabled");
}
}
}
}
{
const update=settings.addButton(I18n.getTranslation("localuser.updateSettings"))
@@ -1434,6 +1416,31 @@ class Localuser{
}
});
});
security.addSelect(I18n.getTranslation("localuser.language"),(e)=>{
I18n.setLanguage(I18n.options()[e]);
},I18n.options(),{
defaultIndex:I18n.options().indexOf(I18n.lang)
});
{
const box=security.addCheckboxInput(I18n.getTranslation("localuser.enableEVoice"),()=>{},{initState:Boolean(localStorage.getItem("Voice enabled"))});
box.onchange=(e)=>{
if(e){
if(confirm(I18n.getTranslation("localuser.VoiceWarning"))){
localStorage.setItem("Voice enabled","true")
}else{
box.value=true;
const checkbox=box.input.deref();
if(checkbox){
checkbox.checked=false;
}
}
}else{
localStorage.removeItem("Voice enabled");
}
}
}
};
genSecurity();
}