M1.11: English message catalog for every UI string
ui/src/i18n: en.json (20 flat dotted keys) and t(key, params?) with
{name} interpolation; a missing key warns in dev and returns the key.
All template text, title/aria-label attributes, notices and frontend
error texts go through t. ESLint vue/no-bare-strings-in-template is an
error. Catalog tests: interpolation, missing key, every t() key exists,
no unused keys. Engine messages stay English (G14). Docs updated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
851d438e2a
commit
7c0fb312f6
21 changed files with 273 additions and 37 deletions
|
|
@ -4,6 +4,7 @@
|
|||
* Don't Save or Cancel. Escape cancels; Save has the focus.
|
||||
*/
|
||||
import { nextTick, ref, watch } from "vue";
|
||||
import { t } from "../../i18n";
|
||||
import { useEditorStore } from "../../stores/editor";
|
||||
|
||||
const editor = useEditorStore();
|
||||
|
|
@ -52,7 +53,7 @@ function onKeydown(event: KeyboardEvent): void {
|
|||
id="lt-close-prompt-title"
|
||||
class="close-prompt__text"
|
||||
>
|
||||
Save changes to {{ editor.closePrompt.name }} before closing?
|
||||
{{ t("editor.closePrompt.question", { name: editor.closePrompt.name }) }}
|
||||
</p>
|
||||
<div class="close-prompt__buttons">
|
||||
<button
|
||||
|
|
@ -62,7 +63,7 @@ function onKeydown(event: KeyboardEvent): void {
|
|||
data-test="close-save"
|
||||
@click="editor.resolveClose('save')"
|
||||
>
|
||||
Save
|
||||
{{ t("common.save") }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
|
|
@ -70,7 +71,7 @@ function onKeydown(event: KeyboardEvent): void {
|
|||
data-test="close-discard"
|
||||
@click="editor.resolveClose('discard')"
|
||||
>
|
||||
Don't Save
|
||||
{{ t("common.dontSave") }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
|
|
@ -78,7 +79,7 @@ function onKeydown(event: KeyboardEvent): void {
|
|||
data-test="close-cancel"
|
||||
@click="editor.resolveClose('cancel')"
|
||||
>
|
||||
Cancel
|
||||
{{ t("common.cancel") }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
* CodeMirror has the focus.
|
||||
*/
|
||||
import { onBeforeUnmount, onMounted } from "vue";
|
||||
import { t } from "../../i18n";
|
||||
import { useEditorStore } from "../../stores/editor";
|
||||
import ClosePrompt from "./ClosePrompt.vue";
|
||||
import CodeEditor from "./CodeEditor.vue";
|
||||
|
|
@ -83,7 +84,7 @@ onBeforeUnmount(() => {
|
|||
data-test="notice-dismiss"
|
||||
@click="editor.dismissNotice(editor.activeTab.id)"
|
||||
>
|
||||
Dismiss
|
||||
{{ t("common.dismiss") }}
|
||||
</button>
|
||||
</div>
|
||||
<CodeEditor />
|
||||
|
|
@ -106,7 +107,7 @@ onBeforeUnmount(() => {
|
|||
class="editor-area__dismiss"
|
||||
@click="editor.lastError = null"
|
||||
>
|
||||
Dismiss
|
||||
{{ t("common.dismiss") }}
|
||||
</button>
|
||||
</div>
|
||||
<ClosePrompt />
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
* dirty tab asks first (see the editor store).
|
||||
*/
|
||||
import { X } from "@lucide/vue";
|
||||
import { t } from "../../i18n";
|
||||
import { useEditorStore } from "../../stores/editor";
|
||||
|
||||
const editor = useEditorStore();
|
||||
|
|
@ -47,7 +48,7 @@ function onKeydown(event: KeyboardEvent): void {
|
|||
<div
|
||||
class="tabs"
|
||||
role="tablist"
|
||||
aria-label="Editor tabs"
|
||||
:aria-label="t('editor.tabs.label')"
|
||||
data-test="editor-tabs"
|
||||
@keydown="onKeydown"
|
||||
>
|
||||
|
|
@ -70,14 +71,14 @@ function onKeydown(event: KeyboardEvent): void {
|
|||
<span
|
||||
v-if="tab.dirty"
|
||||
class="tabs__dirty"
|
||||
aria-label="unsaved changes"
|
||||
:aria-label="t('editor.tabs.unsaved')"
|
||||
data-test="tab-dirty"
|
||||
/>
|
||||
<button
|
||||
class="tabs__close"
|
||||
type="button"
|
||||
tabindex="-1"
|
||||
:aria-label="`Close ${tab.name}`"
|
||||
:aria-label="t('editor.tabs.close', { name: tab.name })"
|
||||
data-test="tab-close"
|
||||
@click.stop="editor.requestClose(tab.id)"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import {
|
|||
type TransactionSpec,
|
||||
} from "@codemirror/state";
|
||||
import type { EditorView } from "@codemirror/view";
|
||||
import { t } from "../../i18n";
|
||||
import { run, type EngineError, type RunResult } from "../../ipc";
|
||||
import { diffDocs, EngineText, separatorOf, type EngineEdit } from "./engineText";
|
||||
|
||||
|
|
@ -333,7 +334,7 @@ export class BufferSync {
|
|||
}
|
||||
if (!result.ok || !isBufferInfo(result.value)) {
|
||||
this.onError(
|
||||
result.ok ? { code: "ipc", message: "unexpected result of buffer.get" } : result.error,
|
||||
result.ok ? { code: "ipc", message: t("common.error.unexpectedResult", { command: "buffer.get" }) } : result.error,
|
||||
);
|
||||
this.settle(true);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
* with context (the active buffer): saving, saving all and closing a tab.
|
||||
* Nothing here hard-codes a key.
|
||||
*/
|
||||
import { t } from "../../i18n";
|
||||
import { listCommands, type CommandInfo, type RunResult } from "../../ipc";
|
||||
|
||||
/** Engine commands the editor area runs with the active buffer as context. */
|
||||
|
|
@ -126,7 +127,7 @@ export async function loadEditorKeymap(mac = isMac()): Promise<RunResult<EditorK
|
|||
}
|
||||
const list: unknown = result.value;
|
||||
if (!Array.isArray(list)) {
|
||||
return { ok: false, error: { code: "ipc", message: "unexpected result of listCommands" } };
|
||||
return { ok: false, error: { code: "ipc", message: t("common.error.unexpectedResult", { command: "listCommands" }) } };
|
||||
}
|
||||
const commands = (list as unknown[]).filter(
|
||||
(c): c is CommandInfo => typeof c === "object" && c !== null && "id" in c,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue