The interface speaks Slovak

969 strings, an instance default and a per-person choice, and no half-done corner:
the admin prose is translated too. Design and reasoning: LLeMbas.wiki/Translations.

KEYED BY THE ENGLISH SENTENCE

A missing entry renders the key, which is the English -- so an untranslated string
looks as it always did, an English instance is byte-for-byte 1.6.0, and a
half-finished catalogue is a half-translated page rather than a page of dotted key
names. The cost is that editing an English sentence orphans its translation
silently, which is what tests/test_translations.py asserts in both directions.

No gettext: .po -> .mo is a build step and this project does not have one.

A JINJA GLOBAL, AND THEREFORE A CONTEXTVAR

`t()` is a global for the reason `brand` already documents -- render() is bypassed
by 25 TemplateResponse calls and 8 get_template().render() calls, the latter being
the SSE frames, which have no Request at all. A global is bound once at import and
the language is per person, so the active language is a ContextVar set per request.

🚨 `get_current_user` had to become `async def`. FastAPI runs a sync dependency in a
threadpool, and anyio copies the context in and discards it on the way out -- so
the language was set where nothing could see it and every page rendered in the
instance's language whatever anybody had chosen, with no error anywhere.

NOT TRANSLATED, ON PURPOSE

Everything a model reads: the 60 prompt fragments, and the dates in harness.py,
schedule/runner.py and schedule/compile.py. Only `i18n.stamp` is localised, and
only where a person reads it -- with the *format* translatable as well as the
words, because "26. septembra 2026" is a different pattern rather than the same one
with different words in it. A process locale is not an option: global, not
thread-safe, two people's pages at once.

A second fragment telling models to answer in the reader's language was written
during this work and removed: `core.style` has said it since long before, and
test_an_empty_override_turns_a_fragment_off caught the duplicate.

THE BULK PASS

