fix: don't put literal Jinja syntax inside JS comments in base.html

The previous commit's i18n explanatory comment included the snippet
{% if user_lang == 'it' %} as illustration — but Jinja parses the
whole template, including content inside JS // comments, so that
literal got picked up as a real (unclosed) tag and every page rendered
with a TemplateSyntaxError. Rewrite the comment without the literal
Jinja syntax.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Giorgio Gilestro 2026-05-29 12:03:44 +02:00
parent fca05aef7a
commit 259146ecdc

View file

@ -158,11 +158,10 @@
// HTMX (server-side translation), but plain UI labels are baked into // HTMX (server-side translation), but plain UI labels are baked into
// the HTML at render time. This dict + applyI18n() below let the // the HTML at render time. This dict + applyI18n() below let the
// language toggle swap labels live without a page refresh. // language toggle swap labels live without a page refresh.
// Convention: <element data-i18n="key">… (sets textContent), // Convention: data-i18n="key" sets textContent;
// <element data-i18n-placeholder="key" placeholder="…"> (sets .placeholder). // data-i18n-placeholder="key" sets .placeholder.
// First-render correctness is handled by the template's // First-render correctness is handled by the template's user_lang
// {% if user_lang == 'it' %} block — applyI18n only kicks in on // conditional, so applyI18n only kicks in on subsequent toggles.
// subsequent toggle events.
window.CASSANDRA_I18N = { window.CASSANDRA_I18N = {
'chat.title': { en: 'Ask Cassandra', 'chat.title': { en: 'Ask Cassandra',
it: 'Chiedi a Cassandra' }, it: 'Chiedi a Cassandra' },