lang: improved, Home view translation
This commit is contained in:
@ -48,9 +48,11 @@ const navigateTo = async (uri) => {
|
||||
}
|
||||
};
|
||||
|
||||
const reloadView = async _ => renderView(lastView);
|
||||
|
||||
async function renderView(view)
|
||||
{
|
||||
let content = await view.getHtml();
|
||||
let content = await view?.getHtml();
|
||||
if (content == null)
|
||||
return 1;
|
||||
|
||||
@ -140,12 +142,19 @@ document.addEventListener("DOMContentLoaded", async () => {
|
||||
|
||||
//Languages
|
||||
Array.from(document.getElementById('languageSelector').children).forEach(el => {
|
||||
el.onclick = _ => client.lang.changeLanguage(el.value);
|
||||
el.onclick = async _ => {
|
||||
if (await client.lang.changeLanguage(el.value))
|
||||
return;
|
||||
document.querySelector('#languageSelector > .active')?.classList.remove('active');
|
||||
el.classList.add('active');
|
||||
};
|
||||
});
|
||||
document.querySelector(`#languageSelector > [value=${client.lang.chosenLang}]`)
|
||||
?.classList.add('active');
|
||||
|
||||
await client.isAuthentificate();
|
||||
router(location.pathname);
|
||||
document.querySelector('a[href=\'' + location.pathname + '\']')?.classList.add('active');
|
||||
});
|
||||
|
||||
export { client, navigateTo }
|
||||
export { client, navigateTo, reloadView }
|
||||
|
Reference in New Issue
Block a user