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
|
|
@ -11,6 +11,7 @@
|
|||
*/
|
||||
import { defineStore } from "pinia";
|
||||
import { computed, ref, shallowRef } from "vue";
|
||||
import { t } from "../i18n";
|
||||
import { run, type EngineError, type RunResult } from "../ipc";
|
||||
import { BufferSync, isBufferInfo, engineTransport, type BufferInfo, type SyncTransport } from "../components/editor/bufferSync";
|
||||
import { onEditorEvent, type EditorEvent } from "../components/editor/engineEvents";
|
||||
|
|
@ -220,7 +221,7 @@ export const useEditorStore = defineStore("editor", () => {
|
|||
return;
|
||||
}
|
||||
if (!isBufferInfo(result.value)) {
|
||||
lastError.value = { code: "ipc", message: `unexpected result of ${EDITOR_COMMANDS.open}` };
|
||||
lastError.value = { code: "ipc", message: t("common.error.unexpectedResult", { command: EDITOR_COMMANDS.open }) };
|
||||
return;
|
||||
}
|
||||
lastError.value = null;
|
||||
|
|
@ -373,7 +374,7 @@ export const useEditorStore = defineStore("editor", () => {
|
|||
? {
|
||||
code: "save_failed",
|
||||
message: failed
|
||||
.map((f) => (typeof f.message === "string" ? f.message : "save failed"))
|
||||
.map((f) => (typeof f.message === "string" ? f.message : t("editor.saveFailed")))
|
||||
.join("; "),
|
||||
}
|
||||
: null;
|
||||
|
|
@ -459,12 +460,12 @@ export const useEditorStore = defineStore("editor", () => {
|
|||
if (event.removed) {
|
||||
tab.notice = {
|
||||
kind: "removedOnDisk",
|
||||
message: `${tab.name} was deleted on disk. Your text is kept; saving writes it again.`,
|
||||
message: t("editor.notice.removedOnDisk", { name: tab.name }),
|
||||
};
|
||||
} else {
|
||||
tab.notice = {
|
||||
kind: "changedOnDisk",
|
||||
message: `${tab.name} changed on disk. Your unsaved changes are kept; saving overwrites the file.`,
|
||||
message: t("editor.notice.changedOnDisk", { name: tab.name }),
|
||||
};
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
import { defineStore } from "pinia";
|
||||
import { computed, ref } from "vue";
|
||||
import { t } from "../i18n";
|
||||
import { run, type EngineError } from "../ipc";
|
||||
import {
|
||||
onEngineEvent,
|
||||
|
|
@ -156,7 +157,7 @@ export const useProjectStore = defineStore("project", () => {
|
|||
prune(dir, listing.entries);
|
||||
} else {
|
||||
const error = result.ok
|
||||
? { code: "ipc", message: `unexpected result of ${PROJECT_COMMANDS.children}` }
|
||||
? { code: "ipc", message: t("common.error.unexpectedResult", { command: PROJECT_COMMANDS.children }) }
|
||||
: result.error;
|
||||
dirs.value[dir] = { entries: cachedEntries(dir), loading: false, error, truncated };
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue