settings: add language dropdown (IT active, ES/FR/DE WIP)
This commit is contained in:
parent
f4025e3cbb
commit
50ac6b9366
1 changed files with 41 additions and 0 deletions
|
|
@ -224,6 +224,47 @@
|
|||
})();
|
||||
</script>
|
||||
|
||||
{# --- Language block ------------------------------------------------ #}
|
||||
<details class="settings-section">
|
||||
<summary class="settings-section__head">Language</summary>
|
||||
<p class="settings-section__lede">
|
||||
Language the AI uses for the strategic log, your daily digest, and
|
||||
portfolio commentary. The interface itself stays in English for now.
|
||||
</p>
|
||||
<div class="settings-row">
|
||||
<select id="lang-select" class="settings-select">
|
||||
<option value="en" {% if (user.lang or 'en') == 'en' %}selected{% endif %}>English</option>
|
||||
<option value="it" {% if (user.lang or 'en') == 'it' %}selected{% endif %}>Italiano</option>
|
||||
<option value="es" disabled>Español · coming soon</option>
|
||||
<option value="fr" disabled>Français · coming soon</option>
|
||||
<option value="de" disabled>Deutsch · coming soon</option>
|
||||
</select>
|
||||
<span id="lang-status" class="settings-status" aria-live="polite"></span>
|
||||
</div>
|
||||
<script>
|
||||
(function () {
|
||||
var sel = document.getElementById('lang-select');
|
||||
var status = document.getElementById('lang-status');
|
||||
if (!sel) return;
|
||||
sel.addEventListener('change', async function () {
|
||||
status.textContent = 'saving…';
|
||||
try {
|
||||
var r = await fetch('/api/settings/language', {
|
||||
method: 'PATCH',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({lang: sel.value}),
|
||||
});
|
||||
if (!r.ok) throw new Error('HTTP ' + r.status);
|
||||
status.textContent = '✓ saved';
|
||||
setTimeout(function () { status.textContent = ''; }, 1500);
|
||||
} catch (e) {
|
||||
status.textContent = '✗ failed';
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
</details>
|
||||
|
||||
{# --- Cloud sync block --------------------------------------------- #}
|
||||
<details class="settings-section">
|
||||
<summary class="settings-section__head">Cloud sync (encrypted)</summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue