Send the remaining interface text through the catalog and audit it
Phase 4f. - scripts/i18nAudit.mjs runs in pnpm check. It fails for a key that the catalog does not have, a catalog key that the code does not use, and a row without all four languages. - message() marks a key that a variable carries to the translation call later: table formats, formula errors, and browser status messages. - 53 new rows with French, Japanese, and Simplified Chinese text for the status and error messages of the workbench, the tree, Settings, theme import, images, the built-in browser, and code blocks. The backlinks toggle now translates too. - 13 unused rows are gone. - Errors of the plugin API stay in English. docs/development.md has the rule in "Interface text". pnpm check, pnpm test (350 of 350), and the full smoke suite pass, except two tests that failed one time under load and passed on retry and 3 of 3 times alone.
This commit is contained in:
@@ -166,14 +166,14 @@
|
||||
for (const path of linkCandidates(buffer.relPath, image.dataset.mdSrc || "", "md")) {
|
||||
try { await workspaceReadDataUrl(path); await workspaceReveal(path); return; } catch { /* Try the workspace-relative image. */ }
|
||||
}
|
||||
throw new Error("Could not find this image in the workspace.");
|
||||
throw new Error($t("Could not find this image in the workspace."));
|
||||
},
|
||||
validate: async source => {
|
||||
if (isRemoteImage(source)) return;
|
||||
for (const path of linkCandidates(buffer.relPath, source, "md")) {
|
||||
try { await workspaceReadDataUrl(path); return; } catch { /* Try the workspace-relative image. */ }
|
||||
}
|
||||
throw new Error("Choose an image that exists in the workspace.");
|
||||
throw new Error($t("Choose an image that exists in the workspace."));
|
||||
},
|
||||
report: message => { error = message; },
|
||||
}),
|
||||
|
||||
@@ -29,7 +29,7 @@ export function codeMenu(view: EditorView, report: (message: string) => void) {
|
||||
try {
|
||||
if (kind === "paste") replace(await navigator.clipboard.readText());
|
||||
else { await navigator.clipboard.writeText(selected); if (kind === "cut") replace(""); }
|
||||
} catch { report("Clipboard unavailable. Use the keyboard shortcut to copy, cut, or paste."); }
|
||||
} catch { report(tr("Clipboard unavailable. Use the keyboard shortcut to copy, cut, or paste.")); }
|
||||
};
|
||||
const changeAll = () => {
|
||||
if (!valid() || !word) return;
|
||||
|
||||
@@ -24,7 +24,7 @@ async function copyImage(image: HTMLImageElement) {
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.width = image.naturalWidth; canvas.height = image.naturalHeight;
|
||||
const context = canvas.getContext("2d");
|
||||
if (!context) throw new Error("Image clipboard is unavailable.");
|
||||
if (!context) throw new Error(tr("Image clipboard is unavailable."));
|
||||
context.drawImage(image, 0, 0);
|
||||
return await new Promise<Blob>((resolve, reject) => canvas.toBlob(blob => blob ? resolve(blob) : reject(new Error("Could not copy image.")), "image/png"));
|
||||
})();
|
||||
|
||||
@@ -77,7 +77,7 @@ export function markdownMenu(editor: MarkdownMenuEditor, actions: TableContextAc
|
||||
if (!value) value = await navigator.clipboard.readText();
|
||||
if (value) apply(replacement(selection, value.replace(/\r?\n/g, source.includes("\r\n") ? "\r\n" : "\n")));
|
||||
}
|
||||
} catch { report("Clipboard unavailable. Use the keyboard shortcut to copy, cut, or paste."); }
|
||||
} catch { report(tr("Clipboard unavailable. Use the keyboard shortcut to copy, cut, or paste.")); }
|
||||
});
|
||||
}
|
||||
const paragraph = (label: string, style: ParagraphStyle, icon: "bullet" | "number" | "task" | "heading" | "paragraph" | "quote"): ActionMenuItem => ({ label, icon, run: () => apply(paragraphText(source, selection, style)) });
|
||||
@@ -126,7 +126,7 @@ export function markdownMenu(editor: MarkdownMenuEditor, actions: TableContextAc
|
||||
if (!suggestions.length) suggestions.push({ label: tr("No spelling suggestions"), disabled: true });
|
||||
suggestions.push({ label: tr("Add to dictionary"), icon: "book", run: () => {
|
||||
close();
|
||||
void invoke("spelling_suggestions", { word: word.word, languages: [result.language], add: true }).catch(() => report("Could not add the word to the dictionary."));
|
||||
void invoke("spelling_suggestions", { word: word.word, languages: [result.language], add: true }).catch(() => report(tr("Could not add the word to the dictionary.")));
|
||||
} });
|
||||
const focusedLabel = opened.element.contains(document.activeElement) ? document.activeElement?.querySelector(".action-label")?.textContent : undefined;
|
||||
opened.close();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { tr } from '../i18n/index.ts';
|
||||
import { message, tr } from '../i18n/index.ts';
|
||||
import { getMarkRange, type Editor, type JSONContent } from "@tiptap/core";
|
||||
import { requestText } from "../workspace/dialogs.svelte";
|
||||
import { extractedCellMarkdown } from "./tableCellMarkdown";
|
||||
@@ -14,8 +14,8 @@ export type TableContextActions = {
|
||||
};
|
||||
|
||||
export const cellFormats = [
|
||||
["Bold", "bold"], ["Italic", "italic"], ["Strikethrough", "strike"], ["Highlight", "highlight"],
|
||||
["Code", "code"], ["Math", "math"], ["Comment", "comment"], ["Clear formatting", "clear"],
|
||||
[message("Bold"), "bold"], [message("Italic"), "italic"], [message("Strikethrough"), "strike"], [message("Highlight"), "highlight"],
|
||||
[message("Code"), "code"], [message("Math"), "math"], [message("Comment"), "comment"], [message("Clear formatting"), "clear"],
|
||||
] as const;
|
||||
|
||||
export function tableTextItems(editor: Editor, actions: TableContextActions, close: () => void, transaction: (run: () => void) => void, pending: (value: boolean) => void, report: (message: string) => void, editSource: (range: { from: number; to: number }) => void): ActionMenuItem[] {
|
||||
|
||||
Reference in New Issue
Block a user