diff --git a/src/webpage/i18n.ts b/src/webpage/i18n.ts index 8af5f10..742ba32 100644 --- a/src/webpage/i18n.ts +++ b/src/webpage/i18n.ts @@ -25,6 +25,7 @@ class I18n{ } this.lang=lang; this.translations=translations; + res(); } static getTranslation(msg:string,...params:string[]):string{ @@ -118,4 +119,4 @@ if(storage){ } I18n.create(userLocale); -export{I18n}; +export{I18n,langmap}; diff --git a/src/webpage/index.html b/src/webpage/index.html index d2aa1c2..f4ac781 100644 --- a/src/webpage/index.html +++ b/src/webpage/index.html @@ -16,7 +16,7 @@ - +
@@ -98,5 +98,5 @@
- + diff --git a/src/webpage/index.ts b/src/webpage/index.ts index 27ec571..6b1cb43 100644 --- a/src/webpage/index.ts +++ b/src/webpage/index.ts @@ -7,13 +7,6 @@ import{ File }from"./file.js"; import { I18n } from "./i18n.js"; (async ()=>{ - async function waitForLoad(): Promise{ - return new Promise(resolve=>{ - document.addEventListener("DOMContentLoaded", _=>resolve()); - }); - } - - await waitForLoad(); await I18n.done const users = getBulkUsers(); if(!users.currentuser){ diff --git a/src/webpage/localuser.ts b/src/webpage/localuser.ts index 7dede8e..9bb7a3f 100644 --- a/src/webpage/localuser.ts +++ b/src/webpage/localuser.ts @@ -12,7 +12,7 @@ import{ getTextNodeAtPosition, MarkDown, saveCaretPosition }from"./markdown.js"; import { Bot } from "./bot.js"; import { Role } from "./role.js"; import { VoiceFactory } from "./voice.js"; -import { I18n } from "./i18n.js"; +import { I18n, langmap } from "./i18n.js"; const wsCodesRetry = new Set([4000,4001,4002, 4003, 4005, 4007, 4008, 4009]); @@ -1453,7 +1453,7 @@ class Localuser{ security.addSelect(I18n.getTranslation("localuser.language"),(e)=>{ I18n.setLanguage(I18n.options()[e]); - },I18n.options(),{ + },[...langmap.values()],{ defaultIndex:I18n.options().indexOf(I18n.lang) }); { diff --git a/src/webpage/login.ts b/src/webpage/login.ts index 38eec16..4705b03 100644 --- a/src/webpage/login.ts +++ b/src/webpage/login.ts @@ -4,7 +4,27 @@ import { I18n } from "./i18n.js"; const mobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent); const iOS = /iPhone|iPad|iPod/i.test(navigator.userAgent); - +let instances: +| { +name: string; +description?: string; +descriptionLong?: string; +image?: string; +url?: string; +display?: boolean; +online?: boolean; +uptime: { alltime: number; daytime: number; weektime: number }; +urls: { +wellknown: string; +api: string; +cdn: string; +gateway: string; +login?: string; +}; +}[] +| null; +const datalist = document.getElementById("instances"); +console.warn(datalist); const instancefetch=fetch("/instances.json") .then(res=>res.json()) .then( @@ -70,25 +90,7 @@ function setTheme(){ } document.body.className = name + "-theme"; } -let instances: -| { -name: string; -description?: string; -descriptionLong?: string; -image?: string; -url?: string; -display?: boolean; -online?: boolean; -uptime: { alltime: number; daytime: number; weektime: number }; -urls: { -wellknown: string; -api: string; -cdn: string; -gateway: string; -login?: string; -}; -}[] -| null; + (async ()=>{ await I18n.done @@ -686,8 +688,7 @@ export{ adduser, }; -const datalist = document.getElementById("instances"); -console.warn(datalist); + export function getInstances(){ return instances; }