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 @@
|
|||
* version, or the last engine error.
|
||||
*/
|
||||
import { computed } from "vue";
|
||||
import { t } from "../i18n";
|
||||
import { useAppStore } from "../stores/app";
|
||||
|
||||
const app = useAppStore();
|
||||
|
|
@ -13,7 +14,7 @@ const label = computed(() => {
|
|||
if (app.lastError) {
|
||||
return app.lastError.message;
|
||||
}
|
||||
return app.about ? `${app.about.name} ${app.about.version}` : "";
|
||||
return app.about ? t("app.statusBar.version", { name: app.about.name, version: app.about.version }) : "";
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
* placeholder without touching the layout.
|
||||
*/
|
||||
import { ref } from "vue";
|
||||
import { t } from "../../i18n";
|
||||
import ProjectToolWindow from "../project/ProjectToolWindow.vue";
|
||||
import StatusBar from "../StatusBar.vue";
|
||||
import ToolWindow from "./ToolWindow.vue";
|
||||
|
|
@ -23,7 +24,7 @@ const leftOpen = ref(true);
|
|||
<ToolWindow
|
||||
v-model:width="leftWidth"
|
||||
v-model:open="leftOpen"
|
||||
title="Project"
|
||||
:title="t('project.toolWindow.title')"
|
||||
>
|
||||
<ProjectToolWindow />
|
||||
</ToolWindow>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
*/
|
||||
import { PanelLeftClose, PanelLeftOpen } from "@lucide/vue";
|
||||
import { computed } from "vue";
|
||||
import { t } from "../../i18n";
|
||||
|
||||
/** Props of the tool window. */
|
||||
const props = withDefaults(
|
||||
|
|
@ -105,8 +106,8 @@ function onSplitterKey(event: KeyboardEvent): void {
|
|||
<button
|
||||
type="button"
|
||||
class="tool-window__button"
|
||||
:title="`Hide ${title}`"
|
||||
:aria-label="`Hide ${title}`"
|
||||
:title="t('common.toolWindow.hide', { title })"
|
||||
:aria-label="t('common.toolWindow.hide', { title })"
|
||||
data-test="tool-window-hide"
|
||||
@click="emit('update:open', false)"
|
||||
>
|
||||
|
|
@ -124,7 +125,7 @@ function onSplitterKey(event: KeyboardEvent): void {
|
|||
:aria-valuenow="width"
|
||||
:aria-valuemin="minWidth"
|
||||
:aria-valuemax="maxWidth"
|
||||
:aria-label="`Resize ${title}`"
|
||||
:aria-label="t('common.toolWindow.resize', { title })"
|
||||
data-test="tool-window-splitter"
|
||||
@pointerdown="onSplitterDown"
|
||||
@keydown="onSplitterKey"
|
||||
|
|
@ -138,8 +139,8 @@ function onSplitterKey(event: KeyboardEvent): void {
|
|||
<button
|
||||
type="button"
|
||||
class="tool-window__button"
|
||||
:title="`Show ${title}`"
|
||||
:aria-label="`Show ${title}`"
|
||||
:title="t('common.toolWindow.show', { title })"
|
||||
:aria-label="t('common.toolWindow.show', { title })"
|
||||
data-test="tool-window-show"
|
||||
@click="emit('update:open', true)"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
import { FolderOpen } from "@lucide/vue";
|
||||
import { onBeforeUnmount, onMounted } from "vue";
|
||||
import { t } from "../../i18n";
|
||||
import { useProjectStore } from "../../stores/project";
|
||||
import ProjectTree from "./ProjectTree.vue";
|
||||
|
||||
|
|
@ -30,7 +31,7 @@ onBeforeUnmount(() => {
|
|||
data-test="project-empty"
|
||||
>
|
||||
<p class="project-view__hint">
|
||||
No folder is open.
|
||||
{{ t("project.empty.noFolder") }}
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
|
|
@ -39,7 +40,7 @@ onBeforeUnmount(() => {
|
|||
@click="project.openFolder()"
|
||||
>
|
||||
<FolderOpen :size="16" />
|
||||
<span>Open Folder…</span>
|
||||
<span>{{ t("project.openFolder") }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<p
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
*/
|
||||
import { ChevronDown, ChevronRight, File, FileCode, Folder, FolderOpen } from "@lucide/vue";
|
||||
import { computed, nextTick, ref } from "vue";
|
||||
import { t } from "../../i18n";
|
||||
import { parentOf, useProjectStore, type TreeRow } from "../../stores/project";
|
||||
import { useEditorStore } from "../../stores/editor";
|
||||
import type { TreeEntry } from "./engineEvents";
|
||||
|
|
@ -283,7 +284,7 @@ function onFocus(): void {
|
|||
:style="{ '--tree-depth': row.depth }"
|
||||
data-test="tree-loading"
|
||||
>
|
||||
Loading…
|
||||
{{ t("project.tree.loading") }}
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue