fixes and improved language selector
This commit is contained in:
parent
9dc7637ee9
commit
d38276b028
5 changed files with 29 additions and 34 deletions
|
@ -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};
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</head>
|
||||
|
||||
<body class="no-theme">
|
||||
<script src="/index.js" type="module"></script>
|
||||
|
||||
|
||||
<div id="loading" class="loading">
|
||||
<div class="centeritem">
|
||||
|
@ -98,5 +98,5 @@
|
|||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<script src="/index.js" type="module"></script>
|
||||
</html>
|
||||
|
|
|
@ -7,13 +7,6 @@ import{ File }from"./file.js";
|
|||
import { I18n } from "./i18n.js";
|
||||
|
||||
(async ()=>{
|
||||
async function waitForLoad(): Promise<void>{
|
||||
return new Promise(resolve=>{
|
||||
document.addEventListener("DOMContentLoaded", _=>resolve());
|
||||
});
|
||||
}
|
||||
|
||||
await waitForLoad();
|
||||
await I18n.done
|
||||
const users = getBulkUsers();
|
||||
if(!users.currentuser){
|
||||
|
|
|
@ -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)
|
||||
});
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue