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:
@@ -51,19 +51,17 @@
|
||||
<div class="page">
|
||||
<form hx-patch="/api/folders/{{ folder.id }}" hx-swap="none">
|
||||
<div class="card">
|
||||
<h2 class="card__title">Name</h2>
|
||||
<h2 class="card__title">{{ t("Name") }}</h2>
|
||||
<div class="field">
|
||||
<input class="input" type="text" name="name" maxlength="200"
|
||||
value="{{ folder.name }}" aria-label="Folder name" required>
|
||||
value="{{ folder.name }}" aria-label="{{ t('Folder name') }}" required>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="field__label" for="folder-description">Description</label>
|
||||
<label class="field__label" for="folder-description">{{ t("Description") }}</label>
|
||||
<input class="input" type="text" id="folder-description" name="description"
|
||||
maxlength="500" value="{{ folder.description }}"
|
||||
placeholder="What this folder is for.">
|
||||
<p class="field__hint">
|
||||
For you, not for any model. It is never sent anywhere.
|
||||
</p>
|
||||
placeholder="{{ t('What this folder is for.') }}">
|
||||
<p class="field__hint">{{ t("For you, not for any model. It is never sent anywhere.") }}</p>
|
||||
</div>
|
||||
{#
|
||||
Nesting has worked at the route since folders existed -- with a cycle
|
||||
@@ -77,9 +75,9 @@
|
||||
route will reject is a control that looks like it works.
|
||||
#}
|
||||
<div class="field">
|
||||
<label class="field__label" for="folder-parent">Inside</label>
|
||||
<label class="field__label" for="folder-parent">{{ t("Inside") }}</label>
|
||||
<select class="select" id="folder-parent" name="parent_id">
|
||||
<option value="">Nothing — a folder at the top</option>
|
||||
<option value="">{{ t("Nothing — a folder at the top") }}</option>
|
||||
{% for candidate in parents %}
|
||||
<option value="{{ candidate.id }}"
|
||||
{{ 'selected' if folder.parent_id == candidate.id }}>
|
||||
@@ -87,43 +85,29 @@
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<p class="field__hint">
|
||||
A folder inside another inherits its system prompt where it has
|
||||
none of its own.
|
||||
</p>
|
||||
<p class="field__hint">{{ t("A folder inside another inherits its system prompt where it has none of its own.") }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2 class="card__title">System prompt</h2>
|
||||
<p class="card__lede">
|
||||
Used by every chat in this folder, and by folders nested inside it,
|
||||
unless the chat has a prompt of its own. Read each time a reply is
|
||||
built rather than copied when a chat is made, so editing this
|
||||
reaches the chats already here.
|
||||
</p>
|
||||
<h2 class="card__title">{{ t("System prompt") }}</h2>
|
||||
<p class="card__lede">{{ t("Used by every chat in this folder, and by folders nested inside it, unless the chat has a prompt of its own. Read each time a reply is built rather than copied when a chat is made, so editing this reaches the chats already here.") }}</p>
|
||||
<div class="field">
|
||||
<textarea class="textarea" name="system_prompt" rows="8"
|
||||
aria-label="System prompt"
|
||||
placeholder="Leave empty to fall through to the model's prompt, then the instance's.">{{ folder.system_prompt }}</textarea>
|
||||
<p class="field__hint">
|
||||
Precedence, not concatenation: chat, then folder, then model, then
|
||||
instance. The most specific one wins outright.
|
||||
</p>
|
||||
aria-label="{{ t('System prompt') }}"
|
||||
placeholder="{{ t('Leave empty to fall through to the model\'s prompt, then the instance\'s.') }}">{{ folder.system_prompt }}</textarea>
|
||||
<p class="field__hint">{{ t("Precedence, not concatenation: chat, then folder, then model, then instance. The most specific one wins outright.") }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2 class="card__title">What a new chat starts as</h2>
|
||||
<p class="card__lede">
|
||||
Seeds, copied onto a chat when it is created and its own from then
|
||||
on. Anything chosen on the new-chat screen wins over these.
|
||||
</p>
|
||||
<h2 class="card__title">{{ t("What a new chat starts as") }}</h2>
|
||||
<p class="card__lede">{{ t("Seeds, copied onto a chat when it is created and its own from then on. Anything chosen on the new-chat screen wins over these.") }}</p>
|
||||
|
||||
<div class="field">
|
||||
<label class="field__label" for="folder-model">Model</label>
|
||||
<label class="field__label" for="folder-model">{{ t("Model") }}</label>
|
||||
<select class="select" id="folder-model" name="model_id">
|
||||
<option value="">No opinion</option>
|
||||
<option value="">{{ t("No opinion") }}</option>
|
||||
{% for model in models %}
|
||||
<option value="{{ model.model_id }}"
|
||||
{{ 'selected' if model.model_id == folder.model_id }}>
|
||||
@@ -134,16 +118,13 @@
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label class="field__label" for="folder-kind">Kind</label>
|
||||
<label class="field__label" for="folder-kind">{{ t("Kind") }}</label>
|
||||
<select class="select" id="folder-kind" name="kind">
|
||||
<option value="" {{ 'selected' if not folder.kind }}>No opinion</option>
|
||||
<option value="chat" {{ 'selected' if folder.kind == 'chat' }}>Chat</option>
|
||||
<option value="agent" {{ 'selected' if folder.kind == 'agent' }}>Agent chat</option>
|
||||
<option value="" {{ 'selected' if not folder.kind }}>{{ t("No opinion") }}</option>
|
||||
<option value="chat" {{ 'selected' if folder.kind == 'chat' }}>{{ t("Chat") }}</option>
|
||||
<option value="agent" {{ 'selected' if folder.kind == 'agent' }}>{{ t("Agent chat") }}</option>
|
||||
</select>
|
||||
<p class="field__hint">
|
||||
A folder set to one kind shows on only that side of the sidebar's
|
||||
switch, and opens the new-chat screen already on that fork.
|
||||
</p>
|
||||
<p class="field__hint">{{ t("A folder set to one kind shows on only that side of the sidebar's switch, and opens the new-chat screen already on that fork.") }}</p>
|
||||
</div>
|
||||
|
||||
{% if agent_profiles %}
|
||||
@@ -152,9 +133,9 @@
|
||||
too, and a field that appears only once another field is right is a
|
||||
field people conclude is missing. #}
|
||||
<div class="field">
|
||||
<label class="field__label" for="folder-profile">Connection</label>
|
||||
<label class="field__label" for="folder-profile">{{ t("Connection") }}</label>
|
||||
<select class="select" id="folder-profile" name="ssh_profile_id">
|
||||
<option value="">No opinion</option>
|
||||
<option value="">{{ t("No opinion") }}</option>
|
||||
{% for profile in agent_profiles %}
|
||||
<option value="{{ profile.id }}"
|
||||
{{ 'selected' if profile.id == folder.ssh_profile_id }}>
|
||||
@@ -169,12 +150,12 @@
|
||||
path is something you would rather find than spell. `data-dir-field`
|
||||
is what wires it; see ui.js. #}
|
||||
<div class="field" data-dir-field>
|
||||
<span class="field__label">Project directory</span>
|
||||
<span class="field__label">{{ t("Project directory") }}</span>
|
||||
<input type="hidden" name="project_dir"
|
||||
value="{{ folder.project_dir }}" data-dir-value>
|
||||
<div class="dir-row">
|
||||
<button class="btn" type="button" data-dir-browse
|
||||
aria-label="Choose the project directory">
|
||||
aria-label="{{ t('Choose the project directory') }}">
|
||||
{{ icon("folder", "icon--sm") }}
|
||||
<span class="dir-row__path" data-dir-label>
|
||||
{{ folder.project_dir or "the connection's own default" }}
|
||||
@@ -184,20 +165,18 @@
|
||||
directory and then changing your mind before saving needs a way
|
||||
back to "no opinion" as much as clearing a saved one does. #}
|
||||
<button class="btn btn--icon" type="button" data-dir-clear
|
||||
aria-label="Clear the project directory" title="No opinion">
|
||||
aria-label="{{ t('Clear the project directory') }}" title="{{ t('No opinion') }}">
|
||||
{{ icon("x", "icon--sm") }}
|
||||
</button>
|
||||
</div>
|
||||
<p class="field__hint">
|
||||
What a relative path is measured from in chats started here.
|
||||
</p>
|
||||
<p class="field__hint">{{ t("What a relative path is measured from in chats started here.") }}</p>
|
||||
</div>
|
||||
|
||||
{% if agent_modes %}
|
||||
<div class="field">
|
||||
<label class="field__label" for="folder-mode">Approval mode</label>
|
||||
<label class="field__label" for="folder-mode">{{ t("Approval mode") }}</label>
|
||||
<select class="select" id="folder-mode" name="agent_mode">
|
||||
<option value="">No opinion</option>
|
||||
<option value="">{{ t("No opinion") }}</option>
|
||||
{% for value, label, hint in agent_modes %}
|
||||
<option value="{{ value }}" title="{{ hint }}"
|
||||
{{ 'selected' if value == folder.agent_mode }}>{{ label }}</option>
|
||||
|
||||
Reference in New Issue
Block a user