1213 sites wrapped by a one-off script that only touched patterns it could not
misread. It got three wrong in a way that mattered -- `t('…')` inside `attr="…"`
where the sentence held an apostrophe, closing the Jinja string and 500ing two
pages whose partials no test renders. tests/test_translations.py now compiles all
110 templates. It also wrapped the product's own name, an SSH key header, a
keystroke hint and an example URL, all taken back out: a string is not
translatable just because it is a string.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-26 14:46:33 +00:00
co-authored by Claude Opus 5
parent da0797ccad
commit a16510aba8
104 changed files with 3833 additions and 1788 deletions
+29 -37
View File
@@ -27,18 +27,18 @@
class="form-grid">
<section class="card">
<h2 class="card__title">The server</h2>
<h2 class="card__title">{{ t("The server") }}</h2>
<div class="field">
<label class="field__label" for="name">Name</label>
<label class="field__label" for="name">{{ t("Name") }}</label>
<input class="input" id="name" name="name" value="{{ server.name }}" required
maxlength="120" placeholder="GitHub">
maxlength="120" placeholder="{{ t('GitHub') }}">
</div>
<div class="field">
<label class="field__label" for="slug">Identifier</label>
<label class="field__label" for="slug">{{ t("Identifier") }}</label>
<input class="input input--mono" id="slug" name="slug" value="{{ server.slug }}" required
maxlength="24" pattern="[a-z0-9][a-z0-9_\-]*" placeholder="github">
maxlength="24" pattern="[a-z0-9][a-z0-9_\-]*" placeholder="{{ t('github') }}">
<p class="field__hint">
Prefixed onto every tool name this server offers, so that two servers
both exposing <code>search</code> do not collide.
@@ -46,40 +46,37 @@
</div>
<div class="field">
<label class="field__label" for="url">Endpoint URL</label>
<label class="field__label" for="url">{{ t("Endpoint URL") }}</label>
<input class="input input--mono" id="url" name="url" value="{{ server.url }}" required
placeholder="https://mcp.example.com/mcp">
<p class="field__hint">
The streamable-HTTP endpoint itself, the one that accepts a POST. A
server that answers with a redirect to somewhere else will be refused.
</p>
placeholder="{{ t('https://mcp.example.com/mcp') }}">
<p class="field__hint">{{ t("The streamable-HTTP endpoint itself, the one that accepts a POST. A server that answers with a redirect to somewhere else will be refused.") }}</p>
</div>
<div class="field">
<label class="field__label" for="headers">Extra headers</label>
<label class="field__label" for="headers">{{ t("Extra headers") }}</label>
<textarea class="textarea input--mono" id="headers" name="headers" rows="3"
spellcheck="false">{{ headers_text }}</textarea>
<p class="field__hint">One <code>Name: value</code> per line.</p>
</div>
<div class="field">
<label class="field__label" for="timeout">Timeout (seconds)</label>
<label class="field__label" for="timeout">{{ t("Timeout (seconds)") }}</label>
<input class="input" id="timeout" name="timeout" value="{{ server.timeout }}"
inputmode="numeric">
</div>
<div class="field">
<label class="field__label" for="max_chars">Most characters to keep per call</label>
<label class="field__label" for="max_chars">{{ t("Most characters to keep per call") }}</label>
<input class="input" id="max_chars" name="max_chars" value="{{ server.max_chars }}"
inputmode="numeric">
</div>
</section>
<section class="card">
<h2 class="card__title">Credential</h2>
<h2 class="card__title">{{ t("Credential") }}</h2>
<div class="field">
<label class="field__label" for="secret_placement">How it is sent</label>
<label class="field__label" for="secret_placement">{{ t("How it is sent") }}</label>
<select class="select" id="secret_placement" name="secret_placement">
{% for value, label in secret_placements %}
<option value="{{ value }}" {{ 'selected' if value == server.secret_placement }}>
@@ -90,15 +87,15 @@
</div>
<div class="field">
<label class="field__label" for="secret_name">Header or parameter name</label>
<label class="field__label" for="secret_name">{{ t("Header or parameter name") }}</label>
<input class="input input--mono" id="secret_name" name="secret_name"
value="{{ server.secret_name }}" maxlength="120">
</div>
<div class="field">
<label class="field__label" for="secret">Secret</label>
<label class="field__label" for="secret">{{ t("Secret") }}</label>
<input class="input input--mono" id="secret" name="secret" type="password"
autocomplete="off" placeholder="No secret set"
autocomplete="off" placeholder="{{ t('No secret set') }}"
value="{{ unchanged if server.secret_encrypted else '' }}">
<p class="field__hint">
{% if server.secret_encrypted %}
@@ -113,11 +110,8 @@
{% if tools %}
<section class="card">
<h2 class="card__title">Tools it offers</h2>
<p class="field__hint">
Discovered at the last refresh. Untick one to withhold it — a tool this
server adds later is offered by default.
</p>
<h2 class="card__title">{{ t("Tools it offers") }}</h2>
<p class="field__hint">{{ t("Discovered at the last refresh. Untick one to withhold it — a tool this server adds later is offered by default.") }}</p>
<input type="hidden" name="tool_choices" value="1">
<div class="checkbox-row checkbox-row--stacked">
@@ -141,7 +135,7 @@
</section>
{% elif not is_new %}
<section class="card">
<h2 class="card__title">Tools it offers</h2>
<h2 class="card__title">{{ t("Tools it offers") }}</h2>
<p class="field__hint">
Nothing discovered yet. Save, then press <strong>Test &amp; refresh</strong>
on the <a href="/admin/mcp">list</a>.
@@ -150,11 +144,11 @@
{% endif %}
<section class="card">
<h2 class="card__title">Guidance</h2>
<h2 class="card__title">{{ t("Guidance") }}</h2>
<div class="field">
<textarea class="textarea" name="guidance" rows="4"
placeholder="- Use the GitHub tools for anything about our repositories."
placeholder="{{ t('- Use the GitHub tools for anything about our repositories.') }}"
>{{ server.guidance }}</textarea>
<p class="field__hint">
Added to the system message whenever any tool from this server is
@@ -170,18 +164,18 @@
</section>
<section class="card">
<h2 class="card__title">Availability</h2>
<h2 class="card__title">{{ t("Availability") }}</h2>
<div class="field">
<div class="checkbox-row">
<label class="checkbox">
<input type="checkbox" name="enabled" value="true" {{ 'checked' if server.enabled }}>
<span>Enabled — offered in chats</span>
<span>{{ t("Enabled — offered in chats") }}</span>
</label>
<label class="checkbox">
<input type="checkbox" name="allow_private" value="true"
{{ 'checked' if server.allow_private }}>
<span>May reach private and loopback addresses</span>
<span>{{ t("May reach private and loopback addresses") }}</span>
</label>
</div>
<p class="field__hint">
@@ -193,12 +187,12 @@
<div class="field">
<label class="checkbox">
<input type="checkbox" name="public" value="true" {{ 'checked' if server.public }}>
<span>Available to everyone</span>
<span>{{ t("Available to everyone") }}</span>
</label>
</div>
<div class="field">
<span class="field__label">Groups with access</span>
<span class="field__label">{{ t("Groups with access") }}</span>
{% if groups %}
<div class="checkbox-row">
{% for group in groups %}
@@ -209,7 +203,7 @@
</label>
{% endfor %}
</div>
<p class="field__hint">Ignored while the server is available to everyone.</p>
<p class="field__hint">{{ t("Ignored while the server is available to everyone.") }}</p>
{% else %}
<p class="field__hint">
No groups yet — <a href="/admin/groups">create one</a> to restrict access.
@@ -218,7 +212,7 @@
</div>
<div class="field">
<label class="field__label" for="position">Position</label>
<label class="field__label" for="position">{{ t("Position") }}</label>
<input class="input" id="position" name="position" value="{{ server.position }}"
inputmode="numeric">
</div>
@@ -232,9 +226,7 @@
{% if not is_new %}
<button class="btn btn--danger" type="submit" formnovalidate
formaction="/admin/mcp/{{ server.id }}/delete"
data-confirm-button="Delete the server “{{ server.name }}”? Chats that used its tools keep their transcripts.">
Delete
</button>
data-confirm-button="Delete the server “{{ server.name }}”? Chats that used its tools keep their transcripts.">{{ t("Delete") }}</button>
{% endif %}
</div>
</form>