Korrespond: stop mixing UI languages — all chrome follows user UI lang

Drafts still come back in Norwegian + working language (that is intentional),
but every piece of *chrome* now respects the user's UI lang consistently:

- Pass 1 classify LLM now writes missing-fact questions in the user's language
  (not always Norwegian), fixing the case where an English-UI user got "Hva er
  saksnummeret?" in the clarify panel.
- All PHP-emitted progress/status messages go through DbnKorrespondAgent::L()
  with en/no/pl/uk variants instead of hardcoded Norwegian.
- JS introduces an I18N dictionary + t() helper covering status messages,
  button labels, column headers, flag labels, refine panel title/hint,
  jurisdiction radio labels, clarify panel title/hint/buttons, the empty-state
  "Ready" block, and Copy/Copied/Download .txt.
- Static clarify and empty-state chrome use [data-i18n] attributes resolved at
  init and re-applied on every lang-switcher click.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-19 12:11:16 +02:00
parent 5d8ae6b447
commit dfb9692f45
4 changed files with 256 additions and 87 deletions
+6 -6
View File
@@ -118,19 +118,19 @@ require_once __DIR__ . '/includes/layout.php';
<!-- Clarify panel (shown if Pass 1 returns missing_facts) -->
<section id="korrClarifyPanel" class="korr-clarify-panel is-hidden" aria-labelledby="korrClarifyTitle">
<h3 id="korrClarifyTitle">Before we draft, clarify:</h3>
<p class="upload-hint">Answer what you can, then click <em>Continue draft</em>. Or click <em>Draft anyway</em> to proceed with what we have.</p>
<h3 id="korrClarifyTitle" data-i18n="clarify_title">Before we draft, clarify:</h3>
<p class="upload-hint" data-i18n="clarify_hint">Answer what you can, then click Continue draft. Or click Draft anyway to proceed with what we have.</p>
<div id="korrClarifyList" class="korr-clarify-list"></div>
<div class="korr-clarify-actions">
<button type="button" id="korrClarifyContinue" class="primary-button">Continue draft</button>
<button type="button" id="korrClarifyForce" class="secondary-button">Draft anyway</button>
<button type="button" id="korrClarifyContinue" class="primary-button" data-i18n="clarify_continue">Continue draft</button>
<button type="button" id="korrClarifyForce" class="secondary-button" data-i18n="clarify_force">Draft anyway</button>
</div>
</section>
<section id="korrResults" class="results deep-research-results" aria-live="polite">
<div class="empty-state">
<h3>Ready</h3>
<p>Pick a recipient body, describe the situation, choose an output type and tone, then run. Drafts always come back in Norwegian bokmål + your working language, side-by-side, with verified law citations.</p>
<h3 data-i18n="ready_title">Ready</h3>
<p data-i18n="ready_desc">Pick a recipient body, describe the situation, choose an output type and tone, then run. Drafts always come back in Norwegian bokmål + your working language, side-by-side, with verified law citations.</p>
</div>
</section>