Add locale support

This commit is contained in:
Misode
2020-05-29 03:38:41 +02:00
parent a8fabd555b
commit a994464730
15 changed files with 132 additions and 43 deletions
+9 -1
View File
@@ -3,6 +3,7 @@ import { TreeView } from '../view/TreeView'
import { SourceView } from '../view/SourceView'
import { ConditionSchema } from '../minecraft/schemas/Condition'
import { SandboxSchema } from './Sandbox'
import { LOCALES, locale } from '../Registries'
const predicateModel = new DataModel(ConditionSchema)
const sandboxModel = new DataModel(SandboxSchema)
@@ -29,4 +30,11 @@ document.getElementById('header')?.append(modelSelector)
new TreeView(model, document!.getElementById('view')!)
new SourceView(model, document!.getElementById('source')!)
model.invalidate()
fetch('../build/locales/en.json')
.then(r => r.json())
.then(l => {
LOCALES.register('en', l)
LOCALES.language = 'en'
model.invalidate()
})