feat: update locale to be more smart

This commit is contained in:
Strix 2023-12-24 20:40:28 +01:00
parent 4dd1cf209b
commit ff01197ee6
No known key found for this signature in database
GPG key ID: 5F35B3B8537287A7
5 changed files with 98 additions and 30 deletions

View file

@ -1,22 +1,32 @@
<html
x0-mods="locale,copy,http"
x0-module-root="./modules/"
x0-init="false"
x1-locale-file="./test.json"
x1-locale-watch
x0-locale-file="./test.json"
x0-locale-watch
>
<body>
<button onclick="window.x0.update()">Update x0</button>
<button onclick="window.location.reload()">Reload page</button>
<button onclick="window.location.reload()" x-locale-key="debug-tools.reload">Reload page</button>
<input type="text" onfocus="this.value = document.querySelector('html').getAttribute('x0-mods')" onchange="document.querySelector('html').setAttribute('x0-mods', this.value); document.querySelector('#status').innerHTML='updated x0-mods'; window.x0.update(); setInterval(() => document.querySelector('#status').innerHTML = '', 500)">
<span id="status"></span>
<h1 x-locale-key="main.greeting"></h1>
<h1 x-locale-key="main.greeting">main.greeting</h1>
<div>
<h2 x-locale-key="copy-section.header"></h2>
<div id="ex">
<span x-locale-key="copy-section.content-span"></span>
<span x-locale-key="copy-section.content-span">origin</span>
<span x-locale-key="copy-section.content-span">duplicate</span>
<span x-locale-key="copy-section.content-span">duplicate</span>
<span x-locale-key="copy-section.content-span">duplicate</span>
<span x-locale-key="copy-section.content-span">duplicate</span>
<span x-locale-key="copy-section.content-span">duplicate</span>
<span x-locale-key="copy-section.content-span">duplicate</span>
<span x-locale-key="copy-section.content-span">duplicate</span>
<span x-locale-key="copy-section.content-span">duplicate</span>
<span x-locale-key="copy-section.content-span">duplicate</span>
<span x-locale-key="copy-section.content-span">duplicate</span>
<span x-locale-key="copy-section.content-span">duplicate</span>
</div>
<div x-copy-query="#ex"></div>
</div>