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
+5 -2
View File
@@ -108,7 +108,10 @@ try {
$attachmentsText .= "\n\n--- " . $extracted['filename'] . " ---\n\n" . $extracted['text'];
}
$emit('progress', [
'detail' => sprintf('Lest %s (%d tegn)', $extracted['filename'], $extracted['chars']),
'detail' => DbnKorrespondAgent::L('file_read', $language, [
'name' => $extracted['filename'],
'chars' => $extracted['chars'],
]),
]);
}
}
@@ -137,7 +140,7 @@ try {
]);
// ── Pass 1: classify + gap-check ────────────────────────────────────────────
$emit('progress', ['detail' => 'Analyserer situasjonen…']);
$emit('progress', ['detail' => DbnKorrespondAgent::L('analyzing', $language)]);
$agent = new DbnKorrespondAgent();
$classify = $agent->classify($intake);
$emit('classify', ['result' => [