Public landing page is now served in English and Italian via path-
prefixed URLs (/en/ and /it/), with the bare / detecting the
visitor's language and 302-ing to the right one.
Routing
-------
* GET / : if authed → dashboard (unchanged). Otherwise the visitor's
language is resolved from (in priority order) the rtm.lang cookie,
the Accept-Language header, the cf-ipcountry geolocation header,
and finally DEFAULT_LANG, then a 302 redirects to /<lang>/.
* GET /en/ + /it/ : render the localised landing template, set the
rtm.lang cookie (1-year, SameSite=Lax) so the next /-visit goes
straight to the same translation. Logged-in users with user.lang
set bypass detection for / (same priority chain — user.lang wins
on every public surface they touch).
Storage
-------
* app/locales/<lang>.yaml — flat-ish nested copy files. YAML chosen
so a future translator can edit without touching Python. Strings
containing inline HTML (<strong>, <em>, <a>) are rendered with the
Jinja `safe` filter in the template.
* app/services/locales.py — loads at startup, exposes get_locale()
and detect_public_lang(). Wraps each YAML tree in a small _Dotted
view so templates can write {{ t.hero.subhead }} (deliberately NOT
a dict subclass — dict's built-in method names would shadow YAML
keys like `items`).
Template + chrome
-----------------
* landing.html ported in full to {{ t.<key> }} references.
* public_base.html gets <html lang="…"> + hreflang link tags (en/it/
x-default) when a route opts in via lang_switch=true. A tiny
EN | IT link group lands in the public header, only visible on
surfaces that opt in.
* public.css picks up the small lang-switch widget styles.
Scope (intentionally narrow)
----------------------------
* Only the landing page is localised. Pricing, terms, privacy,
disclaimer, login, verify all stay English-only for now; their
header chrome stays English too because localising labels there
while the linked content is still EN would be a worse mismatch.
* When other public pages get translated, lang_switch=true on those
routes will surface the same widget there with no template changes.
Tests
-----
* tests/test_locales.py covers YAML load parity (every active
language has a file), dotted access through the tree, the
detection precedence chain, and the unknown-locale fallback.
Deps
----
* pyyaml was already in requirements.lock as a transitive but not
declared. Added to pyproject so it stays pinned as an explicit
direct dependency.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
86 lines
3.7 KiB
HTML
86 lines
3.7 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="{{ lang|default('en') }}">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>{% block title %}{{ BRAND_NAME }}{% endblock %}</title>
|
|
<meta name="description" content="{{ (t.meta.description if t is defined and t else None) or TAGLINE }}">
|
|
{# Hreflang signals for search engines: tells crawlers that the
|
|
same page exists in another language at a different URL. Only
|
|
rendered when the route explicitly opts in via lang_switch=true. #}
|
|
{% if lang_switch %}
|
|
<link rel="alternate" hreflang="en" href="/en/">
|
|
<link rel="alternate" hreflang="it" href="/it/">
|
|
<link rel="alternate" hreflang="x-default" href="/">
|
|
{% endif %}
|
|
{# Same flash-prevention theme bootstrap as the app shell. #}
|
|
<script>
|
|
(function() {
|
|
try {
|
|
var t = localStorage.getItem('cassandra.theme') || 'light';
|
|
document.documentElement.dataset.theme = t;
|
|
} catch (e) { document.documentElement.dataset.theme = 'light'; }
|
|
})();
|
|
</script>
|
|
<link rel="stylesheet" href="{{ url_for('static', path='/css/tokens.css') }}?v={{ ASSET_VERSION }}" />
|
|
<link rel="stylesheet" href="{{ url_for('static', path='/css/layout.css') }}?v={{ ASSET_VERSION }}" />
|
|
<link rel="stylesheet" href="{{ url_for('static', path='/css/panels.css') }}?v={{ ASSET_VERSION }}" />
|
|
<link rel="stylesheet" href="{{ url_for('static', path='/css/auth.css') }}?v={{ ASSET_VERSION }}" />
|
|
<link rel="stylesheet" href="{{ url_for('static', path='/css/settings.css') }}?v={{ ASSET_VERSION }}" />
|
|
<link rel="stylesheet" href="{{ url_for('static', path='/css/public.css') }}?v={{ ASSET_VERSION }}" />
|
|
</head>
|
|
<body class="public-page">
|
|
<div class="public-shell">
|
|
<header class="public-header">
|
|
<a class="public-header__brand" href="/" aria-label="{{ BRAND_NAME }} home">
|
|
{{ BRAND_NAME }}
|
|
</a>
|
|
<nav class="public-header__nav">
|
|
<a href="/pricing" class="{% if request.url.path == '/pricing' %}active{% endif %}">Pricing</a>
|
|
<a href="/about" class="{% if request.url.path == '/about' %}active{% endif %}">About</a>
|
|
{# Lang switch — currently only the landing page opts in
|
|
(lang_switch=true). When other public pages get translated
|
|
this widget will surface there too automatically. #}
|
|
{% if lang_switch %}
|
|
<span class="public-header__lang-switch" role="group" aria-label="Language">
|
|
<a href="/en/" class="public-header__lang {% if lang == 'en' %}active{% endif %}">EN</a>
|
|
<a href="/it/" class="public-header__lang {% if lang == 'it' %}active{% endif %}">IT</a>
|
|
</span>
|
|
{% endif %}
|
|
{% if cu and (cu.user or cu.is_admin) %}
|
|
<a href="/" class="public-header__cta">Dashboard</a>
|
|
{% else %}
|
|
<a href="/login" class="public-header__cta">Sign in / sign up</a>
|
|
{% endif %}
|
|
</nav>
|
|
</header>
|
|
|
|
<main class="public-main">
|
|
{% block main %}{% endblock %}
|
|
</main>
|
|
|
|
<footer class="public-footer">
|
|
<div class="public-footer__inner">
|
|
<div class="public-footer__brand">
|
|
<strong>{{ BRAND_NAME }}</strong>
|
|
<span class="public-footer__tagline">{{ TAGLINE }}</span>
|
|
</div>
|
|
<nav class="public-footer__links">
|
|
<a href="/pricing">Pricing</a>
|
|
<a href="/about">About</a>
|
|
<a href="/terms">Terms</a>
|
|
<a href="/privacy">Privacy</a>
|
|
<a href="/disclaimer">Disclaimer</a>
|
|
</nav>
|
|
<div class="public-footer__meta">
|
|
© 2026 {{ LEGAL_OPERATOR }} ·
|
|
Not investment advice ·
|
|
{{ OPERATOR_JURISDICTION }} ·
|
|
ICO ZC098928 ·
|
|
Last reviewed 2026-05-24
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
</div>
|
|
</body>
|
|
</html>
|