i18n: instant lang switch via HTMX trigger + refresh paid-plans terms
This commit is contained in:
parent
f4d9c9f2ec
commit
e4dc6d0071
4 changed files with 22 additions and 25 deletions
|
|
@ -158,12 +158,14 @@
|
|||
body: JSON.stringify({lang: newLang}),
|
||||
});
|
||||
if (!r.ok) throw new Error('HTTP ' + r.status);
|
||||
// Reload localized panels so the user immediately sees content
|
||||
// in the new language (strategic log, dashboard header, etc.).
|
||||
if (window.location.pathname === '/log' ||
|
||||
window.location.pathname.startsWith('/log/')) {
|
||||
window.location.reload();
|
||||
}
|
||||
// Trigger HTMX-driven panels to re-fetch in the new language.
|
||||
// Same shape as cassandraSetTone — every panel that listens to
|
||||
// tone-changed also listens to lang-changed.
|
||||
['#dash-header-container', '#log-panel .panel-body',
|
||||
'#indicators-body', '#log-content'].forEach(function (sel) {
|
||||
var el = document.querySelector(sel);
|
||||
if (el && window.htmx) window.htmx.trigger(el, 'lang-changed');
|
||||
});
|
||||
} catch (e) {
|
||||
pill.dataset.lang = prev;
|
||||
console.warn('language switch failed:', e);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<div id="dash-header-container"
|
||||
style="grid-column: 1 / -1;"
|
||||
hx-get="/api/summary/aggregate?as=html"
|
||||
hx-trigger="load, every 300s, tone-changed"
|
||||
hx-trigger="load, every 300s, tone-changed, lang-changed"
|
||||
hx-swap="innerHTML">
|
||||
<div class="empty">loading aggregate read…</div>
|
||||
</div>
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
<div id="indicators-body"
|
||||
class="panel-body panel-body--scroll"
|
||||
hx-get="/api/indicators/{{ groups[0] }}?as=html"
|
||||
hx-trigger="load, tone-changed"
|
||||
hx-trigger="load, tone-changed, lang-changed"
|
||||
hx-swap="innerHTML">
|
||||
<div class="empty">loading…</div>
|
||||
</div>
|
||||
|
|
@ -115,7 +115,7 @@
|
|||
</div>
|
||||
<div class="panel-body"
|
||||
hx-get="/api/log/latest?as=html"
|
||||
hx-trigger="load, every 300s, tone-changed"
|
||||
hx-trigger="load, every 300s, tone-changed, lang-changed"
|
||||
hx-swap="innerHTML">
|
||||
<div class="empty">awaiting first log…</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
<article id="log-content"
|
||||
class="log-page__content"
|
||||
hx-get="/api/log/by-date/{{ selected_iso }}?as=html"
|
||||
hx-trigger="load, tone-changed"
|
||||
hx-trigger="load, tone-changed, lang-changed"
|
||||
hx-swap="innerHTML">
|
||||
<div class="empty">loading log…</div>
|
||||
</article>
|
||||
|
|
|
|||
|
|
@ -77,21 +77,16 @@
|
|||
<section class="public-section">
|
||||
<h2 class="public-section__head">5. Paid plans</h2>
|
||||
<p>
|
||||
If and when paid plans become available, you will be told the
|
||||
applicable fees at point of sale. Paid features remain active for as
|
||||
long as the subscription is current or any time-bounded credit
|
||||
granted to your account is still valid. You can cancel a paid
|
||||
subscription at any time; cancellation takes effect at the end of
|
||||
the current billing period unless otherwise stated.
|
||||
</p>
|
||||
<p>
|
||||
Where the law gives you a 14-day right to cancel a subscription
|
||||
(Consumer Contracts (Information, Cancellation and Additional
|
||||
Charges) Regulations 2013, UK), that right applies. By starting to
|
||||
use a paid feature immediately on purchase you agree we may begin
|
||||
supplying the service within the cancellation period, and you
|
||||
acknowledge that you lose the right to cancel in respect of any
|
||||
digital content already delivered.
|
||||
Paid plans are available at £7/month or £70/year (terms
|
||||
and current prices on the <a href="/pricing">pricing page</a>). New
|
||||
annual subscriptions begin with a 14-day free trial; monthly
|
||||
subscriptions begin immediately on payment. Paid features remain
|
||||
active for as long as the subscription is current or any
|
||||
time-bounded credit granted to your account is still valid. You
|
||||
can cancel a paid subscription at any time; cancellation takes
|
||||
effect at the end of the current billing period unless otherwise
|
||||
stated. Detailed refund and cancellation rights are set out in
|
||||
section 6 below.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue