The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.
TypeScript code-editorcross-platformdapdatabase-clientdebuggerdesktop-appdeveloper-toolsgithttp-clientideintellijlsprusttauriterminal
fix(i18n): Translate interpolated UI text through a tx template tag (#98)
l0ng-ai8568ff001baf
diff --git a/src/editor/core/actions.ts b/src/editor/core/actions.tsindex be34d9d9f..cbfa16f6a 100644--- a/src/editor/core/actions.ts+++ b/src/editor/core/actions.ts@@ -54,6 +54,7 @@ import {} from "./cm/structural";import type { DocModel } from "./model/document";import { structure } from "@/editor/structure";+import { tx } from "@/platform/i18n";/** Text-editing actions: the editor has focus, or a popup (Find Action) runs them on it. */export const TEXT_WHEN = "editorTextFocus || textEditorActive && popupOpen";@@ -293,7 +294,7 @@ function copyReference(view: EditorView, slot: EditorSlot) {});recordClipboard(reference);void navigator.clipboard?.writeText(reference).catch(() => {});- void executeAction("editor.showHint", { text: `Copied reference: ${reference}` });+ void executeAction("editor.showHint", { text: tx`Copied reference: ${reference}` });}/** ⌃G; when nothing more is found, a hint first and the search from the top on the next press (IDEA). */diff --git a/src/editor/core/clipboardHistory.ts b/src/editor/core/clipboardHistory.tsindex 997d31112..640c0b53f 100644--- a/src/editor/core/clipboardHistory.ts+++ b/src/editor/core/clipboardHistory.ts@@ -5,6 +5,7 @@*/import { EditorView } from "@codemirror/view";import type { EditorState } from "@codemirror/state";+import { tx } from "@/platform/i18n";export const MAX_CLIPBOARD_ENTRIES = 30;@@ -45,7 +46,7 @@ export function clipLabel(text: string, max = 80): { label: string; detail: striconst first = (lines.find((l) => l.trim()) ?? "").trim();const label = first.length > max ? `${first.slice(0, max - 1)}…` : first || "(whitespace)";const count = text.endsWith("\n") ? lines.length - 1 : lines.length;- return { label, detail: count > 1 ? `${count} lines` : undefined };+ return { label, detail: count > 1 ? tx`${count} lines` : undefined };}export const clipboardHistoryExtension = EditorView.domEventHandlers({diff --git a/src/editor/core/cm/preview.ts b/src/editor/core/cm/preview.tsindex 0d20fd5b3..86fd2fb35 100644--- a/src/editor/core/cm/preview.ts+++ b/src/editor/core/cm/preview.ts@@ -12,6 +12,7 @@ import { openideaHighlightStyle } from "./highlight";import { openideaTheme } from "./theme";import { findLanguageDescription, loadSupport, loadedSupport, uiModeForPath } from "./languages";import { fontExtension } from "./setup";+import { tx } from "@/platform/i18n";export async function previewExtensions(path: string, settings: EditorSettings | undefined): Promise<Extension> {const open = editorsFor(path)[0]?.ctx;@@ -25,7 +26,7 @@ export async function previewExtensions(path: string, settings: EditorSettings |syntaxHighlighting(openideaHighlightStyle),EditorState.readOnly.of(true),EditorView.editable.of(false),- EditorView.contentAttributes.of({ "aria-label": `Preview of ${path}` }),+ EditorView.contentAttributes.of({ "aria-label": tx`Preview of ${path}` }),support ?? [],];}diff --git a/src/editor/core/cm/setup.ts b/src/editor/core/cm/setup.tsindex b25a4184f..0fadf9218 100644--- a/src/editor/core/cm/setup.ts+++ b/src/editor/core/cm/setup.ts@@ -51,6 +51,7 @@ import { gutterLineDrag } from "./gutterDrag";import { overwriteField } from "./overwrite";import { clipboardHistoryExtension } from "../clipboardHistory";import type { LanguageInfo } from "../backend";+import { tx } from "@/platform/i18n";export const compartments = {language: new Compartment(),@@ -309,7 +310,7 @@ export function baseExtensions(o: SetupOptions): Extension {findExtension(),overviewLane,codeLensExtension,- EditorView.contentAttributes.of({ spellcheck: "false", autocorrect: "off", autocapitalize: "off", "aria-label": `Editor for ${o.ctx.path}` }),+ EditorView.contentAttributes.of({ spellcheck: "false", autocorrect: "off", autocapitalize: "off", "aria-label": tx`Editor for ${o.ctx.path}` }),tabKeymap,keymap.of([...closeBracketsKeymap, ...editorBaseKeymap, indentWithTab]),compartments.language.of(o.language ?? []),diff --git a/src/editor/core/cm/unwrap.ts b/src/editor/core/cm/unwrap.tsindex 197119178..9a221b18b 100644--- a/src/editor/core/cm/unwrap.ts+++ b/src/editor/core/cm/unwrap.ts@@ -5,6 +5,7 @@* every language with a grammar is covered.*/import type { Text } from "@codemirror/state";+import { tx } from "@/platform/i18n";export interface ChainNode {kind: string;@@ -133,7 +134,7 @@ export function unwrapOptions(doc: Text, chain: readonly ChainNode[]): UnwrapOptconst key = `${target.from}:${target.to}:${label}`;if (seen.has(key)) continue;seen.add(key);- out.push({ label: `Unwrap '${label}'`, target: { from: target.from, to: target.to }, ...replacement(doc, target, child) });+ out.push({ label: tx`Unwrap '${label}'`, target: { from: target.from, to: target.to }, ...replacement(doc, target, child) });}return out;}diff --git a/src/editor/core/fileAttributes.ts b/src/editor/core/fileAttributes.tsindex 2888373bd..35794ac45 100644--- a/src/editor/core/fileAttributes.ts+++ b/src/editor/core/fileAttributes.ts@@ -8,11 +8,12 @@ import { basename } from "@/platform/project";import { notifications } from "@/workbench/contributions";import { confirm } from "@/workbench/messages";import type { DocModel } from "./model/document";+import { tx } from "@/platform/i18n";export function readOnlyQuestion(name: string, readOnly: boolean) {return readOnly- ? { title: "Make File Writable", message: `'${name}' is read-only. Make it writable?`, confirm: "Make Writable" }- : { title: "Make File Read-only", message: `Make '${name}' read-only?`, confirm: "Make Read-only" };+ ? { title: "Make File Writable", message: tx`'${name}' is read-only. Make it writable?`, confirm: "Make Writable" }+ : { title: "Make File Read-only", message: tx`Make '${name}' read-only?`, confirm: "Make Read-only" };}/** Applies the toggle without asking. Returns the new read-only state, or null on failure. */diff --git a/src/editor/core/model/document.ts b/src/editor/core/model/document.tsindex af36f5e0f..2550294e5 100644--- a/src/editor/core/model/document.ts+++ b/src/editor/core/model/document.ts@@ -44,6 +44,7 @@ import {} from "../cm/setup";import { setMethodLines, softWrapActive } from "../cm/prefs";import type { EditorSlot } from "./slot";+import { tx } from "@/platform/i18n";export type Banner = "binary" | "tooLarge" | "readOnly" | "library" | null;@@ -237,7 +238,7 @@ export class DocModel {manager.notify({level: "warning",title: "Editor resynchronised",- body: `Some unsaved edits to ${this.path} could not be applied and were replaced by the file's current content.`,+ body: tx`Some unsaved edits to ${this.path} could not be applied and were replaced by the file's current content.`,}),onError: (e) => console.warn(`document ${this.path}: sync error`, e),},diff --git a/src/editor/core/view/EditorArea.tsx b/src/editor/core/view/EditorArea.tsxindex 77c8f0cef..18a223169 100644--- a/src/editor/core/view/EditorArea.tsx+++ b/src/editor/core/view/EditorArea.tsx@@ -44,6 +44,7 @@ import { FindBar } from "./FindBar";import { EditorBanners, VirtualBanner } from "./Banner";import { CodeBreadcrumbs } from "./StatusItems";import styles from "./EditorArea.module.css";+import { tx } from "@/platform/i18n";export function EditorAreaView() {const layout = useTabs((s) => s.layout);@@ -343,7 +344,7 @@ function PaneContent({ paneId, tab }: { paneId: string; tab: Tab }) {);}const kind = kinds.get(tab.input.kind);- if (!kind) return <EmptyState icon="file" title={`No editor for “${tab.input.kind}”`} />;+ if (!kind) return <EmptyState icon="file" title={tx`No editor for “${tab.input.kind}”`} />;const Component = kind.component;return (<div className={styles.kind} data-editor-focus="" tabIndex={-1} key={tab.id}>diff --git a/src/editor/lsp/codeLens.ts b/src/editor/lsp/codeLens.tsindex 136ce82af..1b7772dda 100644--- a/src/editor/lsp/codeLens.ts+++ b/src/editor/lsp/codeLens.ts@@ -16,6 +16,7 @@ import { posToOffset } from "./positions";import { onLspRefresh, serverBackoff } from "./availability";import { editorPrefs } from "@/platform/editorSettings";import { authorLabel, authorSummary, authorTooltip, blameFor, onBlameInvalidated } from "./authorLens";+import { tx } from "@/platform/i18n";const LENS_KINDS = new Set<SymbolKind>(["class",@@ -190,7 +191,7 @@ class UsagesLensPlugin {lenses.push({pos: offset,title: usagesLabel(n),- tooltip: n ? `Show usages of ${t.name}` : undefined,+ tooltip: n ? tx`Show usages of ${t.name}` : undefined,order: 10,run: n ? (v) => openUsages(v, Math.min(offset, v.state.doc.length)) : undefined,});diff --git a/src/editor/lsp/fileReferences.ts b/src/editor/lsp/fileReferences.tsindex a93123526..2ade17424 100644--- a/src/editor/lsp/fileReferences.ts+++ b/src/editor/lsp/fileReferences.ts@@ -14,6 +14,7 @@ import { call, commands, isTauri, onIdeEvent, type PathCompletion } from "@/platimport { fileIconName, folderIconName } from "@/ui";import { setFileDiagnostics } from "./diagnostics";import { docOf, lspDoc } from "./lsp";+import { tx } from "@/platform/i18n";// --- completion ---------------------------------------------------------------@@ -118,7 +119,7 @@ export function unresolvedReferences(): Extension {refs.map((r) => ({range: r.range,severity: "warning",- message: `Cannot resolve file '${r.value}'`,+ message: tx`Cannot resolve file '${r.value}'`,source: doc.language === "html" || doc.language === "vue" || doc.language === "svelte" ? "HTML" : "CSS",code: null,})),diff --git a/src/editor/lsp/format.ts b/src/editor/lsp/format.tsindex 44802b524..013e94e89 100644--- a/src/editor/lsp/format.ts+++ b/src/editor/lsp/format.ts@@ -161,7 +161,7 @@ export async function reformatDialog(const name = ctx.path.slice(ctx.path.lastIndexOf("/") + 1);openPopup({kind: "reformat",- title: `Reformat File: ${name}`,+ title: tx`Reformat File: ${name}`,hasSelection: !sel.empty,canOptimizeImports: !contributedAt(view.state, CONTRIBUTED_FORMAT, 0),initial: lastOptions,diff --git a/src/editor/lsp/inlay.ts b/src/editor/lsp/inlay.tsindex 2fc1cc403..605aa3012 100644--- a/src/editor/lsp/inlay.ts+++ b/src/editor/lsp/inlay.ts@@ -17,6 +17,7 @@ import { debounce, docOf, isUnavailable, lspRequest } from "./lsp";import { offsetsToRange, posToOffset } from "./positions";import { onLspRefresh, serverBackoff } from "./availability";import { gotoTargets } from "./navigation";+import { tx } from "@/platform/i18n";const KIND_LABEL: Record<InlayHint["kind"], string> = {type: "Type hints",@@ -39,7 +40,7 @@ function typeHintOffset(view: EditorView, at: number): number | null {/** Right-click on a hint: turn its kind off (IDEA's "Disable '…' hints"), or open the settings. */export function inlayMenuItems(kind: InlayHint["kind"]): MenuItem[] {return [- { label: `Disable ${KIND_LABEL[kind]}`, run: () => void setEditorSetting(`inlay.${kind}`, false) },+ { label: tx`Disable ${KIND_LABEL[kind]}`, run: () => void setEditorSetting(`inlay.${kind}`, false) },{ kind: "separator" },{ label: "Inlay Hints Settings…", run: () => void executeAction("file.settings", "editor.inlayHints") },];diff --git a/src/editor/lsp/intentions.ts b/src/editor/lsp/intentions.tsindex fb121fe42..f459e77ce 100644--- a/src/editor/lsp/intentions.ts+++ b/src/editor/lsp/intentions.ts@@ -21,6 +21,7 @@ import { spellingIntentions } from "./spelling";import { inspectionsAt } from "./diagnostics";import { SPELLING_INSPECTION } from "@/platform/inspections";import { editInspectionSettings, intentionControls } from "@/platform/inspectionControls";+import { tx } from "@/platform/i18n";const isQuickFix = (a: CodeAction) => !!a.kind && (a.kind === "quickfix" || a.kind.startsWith("quickfix."));@@ -195,7 +196,7 @@ export function withInspectionControls(view: EditorView, items: ListPopupItem[])...items,...inspections.map((inspection) => ({id: `inspection:${inspection.id}`,- label: `Inspection '${inspection.name}' options`,+ label: tx`Inspection '${inspection.name}' options`,icon: "settings",run: () => editInspectionSettings(inspection.id),submenu: intentionControls(inspection),diff --git a/src/editor/lsp/navigation.ts b/src/editor/lsp/navigation.tsindex ee774825a..973893e1e 100644--- a/src/editor/lsp/navigation.ts+++ b/src/editor/lsp/navigation.ts@@ -52,6 +52,7 @@ import { isVirtualUri, virtualContainer } from "@/platform/virtualDocs";import { shortcutLabel } from "@/platform/keymap";import { isNavigationGesture, onNavigationModifier } from "@/platform/navigationModifier";import { create } from "zustand";+import { tx } from "@/platform/i18n";export async function navigateTo(loc: Location) {await editorService().openFile(loc.path, {@@ -224,7 +225,7 @@ async function gotoWebReference(view: EditorView, doc: EditorDocContext, pos: PoopenPopup({kind: "list",anchor: caretAnchor(view, offset),- title: `Choose Declaration of '${label}' (${targets.length} found)`,+ title: tx`Choose Declaration of '${label}' (${targets.length} found)`,items: await locationItems(targets),pin: pinToFind(label, targets),});diff --git a/src/editor/lsp/rename.ts b/src/editor/lsp/rename.tsindex 8ba26c19b..3f4afaefd 100644--- a/src/editor/lsp/rename.ts+++ b/src/editor/lsp/rename.ts@@ -29,6 +29,7 @@ import {renameRisks,type LocalRenamePlan,} from "./syntaxFallback";+import { tx } from "@/platform/i18n";async function applyEdit(view: EditorView, edit: WorkspaceEdit) {try {@@ -83,7 +84,7 @@ export async function startRename(view: EditorView) {openPopup({kind: "rename",anchor: caretAnchor(view, from),- title: `Rename '${oldName}'`,+ title: tx`Rename '${oldName}'`,initial,onSubmit: (newName) => void finishRename(view, doc, pos, oldName, newName),});@@ -99,7 +100,7 @@ export async function startRename(view: EditorView) {startInplaceRename(view, {primary: { from, to },others,- hint: keys ? `Press ${keys} to show dialog with more options` : "Rename in place: ↵ to finish, Esc to cancel",+ hint: keys ? tx`Press ${keys} to show dialog with more options` : "Rename in place: ↵ to finish, Esc to cancel",commit: (newName) => void commitInplace(view, doc, pos, oldName, newName),dialog,});@@ -223,7 +224,7 @@ async function finishRename(view: EditorView, doc: EditorDocContext, pos: Pos, o}openPopup({kind: "preview",- title: `Rename '${oldName}' to '${newName}'`,+ title: tx`Rename '${oldName}' to '${newName}'`,summary,confirmLabel: "Do Refactor",onConfirm: () => void applyEdit(view, edit),@@ -265,7 +266,7 @@ async function startSyntaxRename(view: EditorView, doc: EditorDocContext, pos: PopenPopup({kind: "rename",anchor: caretAnchor(view, rangeToOffsets(view.state.doc, (at ?? plan.occurrences[0]!).range).from),- title: `Rename '${plan.symbol.name}'`,+ title: tx`Rename '${plan.symbol.name}'`,initial: plan.symbol.name,note: `${SYNTAX_NOTE}: local occurrences only`,onSubmit: (newName) => void commitSyntaxRename(view, doc, plan, newName),@@ -315,7 +316,7 @@ export async function commitSyntaxRename(view: EditorView, doc: EditorDocContext});openPopup({kind: "preview",- title: `Rename '${oldName}' to '${newName}'`,+ title: tx`Rename '${oldName}' to '${newName}'`,summary: {files: 1,occurrences: occurrences.length,diff --git a/src/editor/lsp/spelling.ts b/src/editor/lsp/spelling.tsindex 80ba1ca80..11f2d74de 100644--- a/src/editor/lsp/spelling.ts+++ b/src/editor/lsp/spelling.ts@@ -27,6 +27,7 @@ import { rangeToOffsets } from "./positions";import { showHint } from "./hint";import { caretAnchor, openPopup, type ListPopupItem } from "./popupStore";import { renameNamePart } from "./rename";+import { tx } from "@/platform/i18n";const CHECK_DELAY = 800;@@ -124,7 +125,7 @@ async function changeTo(view: EditorView, typo: PlacedTypo) {openPopup({kind: "list",anchor: caretAnchor(view, typo.from),- title: `${rename ? "Rename" : "Change"} '${typo.word}' to`,+ title: rename ? tx`Rename '${typo.word}' to` : tx`Change '${typo.word}' to`,items: suggestions.map((s, i) => ({ id: `${i}`, label: s, run: () => applyCorrection(view, typo, s) })),});}@@ -142,7 +143,7 @@ export function spellingIntentions(view: EditorView): ListPopupItem[] {? [{id: "spelling.saveProject",- label: `Save '${typo.word}' to project-level dictionary`,+ label: tx`Save '${typo.word}' to project-level dictionary`,icon: "bulb-fix",run: () => saveToDictionary(typo.word, "project"),},@@ -150,7 +151,7 @@ export function spellingIntentions(view: EditorView): ListPopupItem[] {: []),{id: "spelling.saveIde",- label: `Save '${typo.word}' to application-level dictionary`,+ label: tx`Save '${typo.word}' to application-level dictionary`,icon: "bulb-fix",run: () => saveToDictionary(typo.word, "ide"),},@@ -210,7 +211,7 @@ export function spellingExtension(): Extension {typos.map((t) => ({range: t.range,severity: "info",- message: `Typo: In word '${t.word}'`,+ message: tx`Typo: In word '${t.word}'`,source: "Spelling",code: null,})),diff --git a/src/editor/lsp/syntaxFallback.ts b/src/editor/lsp/syntaxFallback.tsindex 0c54aa379..5a6ff2c56 100644--- a/src/editor/lsp/syntaxFallback.ts+++ b/src/editor/lsp/syntaxFallback.ts@@ -9,6 +9,7 @@ import type { Location, Pos, Range, SymbolKind, SymbolMatch } from "@/bindings";import { call, commands } from "@/platform/ipc";import { structure, type Locals, type LocalSymbol, type NodeAt } from "@/editor/structure";import { comparePos, rangeContains, rangeToOffsets } from "./positions";+import { tx } from "@/platform/i18n";/** Subtle marker for answers that did not come from the language server. */export const SYNTAX_NOTE = "Based on syntax (language server not ready)";@@ -237,7 +238,7 @@ export async function planLocalRename(if (locals.status === "notLocal")return {kind: "refused",- message: `Can't rename '${locals.name}' without the language server: only local variables can be renamed based on syntax`,+ message: tx`Can't rename '${locals.name}' without the language server: only local variables can be renamed based on syntax`,};const { symbol } = locals;const ranges = [symbol.definition, ...symbol.references].sort((a, b) => comparePos(a.start, b.start));diff --git a/src/editor/navigation/index.ts b/src/editor/navigation/index.tsindex c839f1ee5..8dccb8f16 100644--- a/src/editor/navigation/index.ts+++ b/src/editor/navigation/index.ts@@ -20,6 +20,7 @@ import { editorService } from "@/workbench/contributions";import { fileIconName } from "@/ui";import { gotoTestOrSubject, type TestNavDeps } from "./gotoTest";import { baseName, memberAt, methodStop, superMethods } from "./structureNav";+import { tx } from "@/platform/i18n";const EDITOR_WHEN = "textEditorActive && (editorFocus || popupOpen || !toolWindowFocus)";@@ -97,7 +98,7 @@ async function superMethod(view: EditorView) {openPopup({kind: "list",anchor: caretAnchor(view, head),- title: method ? `Choose Super Method of ${baseName(method.name)} (${locs.length} found)` : `Choose Super Class or Interface (${locs.length} found)`,+ title: method ? tx`Choose Super Method of ${baseName(method.name)} (${locs.length} found)` : tx`Choose Super Class or Interface (${locs.length} found)`,items: await locationItems(locs),});}diff --git a/src/editor/refactor/introduce.ts b/src/editor/refactor/introduce.tsindex 5142bc172..b6d1d173a 100644--- a/src/editor/refactor/introduce.ts+++ b/src/editor/refactor/introduce.ts@@ -35,6 +35,7 @@ import {type DeclResult,type Declaration,} from "./templates";+import { tx } from "@/platform/i18n";/** Why the language server could not do it (see `withFallback`). */export type FallbackReason = "notReady" | "error" | "empty";@@ -594,7 +595,7 @@ async function chooseOccurrences(p: Prepared, self: Occurrence, others: Occurren},{id: "all",- label: `Replace all ${others.length + 1} occurrences`,+ label: tx`Replace all ${others.length + 1} occurrences`,onActive: () => highlightRanges(view, [self, ...others]),run: () => apply(true),},@@ -663,7 +664,7 @@ function applyAndName(p: Prepared, plan: Plan, names: string[]) {initial: name,suggestions: names,note: NOTES[p.reason],- hint: `↵ Apply · Esc Keep '${name}'`,+ hint: tx`↵ Apply · Esc Keep '${name}'`,onSubmit: (chosen) => void rename(p, chosen, name, { original, applied, plan, ranges }),});}diff --git a/src/editor/refactor/safeDelete.test.ts b/src/editor/refactor/safeDelete.test.tsindex cfe0e53f4..ae9951a27 100644--- a/src/editor/refactor/safeDelete.test.ts+++ b/src/editor/refactor/safeDelete.test.ts@@ -264,7 +264,7 @@ describe("safeDelete in the editor", () => {expect((await run("delete")).state.doc.toString()).toBe("fn unused() {\n unused();\n}\n\nfn main() {}\n");});- it("confirms first ('Delete function …?') and searches nothing when cancelled", async () => {+ it("confirms first ('Delete Function …?') and searches nothing when cancelled", async () => {const v = editor(text, "unused() {");outline = ok([item(text, "unused", "fn unused() {\n unused();\n}")]);confirmAnswer = null;@@ -272,7 +272,7 @@ describe("safeDelete in the editor", () => {expect(confirmChecked).toHaveBeenCalledTimes(1);const opts = confirmChecked.mock.calls[0]![0];expect(opts.title).toBe("Safe Delete");- expect(opts.message).toBe("Delete function 'unused'?");+ expect(opts.message).toBe("Delete Function 'unused'?");expect(opts.checkbox).toBe("Search in comments and strings");expect(lspReferences).not.toHaveBeenCalled();expect(v.state.doc.toString()).toBe(text);diff --git a/src/editor/refactor/safeDelete.ts b/src/editor/refactor/safeDelete.tsindex 81ceb1f5b..95858b212 100644--- a/src/editor/refactor/safeDelete.ts+++ b/src/editor/refactor/safeDelete.ts@@ -25,6 +25,7 @@ import { ask, confirmChecked } from "@/workbench/messages";import { openPopup, type PreviewOccurrence } from "@/editor/lsp/popupStore";import { cannotPerform } from "./catalog";import { cancelled, languageName } from "./query";+import { tx } from "@/platform/i18n";// ---------------------------------------------------------------------------// Deletion range (pure)@@ -269,11 +270,19 @@ export function usagesMessage(): { message: string; detail: string } {const n = usages.length;const files = new Set(usages.map((u) => u.path)).size;- const noun = n === 1 ? "usage that is" : "usages that are";- return {- message: `${n} ${n === 1 ? "usage" : "usages"} found`,- detail: `${subject} ${plural ? "have" : "has"} ${n} ${noun} not safe to delete${files > 1 ? ` (in ${files} files)` : ""}.`,- };+ const where = files > 1 ? tx` (in ${files} files)` : "";+ let detail: string;+ if (plural)+ detail =+ n === 1+ ? tx`${subject} have ${n} usage that is not safe to delete${where}.`+ : tx`${subject} have ${n} usages that are not safe to delete${where}.`;+ else+ detail =+ n === 1+ ? tx`${subject} has ${n} usage that is not safe to delete${where}.`+ : tx`${subject} has ${n} usages that are not safe to delete${where}.`;+ return { message: n === 1 ? tx`${n} usage found` : tx`${n} usages found`, detail };}/** IDEA's "Usages Detected" question; resolves "cancel" when dismissed. */@@ -391,7 +400,7 @@ function previewTextOccurrences(});openPopup({kind: "preview",- title: `Safe Delete ${target.kind.toLowerCase()} '${target.name}'`,+ title: tx`Safe Delete ${target.kind} '${target.name}'`,summary: {files: 1,occurrences: occurrences.length,@@ -436,7 +445,7 @@ export async function safeDelete(view: EditorView): Promise<void> {// IDEA always confirms first; usages are searched after OK.const confirmed = await confirmChecked({title: "Safe Delete",- message: `Delete ${target.kind.toLowerCase()} '${target.name}'?`,+ message: tx`Delete ${target.kind} '${target.name}'?`,ok: "OK",checkbox: "Search in comments and strings",checked: searchInComments,@@ -453,7 +462,7 @@ export async function safeDelete(view: EditorView): Promise<void> {]);if (view.state.doc !== docBefore) return;if (usages.length) {- const answer = await askUsagesDetected(`${target.kind} '${target.name}'`, usages);+ const answer = await askUsagesDetected(tx`${target.kind} '${target.name}'`, usages);if (answer === "view") viewUsages(target.name, usages);else if (answer === "delete") applyDeletion(view, docBefore, target, comments);else view.focus();diff --git a/src/editor/refactor/serverIntroduce.ts b/src/editor/refactor/serverIntroduce.tsindex d495fc0ad..17b1fd11c 100644--- a/src/editor/refactor/serverIntroduce.ts+++ b/src/editor/refactor/serverIntroduce.ts@@ -27,6 +27,7 @@ import type { RefactoringId } from "./catalog";import { expressionCandidates, expressionPreview } from "./introduce";import { findTextOccurrences } from "./occurrences";import { isIdentifier, isKeyword, suggestNames, uniqueNames } from "./names";+import { tx } from "@/platform/i18n";/** Refactorings that take an expression (chosen first when nothing is selected). */export const EXPRESSION_REFACTORINGS: ReadonlySet<RefactoringId> = new Set([@@ -135,7 +136,7 @@ export function chooseOccurrences(view: EditorView, actions: readonly CodeAction},{id: "all",- label: n > 1 ? `Replace all ${n} occurrences` : "Replace all occurrences",+ label: n > 1 ? tx`Replace all ${n} occurrences` : "Replace all occurrences",onActive: () => highlightRanges(view, n ? occurrences : [{ from: sel.from, to: sel.to }]),run: () => applyIntroduceAction(view, variants.all, id),},@@ -291,13 +292,13 @@ export async function applyIntroduceAction(view: EditorView, action: CodeAction,primary,others,suggestions: names.length > 1 ? names : undefined,- hint: keys ? `Press ${keys} to show dialog with more options` : "↵ to finish, Esc to keep the name",+ hint: keys ? tx`Press ${keys} to show dialog with more options` : "↵ to finish, Esc to keep the name",commit: (name) => renameIntroduced(view, [primary, ...others], found.name, name),dialog: (typed) =>openPopup({kind: "rename",anchor: caretAnchor(view, primary.from),- title: `Rename '${found.name}'`,+ title: tx`Rename '${found.name}'`,initial: typed,suggestions: names,onSubmit: (name) => renameIntroduced(view, [primary, ...others], found.name, name),diff --git a/src/features/agents/AgentsView.tsx b/src/features/agents/AgentsView.tsxindex fe0b8a013..c4bd39177 100644--- a/src/features/agents/AgentsView.tsx+++ b/src/features/agents/AgentsView.tsx@@ -7,6 +7,7 @@ import { Icon, IconButton, Spinner, T, Tree, showContextMenu, type MenuItem } frimport { age, branchLabel, groupTasks, isBusy, type TaskGroup } from "./model";import { archiveTask, deleteTask, openHome, openTask, useAgents } from "./store";import styles from "./Agents.module.css";+import { tx } from "@/platform/i18n";export function AgentsHeaderActions() {return <IconButton icon="plus" action="agents.newTask" size="small" />;@@ -117,8 +118,8 @@ async function confirmDelete(task: AgentTask) {const r = await confirmChecked({title: "Delete Agent Task",message: worktree- ? `Delete “${task.title}”? Its branch ${task.branch ?? ""} is kept.`- : `Delete “${task.title}”? Files it changed are kept.`,+ ? tx`Delete “${task.title}”? Its branch ${task.branch ?? ""} is kept.`+ : tx`Delete “${task.title}”? Files it changed are kept.`,ok: "Delete",icon: "warning",checkbox: worktree ? "Also remove its worktree folder" : undefined,diff --git a/src/features/agents/Composer.tsx b/src/features/agents/Composer.tsxindex c090e83c8..710ab877e 100644--- a/src/features/agents/Composer.tsx+++ b/src/features/agents/Composer.tsx@@ -157,7 +157,7 @@ export function Composer(props: ComposerProps) {for (const file of picked) {if (!file.type.startsWith("image/")) continue;if (file.size > MAX_IMAGE_BYTES) {- notifications().notify({ level: "warning", title: "Image too large", body: `${file.name} is over 5 MB.` });+ notifications().notify({ level: "warning", title: "Image too large", body: tx`${file.name} is over 5 MB.` });continue;}const reader = new FileReader();diff --git a/src/features/agents/composerModel.ts b/src/features/agents/composerModel.tsindex ceaa2487c..ca21d89cd 100644--- a/src/features/agents/composerModel.ts+++ b/src/features/agents/composerModel.ts@@ -1,5 +1,6 @@/** Pure composer helpers: `@` / `/` completion, attachments, history recall, settings. */import type { AgentCommand, AgentConfigOption, AgentImage, AgentPrompt, AgentUsage } from "@/bindings";+import { tx } from "@/platform/i18n";export interface FileRef {/** Absolute path (in the task's directory). */@@ -114,7 +115,7 @@ export function usageLabel(u: AgentUsage): { short: string; detail: string } {const pct = Math.min(100, Math.round((u.used / u.size) * 100));const k = (n: number) => (n >= 1000 ? `${Math.round(n / 1000)}k` : `${Math.round(n)}`);const cost = u.cost != null ? ` · ${u.currency === "USD" || !u.currency ? "$" : `${u.currency} `}${u.cost.toFixed(2)}` : "";- return { short: `${pct}%`, detail: `${k(u.used)} / ${k(u.size)} tokens${cost}` };+ return { short: `${pct}%`, detail: tx`${k(u.used)} / ${k(u.size)} tokens${cost}` };}/** `data:image/png;base64,AAA` → an image attachment. */diff --git a/src/features/analysis/AnalysisDialogs.tsx b/src/features/analysis/AnalysisDialogs.tsxindex 91dcac9a3..b5a481140 100644--- a/src/features/analysis/AnalysisDialogs.tsx+++ b/src/features/analysis/AnalysisDialogs.tsx@@ -28,6 +28,7 @@ import {type StructuralForm,} from "./structural";import styles from "./Analysis.module.css";+import { tx } from "@/platform/i18n";function InspectCodeDialog({ onClose }: { onClose: () => void }) {const [scope, setScope] = useState<ScopeChoice>(() => defaultScope());@@ -363,7 +364,7 @@ function ReplacePreviewDialog({ files, onClose }: { files: StructuralFile[]; onC<Checkboxchecked={!excluded.has(key)}onChange={(on) => toggle(key, on)}- aria-label={`Replace in ${f.relPath}:${m.range.start.line + 1}`}+ aria-label={tx`Replace in ${f.relPath}:${m.range.start.line + 1}`}/><div className={styles.previewBody}><span className={styles.previewWhere}>diff --git a/src/features/analysis/cleanup.ts b/src/features/analysis/cleanup.tsindex 22e52d76c..2910023cf 100644--- a/src/features/analysis/cleanup.ts+++ b/src/features/analysis/cleanup.ts@@ -11,6 +11,7 @@ import { maybeEditorService, notifications } from "@/workbench/contributions";import { confirm } from "@/workbench/messages";import { removeTask, upsertTask } from "@/workbench/tasks";import { changedFiles, currentFile, type ScopeChoice } from "./scope";+import { tx } from "@/platform/i18n";export interface CleanupOptions {fixAll: boolean;@@ -97,7 +98,7 @@ export async function runCodeCleanup(choice: ScopeChoice, options: CleanupOption}if (files.length > CONFIRM_ABOVE &&- !(await confirm({ title: "Code Cleanup", message: `Clean up ${files.length} files?`, ok: "Clean Up" }))+ !(await confirm({ title: "Code Cleanup", message: tx`Clean up ${files.length} files?`, ok: "Clean Up" })))return;const editors = maybeEditorService();diff --git a/src/features/analysis/structural.ts b/src/features/analysis/structural.tsindex 09370434f..5d35e0ea3 100644--- a/src/features/analysis/structural.ts+++ b/src/features/analysis/structural.ts@@ -21,6 +21,7 @@ import {} from "@/platform/ipc";import { notifications } from "@/workbench/contributions";import { resolveScope, type ScopeChoice } from "./scope";+import { tx } from "@/platform/i18n";const STATE_KEY = "openidea.analysis.structural.v1";@@ -152,7 +153,7 @@ export async function showStructuralResults(group: "analysis",level: "warning",title: "Search Structurally",- body: `Stopped after ${summary.matches} matches`,+ body: tx`Stopped after ${summary.matches} matches`,});}}diff --git a/src/features/app/projectActions.ts b/src/features/app/projectActions.tsindex f53dc1dc1..288faa7b2 100644--- a/src/features/app/projectActions.ts+++ b/src/features/app/projectActions.ts@@ -10,6 +10,7 @@ import { useProject } from "@/platform/project";import { notifications, registerEditorBanner } from "@/workbench/contributions";import { promptInput } from "@/workbench/inputDialogs";import { showNewProject } from "./NewProject";+import { tx } from "@/platform/i18n";/** localStorage prefixes of IDE-level state exported with the settings (templates, macros, layouts). */export const EXPORTED_STORAGE = [@@ -93,7 +94,7 @@ async function renameProject() {initial: project.name,okLabel: "Rename",validate: () => null,- hint: `Leave empty to use the folder name (${folder}).`,+ hint: tx`Leave empty to use the folder name (${folder}).`,});if (name === null) return;try {diff --git a/src/features/build-tools/BuildToolView.tsx b/src/features/build-tools/BuildToolView.tsxindex 8f6e98d1c..7060620a4 100644--- a/src/features/build-tools/BuildToolView.tsx+++ b/src/features/build-tools/BuildToolView.tsx@@ -43,6 +43,7 @@ import {useBuild,} from "./store";import styles from "./BuildTools.module.css";+import { tx } from "@/platform/i18n";export function MavenView() {return <BuildToolView tool="maven" />;@@ -292,8 +293,8 @@ function BuildToolView({ tool }: { tool: BuildTool }) {const config = isRunnable(node) && model ? nodeConfig(nodes.filter(isRunnable), model) : null;if (config) {items.push(- { label: `Run '${config.name}'`, icon: "run", run: () => runConfig(config, "run") },- { label: `Debug '${config.name}'`, icon: "debug", run: () => runConfig(config, "debug") },+ { label: tx`Run '${config.name}'`, icon: "run", run: () => runConfig(config, "run") },+ { label: tx`Debug '${config.name}'`, icon: "debug", run: () => runConfig(config, "debug") },{ kind: "separator" },);if (node.kind === "runConfig")@@ -318,7 +319,7 @@ function BuildToolView({ tool }: { tool: BuildTool }) {const file = node.project.buildFile;if (file)items.push({- label: `Open ${file.split("/").pop()}`,+ label: tx`Open ${file.split("/").pop()}`,icon: "file-gradle",run: () => void editorService().openFile(`${root}/${file}`),});diff --git a/src/features/code-insight/HierarchyView.tsx b/src/features/code-insight/HierarchyView.tsxindex 4ea71acd8..9323cfc3e 100644--- a/src/features/code-insight/HierarchyView.tsx+++ b/src/features/code-insight/HierarchyView.tsx@@ -27,6 +27,7 @@ import {type HierarchyNode,} from "./hierarchy";import styles from "./HierarchyView.module.css";+import { tx } from "@/platform/i18n";type Node = { kind: "root"; id: string } | { kind: "item"; id: string; node: HierarchyNode };@@ -78,7 +79,7 @@ function HierarchyToolbar() {icon="arrow-up"size="small"iconSize={16}- title={`${directionLabel(mode, "incoming")} Hierarchy`}+ title={tx`${directionLabel(mode, "incoming")} Hierarchy`}pressed={direction === "incoming"}onClick={() => setDirection("incoming")}/>@@ -86,7 +87,7 @@ function HierarchyToolbar() {icon="arrow-down"size="small"iconSize={16}- title={`${directionLabel(mode, "outgoing")} Hierarchy`}+ title={tx`${directionLabel(mode, "outgoing")} Hierarchy`}pressed={direction === "outgoing"}onClick={() => setDirection("outgoing")}/>diff --git a/src/features/code-insight/ServerStatus.tsx b/src/features/code-insight/ServerStatus.tsxindex 07115acbc..eb433ae5e 100644--- a/src/features/code-insight/ServerStatus.tsx+++ b/src/features/code-insight/ServerStatus.tsx@@ -7,6 +7,7 @@ import { downloadJdkActions } from "@/platform/jdk";import { relativePath, useProject } from "@/platform/project";import { STATUS_LABEL, restartServer, serversSummary, useServers } from "./servers";import styles from "./ServerStatus.module.css";+import { tx } from "@/platform/i18n";export function ServerStatus() {const map = useServers((s) => s.servers);@@ -23,7 +24,7 @@ export function ServerStatus() {<BarButtonref={ref}aria-expanded={open}- aria-label={`Language servers: ${summary.text}`}+ aria-label={tx`Language servers: ${summary.text}`}tooltip="Language servers"onClick={() => setOpen((v) => !v)}>@@ -65,7 +66,7 @@ export function ServerStatus() {) : s.status === "missing" && canInstall ? (<Buttonsize="small"- aria-label={`Install ${s.name}`}+ aria-label={tx`Install ${s.name}`}onClick={() => {setOpen(false);void executeAction("tools.install", s.name);@@ -77,7 +78,7 @@ export function ServerStatus() {<IconButtonicon="refresh"size="small"- title={`Restart ${s.name}`}+ title={tx`Restart ${s.name}`}disabled={s.status === "missing" || s.status === "starting"}onClick={() => void restartServer(s.id)}/>diff --git a/src/features/code-insight/decorations.ts b/src/features/code-insight/decorations.tsindex 0f164794d..78566e3d1 100644--- a/src/features/code-insight/decorations.ts+++ b/src/features/code-insight/decorations.ts@@ -1,17 +1,16 @@/** "problems" file decorations: files with errors (and their folders) get IDEA's red underline. */import { setFileDecorations, type FileDecoration } from "@/workbench/contributions";import { countSeverities, fileDiagnostics, useProblems, type ProblemsMap } from "./problemsStore";+import { tx } from "@/platform/i18n";export function problemDecorations(map: ProblemsMap): Map<string, FileDecoration> {const out = new Map<string, FileDecoration>();for (const path of map.keys()) {const c = countSeverities(fileDiagnostics(map, path));if (!c.error) continue;- out.set(path, {- error: true,- propagate: true,- tooltip: `${c.error} ${c.error === 1 ? "error" : "errors"}${c.warning ? `, ${c.warning} ${c.warning === 1 ? "warning" : "warnings"}` : ""}`,- });+ const errors = c.error === 1 ? tx`${c.error} error` : tx`${c.error} errors`;+ const warnings = !c.warning ? "" : c.warning === 1 ? tx`${c.warning} warning` : tx`${c.warning} warnings`;+ out.set(path, { error: true, propagate: true, tooltip: warnings ? `${errors}, ${warnings}` : errors });}return out;}diff --git a/src/features/coverage/executor.ts b/src/features/coverage/executor.tsindex 040793aef..b007042b7 100644--- a/src/features/coverage/executor.ts+++ b/src/features/coverage/executor.ts@@ -7,6 +7,7 @@ import { call, commands, isTauri, type InstallCommand, type RunConfig } from "@/import { notifications, toolWindowService, type ExecutorLaunch, type RunExecutorContribution } from "@/workbench/contributions";import { coverageSupports, formatPercent } from "./model";import { addSuite } from "./store";+import { tx } from "@/platform/i18n";const errorText = (e: unknown) => (e instanceof Error ? e.message : String(e));@@ -47,7 +48,7 @@ export function notifyMissingTool(level: "warning",key: `${group}-missing-${tool}`,title: `${tool} is not installed`,- body: line ? `${missing.message} Install it with: ${line}` : missing.homepage ? `${missing.message} ${missing.homepage}` : missing.message,+ body: line ? tx`${missing.message} Install it with: ${line}` : missing.homepage ? `${missing.message} ${missing.homepage}` : missing.message,sticky: true,actions,});diff --git a/src/features/database/DataDialogs.tsx b/src/features/database/DataDialogs.tsxindex 4a9720826..e681afd84 100644--- a/src/features/database/DataDialogs.tsx+++ b/src/features/database/DataDialogs.tsx@@ -8,6 +8,7 @@ import { CodePreview } from "./CodePreview";import { guessSeparator, importEdits, parseDelimited } from "./model";import { closeDialog, detailsKey, loadDetails, openConsoleWith, targetLabel, useDatabase } from "./store";import styles from "./Database.module.css";+import { tx } from "@/platform/i18n";function when(t: number): string {const d = new Date(t);@@ -60,7 +61,7 @@ export function HistoryDialog({ id, path }: { id: string; path: string | null })<DialogopenonClose={closeDialog}- title={`${targetLabel(id)} Query History`}+ title={tx`${targetLabel(id)} Query History`}width={820}footerStart={<IconButton icon="trash" title="Clear History" disabled={!entries?.length} onClick={() => void remove(null)} />@@ -192,12 +193,12 @@ export function ImportDialog({ id, schema, table }: { id: string; schema: string<DialogopenonClose={closeDialog}- title={`Import Data into ${schema}.${table}`}+ title={tx`Import Data into ${schema}.${table}`}width={720}buttons={[{ label: "Cancel", role: "cancel" },{- label: `Import ${edits.length} Rows`,+ label: tx`Import ${edits.length} Rows`,role: "default",disabled: !edits.length || !mapped.length || busy,onClick: () => void run(),diff --git a/src/features/database/DataView.tsx b/src/features/database/DataView.tsxindex 3de777fb5..480e81ce2 100644--- a/src/features/database/DataView.tsx+++ b/src/features/database/DataView.tsx@@ -21,6 +21,7 @@ import {} from "./resultView";import { openDialog } from "./store";import styles from "./Database.module.css";+import { tx } from "@/platform/i18n";export type DataPanel = "record" | "value" | "aggregates";@@ -30,7 +31,7 @@ export function exportMenu(data: ExportData, source: string, format?: ExportForm{ label: "Export Data…", icon: "export", run: () => openDialog({ kind: "export", data, source, format }) },{ kind: "separator" },...EXPORT_FORMATS.map((f): MenuItem => ({- label: `Copy as ${f.label}`,+ label: tx`Copy as ${f.label}`,icon: "copy",run: () => void navigator.clipboard?.writeText(exportData(f.id, data)),})),@@ -207,14 +208,14 @@ function FilterPopup(props: {anchor={props.anchor}placement="bottom-start"onClose={props.onClose}- aria-label={`Local filter of ${props.column}`}+ aria-label={tx`Local filter of ${props.column}`}className={styles.filterPopup}trapFocus><InputautoFocusaria-label="Search values"- placeholder={`Values of ${props.column}`}+ placeholder={tx`Values of ${props.column}`}value={query}onChange={(e) => setQuery(e.target.value)}/>diff --git a/src/features/database/Dialogs.tsx b/src/features/database/Dialogs.tsxindex 13fc362de..fc00532e7 100644--- a/src/features/database/Dialogs.tsx+++ b/src/features/database/Dialogs.tsx@@ -7,6 +7,7 @@ import { SourceDialog } from "./SourceDialog";import { closeDialog, useDatabase } from "./store";import styles from "./Database.module.css";import { isImeKey } from "@/platform/ime";+import { tx } from "@/platform/i18n";const ObjectDialogs = lazyComponent(() => import("./ObjectDialogs").then((m) => m.ObjectDialogs));const ExportDialog = lazyComponent(() => import("./ExportDialog").then((m) => m.ExportDialog));@@ -28,7 +29,7 @@ function PasswordDialog({ source, resolve }: { source: DataSource; resolve: (ok:<DialogopenonClose={() => done(false)}- title={`Connect to ${source.name}`}+ title={tx`Connect to ${source.name}`}width={400}buttons={[{ label: "Cancel", role: "cancel" },@@ -82,7 +83,7 @@ function SshSecretDialog({<DialogopenonClose={() => done(false)}- title={`SSH: ${sshLabel(source) || source.name}`}+ title={tx`SSH: ${sshLabel(source) || source.name}`}width={440}buttons={[{ label: "Cancel", role: "cancel" },diff --git a/src/features/database/ObjectDialogs.tsx b/src/features/database/ObjectDialogs.tsxindex 805e61fb7..45cbed50c 100644--- a/src/features/database/ObjectDialogs.tsx+++ b/src/features/database/ObjectDialogs.tsx@@ -38,6 +38,7 @@ import {} from "./store";import { openTableData } from "./treeActions";import styles from "./Database.module.css";+import { tx } from "@/platform/i18n";/** Read-only SQL with the editor's syntax colours (IDEA's dialog Preview pane). */function SqlPreview({ sql, label = "Preview" }: { sql: string; label?: string }) {@@ -287,7 +288,7 @@ function ModifyTableDialog(props: ModifyProps) {<DialogopenonClose={closeDialog}- title={`Modify Table ${table}`}+ title={tx`Modify Table ${table}`}width={440}buttons={[{ label: "Cancel", role: "cancel" }]}>diff --git a/src/features/database/SourceDialog.tsx b/src/features/database/SourceDialog.tsxindex 9bca7f2ba..aadf563bc 100644--- a/src/features/database/SourceDialog.tsx+++ b/src/features/database/SourceDialog.tsx@@ -17,7 +17,7 @@ import {type DbSslMode,type DbTxMode,} from "@/platform/ipc";-import { useTx, useTxTemplate } from "@/platform/i18n";+import { tx, useTx, useTxTemplate } from "@/platform/i18n";import { Button, Checkbox, Dialog, IconButton, Input, Select, Tabs, T, type SelectOption } from "@/ui";import { colorVar, connectRemedy, fileSourceName, newSourceId, parseSourceUrl, sshLabel } from "./model";import { closeDialog, loadDatabases, loadSchemas, saveSource, useDatabase } from "./store";@@ -224,7 +224,7 @@ function SecondsOption({<InputclassName={styles.secondsInput}inputMode="numeric"- aria-label={`${label} (seconds)`}+ aria-label={tx`${label} (seconds)`}disabled={!on}value={draft}onChange={(e) => {@@ -243,14 +243,18 @@ function SecondsOption({/** Schemas tab: "All …" or a choice of names and `*` / `?` patterns. */function NamePicker({- title,+ allLabel,+ addLabel,all,chosen,known,onAll,onChosen,}: {- title: string;+ /** "All databases" */+ allLabel: string;+ /** Accessible name of the pattern input. */+ addLabel: string;all: boolean;chosen: string[];known: string[];@@ -266,7 +270,7 @@ function NamePicker({};return (<div className={styles.namePicker}>- <Checkbox checked={all} onChange={onAll} label={`All ${title}`} />+ <Checkbox checked={all} onChange={onAll} label={allLabel} />{!all && (<div className={styles.nameList}>{names.map((n) => (@@ -282,7 +286,7 @@ function NamePicker({className={styles.fill}value={pattern}placeholder="Name or pattern, e.g. app_*"- aria-label={`Add ${title} pattern`}+ aria-label={addLabel}onChange={(e) => setPattern(e.target.value)}onKeyDown={(e) => {if (e.key === "Enter" && !isImeKey(e.nativeEvent)) {@@ -401,7 +405,7 @@ export function SourceDialog({setTest(null);try {const v = await call(commands.dbTest(effective(), password ?? null, sshOn ? (sshSecret ?? null) : null));- setTest({ ok: true, text: `Succeeded: ${v}` });+ setTest({ ok: true, text: tx`Succeeded: ${v}` });} catch (e) {const text = e instanceof Error ? e.message : String(e);const trust = e instanceof IpcError && connectRemedy(e.kind, e.message) === "trustHostKey";@@ -802,7 +806,8 @@ export function SourceDialog({<div className={styles.formWide}>{postgres && (<NamePicker- title="databases"+ allLabel={tx("All databases")}+ addLabel={tx("Add databases pattern")}all={intro.allDatabases !== false}chosen={intro.databases ?? []}known={knownDbs}@@ -811,7 +816,8 @@ export function SourceDialog({/>)}<NamePicker- title={s.driver === "mysql" ? "schemas (databases)" : "schemas"}+ allLabel={s.driver === "mysql" ? tx("All schemas (databases)") : tx("All schemas")}+ addLabel={s.driver === "mysql" ? tx("Add schemas (databases) pattern") : tx("Add schemas pattern")}all={intro.allSchemas !== false}chosen={intro.schemas ?? []}known={knownSchemas}@@ -921,7 +927,7 @@ export function SourceDialog({<DialogopenonClose={closeDialog}- title={initial ? `Data Source: ${initial.name}` : "New Data Source"}+ title={initial ? tx`Data Source: ${initial.name}` : "New Data Source"}width={640}footerStart={<Button onClick={() => void runTest()} disabled={busy || !valid}>diff --git a/src/features/database/TableEditor.tsx b/src/features/database/TableEditor.tsxindex 5cb13726b..684509169 100644--- a/src/features/database/TableEditor.tsx+++ b/src/features/database/TableEditor.tsx@@ -29,6 +29,7 @@ import {import { openDialog, sourceById, withConnection } from "./store";import type { TableRef } from "./tableInput";import styles from "./Database.module.css";+import { tx } from "@/platform/i18n";const PAGE_SIZES = ["100", "500", "1000", "5000"];@@ -306,7 +307,7 @@ export function TableEditor({ input }: { input: EditorInput }) {) : (<div className={styles.fill}><DataView- aria-label={`${ref.table} data`}+ aria-label={tx`${ref.table} data`}columns={gridColumns}rowCount={rowCount}fixedRows={loaded}diff --git a/src/features/database/console.tsx b/src/features/database/console.tsxindex 4ce38953d..f56f151e4 100644--- a/src/features/database/console.tsx+++ b/src/features/database/console.tsx@@ -58,6 +58,7 @@ import {useDatabase,} from "./store";import styles from "./Database.module.css";+import { tx } from "@/platform/i18n";/** `templates` feature's language-data key for finer template contexts. */const TEMPLATE_CONTEXT_KEY = "openideaTemplateContexts";@@ -287,7 +288,7 @@ function ConsoleBar({ path, view }: { path: string; view: EditorView }) {<Selectaria-label="Row limit"value={String(maxRows)}- options={ROW_LIMITS.map((v) => ({ value: v, label: `${Number(v).toLocaleString("en")} rows` }))}+ options={ROW_LIMITS.map((v) => ({ value: v, label: tx`${Number(v).toLocaleString("en")} rows` }))}onChange={(v) => useDatabase.setState({ maxRows: Number(v) })}/><span className={styles.toolbarSeparator} />diff --git a/src/features/database/store.ts b/src/features/database/store.tsindex 9838c39b3..b384d6dfc 100644--- a/src/features/database/store.ts+++ b/src/features/database/store.ts@@ -38,6 +38,7 @@ import type { ExportData, ExportFormat } from "./export";import type { DbObjectRef } from "./objects";import { formatted } from "./sql/format";import { bindParams, findParams } from "./sql/params";+import { tx } from "@/platform/i18n";export const DB_TOOL_WINDOW = "database";export const RESULTS_VIEW = "dbResults";@@ -281,7 +282,7 @@ export async function renameSource(id: string, name: string): Promise<void> {export async function removeSource(source: DataSource): Promise<void> {const ok = await confirm({title: "Remove Data Source",- message: `Remove data source '${source.name}'? Its query console file stays on disk.`,+ message: tx`Remove data source '${source.name}'? Its query console file stays on disk.`,ok: "Remove",});if (!ok) return;@@ -788,7 +789,7 @@ export async function executeConsole(.filter((o) => o.result?.columns.length).map((outcome) => {const n = nextTab++;- return { id: n, title: `Result ${n}`, path, sourceId: id, outcome };+ return { id: n, title: tx`Result ${n}`, path, sourceId: id, outcome };});const failed = outcomes.some((o) => o.error);useDatabase.setState((s) => ({@@ -957,7 +958,7 @@ export async function finishTransaction(id: string, commit: boolean): Promise<boasync function askEndTransaction(source: DataSource): Promise<boolean | null> {const { button } = await ask({title: "Switch to Auto-Commit",- body: `${source.name} has uncommitted changes. Commit or roll them back before switching to auto-commit?`,+ body: tx`${source.name} has uncommitted changes. Commit or roll them back before switching to auto-commit?`,buttons: [{ id: "rollback", label: "Roll Back" },{ id: "commit", label: "Commit", primary: true },diff --git a/src/features/database/treeActions.ts b/src/features/database/treeActions.tsindex c8bfd22e7..629b392cb 100644--- a/src/features/database/treeActions.ts+++ b/src/features/database/treeActions.ts@@ -37,6 +37,7 @@ import {removeSource,} from "./store";import { tableInput } from "./tableInput";+import { tx } from "@/platform/i18n";/** Context key: the Database tree has focus. */export const DB_VIEW_FOCUS = "databaseViewFocus";@@ -57,11 +58,12 @@ function sourceOf(n: DbNode | null): DataSource | undefined {return n ? sourceById(nodeTarget(n)) : undefined;}-async function copy(text: string, what: string) {+/** Copies `text`; `failure` is the notification title when the clipboard refuses it. */+async function copy(text: string, failure: string) {try {await navigator.clipboard.writeText(text);} catch {- notifications().notify({ level: "error", title: `Cannot copy the ${what}` });+ notifications().notify({ level: "error", title: failure });}}@@ -373,10 +375,10 @@ export function registerDatabaseTreeActions(): () => void {const n = nodeFrom(arg);if (!n) return;const id = nodeTarget(n);- if (n.kind === "source") return void copy(n.source.name ?? "", "name");- if (n.kind === "database") return void copy(n.name, "name");+ if (n.kind === "source") return void copy(n.source.name ?? "", tx("Cannot copy the name"));+ if (n.kind === "database") return void copy(n.name, tx("Cannot copy the name"));const o = objectOf(n);- if (id && o) void copy(reference(driverOf(id), o), "reference");+ if (id && o) void copy(reference(driverOf(id), o), tx("Cannot copy the reference"));},}),tree({@@ -397,7 +399,7 @@ export function registerDatabaseTreeActions(): () => void {run: async ({ arg }) => {const n = nodeFrom(arg);const ddl = n && (await ddlOf(n));- if (ddl) await copy(ddl.text, "DDL");+ if (ddl) await copy(ddl.text, tx("Cannot copy the DDL"));},}),tree({diff --git a/src/features/debugger/actions.ts b/src/features/debugger/actions.tsindex 9510f9875..db4134c8c 100644--- a/src/features/debugger/actions.ts+++ b/src/features/debugger/actions.ts@@ -43,6 +43,7 @@ import {openSmartStepChooser,useOverlays,} from "./ui/popoverStore";+import { tx } from "@/platform/i18n";function isRunConfig(arg: unknown): arg is RunConfig {return !!arg && typeof arg === "object" && "command" in arg && "args" in arg && "debugAdapter" in arg;@@ -159,7 +160,7 @@ async function listenForJvm(name: string, host: string, port: number): Promise<nkey,sticky: true,title: `'${name}': listening for the remote JVM on port ${port}`,- body: `Start the remote JVM with -agentlib:jdwp=transport=dt_socket,server=n,address=${host}:${port},suspend=y`,+ body: tx`Start the remote JVM with -agentlib:jdwp=transport=dt_socket,server=n,address=${host}:${port},suspend=y`,actions: [{ label: "Cancel", run: () => void commands.cancelRequest(request) }],});try {diff --git a/src/features/debugger/hotswap.ts b/src/features/debugger/hotswap.tsindex 3b1a6c8b0..baedf0fae 100644--- a/src/features/debugger/hotswap.ts+++ b/src/features/debugger/hotswap.ts@@ -8,6 +8,7 @@import { call, commands, isTauri, type DebugEvent, type DebugSessionId } from "@/platform/ipc";import { maybeEditorService, notifications } from "@/workbench/contributions";import { isLive, useDebug, type DebugSession } from "./state";+import { tx } from "@/platform/i18n";const KEY = "debug.hotswap";/** `BUILD_COMPLETE` events of our own build are not worth a prompt. */@@ -25,7 +26,7 @@ function plural(n: number, word: string) {export function hotSwapMessage(changed: number, errors: string[]): { level: "info" | "error"; title: string; body?: string } {if (errors.length) return { level: "error", title: "Hot Swap failed", body: errors.join("\n") };if (changed === 0) return { level: "info", title: "Loaded classes are up to date. Nothing to reload." };- return { level: "info", title: `${plural(changed, "class")} reloaded` };+ return { level: "info", title: tx`${plural(changed, "class")} reloaded` };}/** Compiles (unless `build` is false) and reloads changed classes into every Java debug session. */diff --git a/src/features/debugger/missingAdapter.ts b/src/features/debugger/missingAdapter.tsindex cc4722c8d..7d13beec7 100644--- a/src/features/debugger/missingAdapter.ts+++ b/src/features/debugger/missingAdapter.ts@@ -5,11 +5,11 @@import { IpcError } from "@/platform/ipc";/** Adapters the tools installer can provide (adapter id → tool name). */-const INSTALLABLE: Record<string, { tool: string; label: string }> = {- debugpy: { tool: "debugpy", label: "debugpy" },- "js-debug": { tool: "js-debug", label: "the JavaScript debugger (vscode-js-debug)" },- delve: { tool: "delve", label: "Delve" },- codelldb: { tool: "codelldb", label: "CodeLLDB" },+const INSTALLABLE: Record<string, { tool: string; title: string }> = {+ debugpy: { tool: "debugpy", title: "debugpy is not installed" },+ "js-debug": { tool: "js-debug", title: "The JavaScript debugger (vscode-js-debug) is not installed" },+ delve: { tool: "delve", title: "Delve is not installed" },+ codelldb: { tool: "codelldb", title: "CodeLLDB is not installed" },};export interface MissingAdapter {@@ -25,14 +25,14 @@ export function missingAdapter(adapter: string, e: unknown): MissingAdapter | nuif (adapter === "debugpy" && e.message.startsWith("debugpy is not installed")) {return {tool: entry.tool,- title: "debugpy is not installed",+ title: entry.title,body: `${e.message}. OpenIDEA can install a private copy that every Python interpreter uses for debugging.`,};}if (!e.message.startsWith(`debug adapter \`${adapter}\` not found`)) return null;return {tool: entry.tool,- title: `${entry.label[0]!.toUpperCase()}${entry.label.slice(1)} is not installed`,+ title: entry.title,body: e.message,};}diff --git a/src/features/debugger/ui/DebugToolWindow.tsx b/src/features/debugger/ui/DebugToolWindow.tsxindex 3435e312a..8ef79ce7e 100644--- a/src/features/debugger/ui/DebugToolWindow.tsx+++ b/src/features/debugger/ui/DebugToolWindow.tsx@@ -40,6 +40,7 @@ import {} from "../state";import { VariablesView, type VarRoot } from "./VariablesView";import styles from "./DebugToolWindow.module.css";+import { tx } from "@/platform/i18n";function useActionEnabled(id: string): boolean {const ctx = useContextKeys();@@ -114,7 +115,7 @@ export function DebugTabs() {if (!list.length) return null;const items: TabItem[] = list.map((s) => ({id: String(s.id),- label: s.parent != null ? `${s.name} (child)` : s.name,+ label: s.parent != null ? tx`${s.name} (child)` : s.name,text: s.name,icon: "debug",italic: s.status === "terminated",diff --git a/src/features/debugger/ui/Overlays.tsx b/src/features/debugger/ui/Overlays.tsxindex 374df9493..43407c6a8 100644--- a/src/features/debugger/ui/Overlays.tsx+++ b/src/features/debugger/ui/Overlays.tsx@@ -34,6 +34,7 @@ import { VariablesView, type VarRoot } from "./VariablesView";import { pushHistory, readHistory } from "./expressionHistory";import styles from "./Overlays.module.css";import { isImeKey } from "@/platform/ime";+import { tx } from "@/platform/i18n";export function DebuggerOverlays() {return (@@ -447,7 +448,7 @@ function BreakpointsDialog() {<Checkboxchecked={r.bp.enabled}onChange={(enabled) => updateSpecial(r.bp.id, { enabled })}- aria-label={`Enable ${specialTitle(r.bp)}`}+ aria-label={tx`Enable ${specialTitle(r.bp)}`}/><Icon name={r.bp.kind === "method" ? "breakpoint-method" : "breakpoint-field"} size={14} /><span className={styles.bpName}>{specialTitle(r.bp)}</span>@@ -467,7 +468,7 @@ function BreakpointsDialog() {<Checkboxchecked={r.bp.enabled}onChange={(enabled) => updateBreakpoint(r.path, r.bp.id, { enabled })}- aria-label={`Enable breakpoint at ${basename(r.path)}:${r.bp.line + 1}`}+ aria-label={tx`Enable breakpoint at ${basename(r.path)}:${r.bp.line + 1}`}/><spanclassName={styles.bpDot}diff --git a/src/features/github/PullRequestsView.tsx b/src/features/github/PullRequestsView.tsxindex 443c4fd1b..0c6f9bf69 100644--- a/src/features/github/PullRequestsView.tsx+++ b/src/features/github/PullRequestsView.tsx@@ -35,6 +35,7 @@ import {import { addComment, checkoutPullRequest, openCommentLocation, openFileDiff, openUrl, submitReview } from "./ops";import { cancelBusy, loadDetails, refreshAll, select, setQuery, useGithub, type DetailTab } from "./store";import styles from "./Github.module.css";+import { tx } from "@/platform/i18n";const STATES: Array<{ value: PrStateFilter; label: string }> = [{ value: "open", label: "Open" },@@ -515,9 +516,9 @@ function Details() {aria-label="Pull request"items={[{ id: "overview", label: "Overview" },- { id: "files", label: `Files ${pr.files.length}` },- { id: "commits", label: `Commits ${pr.commits.length}` },- { id: "conversation", label: `Conversation ${pr.timeline.length + comments.length}` },+ { id: "files", label: tx`Files ${pr.files.length}` },+ { id: "commits", label: tx`Commits ${pr.commits.length}` },+ { id: "conversation", label: tx`Conversation ${pr.timeline.length + comments.length}` },]}/>{tab === "overview" && <Overview pr={pr} />}diff --git a/src/features/github/dialogs.tsx b/src/features/github/dialogs.tsxindex 7f6a49a1c..e262d0439 100644--- a/src/features/github/dialogs.tsx+++ b/src/features/github/dialogs.tsx@@ -5,6 +5,7 @@ import type { ReviewEvent } from "@/platform/ipc";import { call, commands } from "@/platform/ipc";import { Checkbox, Dialog, Input, Select, T } from "@/ui";import styles from "./Github.module.css";+import { tx } from "@/platform/i18n";interface Entry {id: number;@@ -134,7 +135,7 @@ function CreateDialog(props: {/><div className={styles.formRow}><Checkbox checked={draft} onChange={setDraft} label="Draft" />- <Checkbox checked={push} onChange={setPush} label={`Push '${props.head}' first`} />+ <Checkbox checked={push} onChange={setPush} label={tx`Push '${props.head}' first`} /></div></div></Dialog>@@ -165,7 +166,7 @@ function ReviewDialog(props: {return (<Dialogopen- title={`Review #${props.number}`}+ title={tx`Review #${props.number}`}onClose={() => props.onDone(null)}width={520}buttons={[diff --git a/src/features/http-client/HttpClientView.tsx b/src/features/http-client/HttpClientView.tsxindex ae43b6a2d..b2809306a 100644--- a/src/features/http-client/HttpClientView.tsx+++ b/src/features/http-client/HttpClientView.tsx@@ -10,6 +10,7 @@ import { EmptyState, IconButton, SplitGroup, SplitHandle, SplitPanel, Spinner, Timport { bodyKind, formatMs, formatSize, prettyBody } from "./format";import { cancelRunning, clearHistory, refreshHistory, selectEntry, useHttpClient } from "./store";import styles from "./HttpClient.module.css";+import { tx } from "@/platform/i18n";function statusTone(status: number | null | undefined): string {if (status == null) return styles.statusError ?? "";@@ -73,7 +74,7 @@ function ExchangeView({ ex }: { ex: HttpExchange }) {onSelect={(id) => setTab(id as Tab)}items={[{ id: "body", label: "Response" },- { id: "headers", label: `Headers${r ? ` (${r.headers.length})` : ""}` },+ { id: "headers", label: r ? tx`Headers (${r.headers.length})` : "Headers" },{ id: "request", label: "Request" },]}trailing={diff --git a/src/features/macros/MacrosDialog.tsx b/src/features/macros/MacrosDialog.tsxindex 5cf2eb39f..24c70faaf 100644--- a/src/features/macros/MacrosDialog.tsx+++ b/src/features/macros/MacrosDialog.tsx@@ -2,7 +2,7 @@import { useState } from "react";import { create } from "zustand";import { executeAction, getAction } from "@/platform/actions";-import { t } from "@/platform/i18n";+import { t, tx } from "@/platform/i18n";import { BarButton, Button, Dialog, Icon, List, T } from "@/ui";import { confirm } from "@/workbench/messages";import { promptInput } from "@/workbench/inputDialogs";@@ -60,7 +60,7 @@ function EditMacrosDialog({ onClose }: { onClose: () => void }) {};const remove = async () => {if (!macro) return;- if (await confirm({ title: "Delete Macro", message: `Delete the macro '${macro.name}'?`, ok: "Delete", icon: "warning" }))+ if (await confirm({ title: "Delete Macro", message: tx`Delete the macro '${macro.name}'?`, ok: "Delete", icon: "warning" }))deleteMacro(macro.name);};diff --git a/src/features/perf/MemoryStatus.tsx b/src/features/perf/MemoryStatus.tsxindex 1cb1b5721..e838891f3 100644--- a/src/features/perf/MemoryStatus.tsx+++ b/src/features/perf/MemoryStatus.tsx@@ -14,6 +14,7 @@ import { indicatorLabel, indicatorTooltip, memorySections, summarizeMemory } froimport { startPolling } from "./poll";import { METRICS_INTERVAL_MS, refreshMetrics, usePerf } from "./store";import styles from "./perf.module.css";+import { tx } from "@/platform/i18n";/** Status bar widget id (hidden by default, toggled from the status bar context menu). */export const MEMORY_WIDGET = { id: "perf.memory", title: "Memory Indicator", defaultVisible: false } as const;@@ -41,7 +42,7 @@ export function MemoryStatus() {ref={ref}className={styles.indicator}aria-expanded={open}- aria-label={`Memory: ${tooltip}`}+ aria-label={tx`Memory: ${tooltip}`}tooltip={tooltip}onClick={() => usePerf.setState({ popupOpen: !open })}>@@ -101,7 +102,7 @@ export function MemoryDetails({ metrics: m }: { metrics: AppMetrics }) {label={r.label}detail={r.detail}value={r.value}- title={r.processes > 1 ? `${r.processes} processes` : undefined}+ title={r.processes > 1 ? tx`${r.processes} processes` : undefined}indented/>))}diff --git a/src/features/perf/actions.ts b/src/features/perf/actions.tsindex 8b1a32cc9..325158578 100644--- a/src/features/perf/actions.ts+++ b/src/features/perf/actions.ts@@ -6,6 +6,7 @@ import { useProject } from "@/platform/project";import { formatSize } from "./format";import { MEMORY_WIDGET } from "./MemoryStatus";import { clearCaches, refreshMetrics, usePerf } from "./store";+import { tx } from "@/platform/i18n";function memoryIndicatorShown(): boolean {const overrides = useProject.getState().settings?.appearance?.statusBarWidgets;@@ -30,12 +31,15 @@ export function perfActions(): Action[] {}const memory =r.rssBeforeBytes != null && r.rssAfterBytes != null- ? ` Memory ${formatSize(r.rssBeforeBytes)} → ${formatSize(r.rssAfterBytes)}.`+ ? tx` Memory ${formatSize(r.rssBeforeBytes)} → ${formatSize(r.rssAfterBytes)}.`: "";notifications().notify({level: "info",title: "Caches cleared",- body: `${r.syntaxTrees} syntax tree${r.syntaxTrees === 1 ? "" : "s"} dropped, index compacted.${memory}`,+ body:+ r.syntaxTrees === 1+ ? tx`${r.syntaxTrees} syntax tree dropped, index compacted.${memory}`+ : tx`${r.syntaxTrees} syntax trees dropped, index compacted.${memory}`,key: "perf.clearCaches",});} catch (e) {diff --git a/src/features/plugins/PluginsPage.tsx b/src/features/plugins/PluginsPage.tsxindex 901e7485d..2f6a7a152 100644--- a/src/features/plugins/PluginsPage.tsx+++ b/src/features/plugins/PluginsPage.tsx@@ -39,6 +39,7 @@ import {usePlugins,} from "./store";import styles from "./PluginsPage.module.css";+import { tx } from "@/platform/i18n";const STATUS: Record<PluginStatus, { label: string; tone: "success" | "accent" | "neutral" | "danger" }> = {active: { label: "Running", tone: "success" },@@ -137,7 +138,7 @@ function InstalledRow({ plugin, selected, onSelect }: { plugin: PluginInfo; selechecked={plugin.enabled}disabled={busy}onChange={(on) => void setPluginEnabled(plugin.id, on)}- aria-label={`${plugin.enabled ? "Disable" : "Enable"} ${plugin.name}`}+ aria-label={plugin.enabled ? tx`Disable ${plugin.name}` : tx`Enable ${plugin.name}`}/></li>);@@ -308,7 +309,7 @@ function InstalledDetails({ plugin }: { plugin: PluginInfo }) {icon="run"disabled={!running}onClick={() => void runPluginCommand(plugin.id, c.id)}- aria-label={`Run ${c.title}`}+ aria-label={tx`Run ${c.title}`}><T>Run</T></Button>@@ -338,7 +339,7 @@ function InstalledDetails({ plugin }: { plugin: PluginInfo }) {variant="ghost"disabled={!live}onClick={() => void selectPluginTheme(plugin.id, t.id)}- aria-label={`Apply theme ${t.name}`}+ aria-label={tx`Apply theme ${t.name}`}><T>Apply</T></Button>@@ -407,7 +408,7 @@ function InstalledDetails({ plugin }: { plugin: PluginInfo }) {variant="primary"disabled={busy}onClick={() => void uninstallPlugin(plugin.id)}- aria-label={`Confirm uninstall ${plugin.name}`}+ aria-label={tx`Confirm uninstall ${plugin.name}`}><T>Uninstall</T></Button>diff --git a/src/features/plugins/bridge.ts b/src/features/plugins/bridge.tsindex b7a70edc7..a5580d7eb 100644--- a/src/features/plugins/bridge.ts+++ b/src/features/plugins/bridge.ts@@ -11,6 +11,7 @@ import { notifications } from "@/workbench/contributions";import { applyThemeAttributes, currentThemeId, syncWindowBackground, windowBackgroundHex } from "@/workbench/theme";import { pluginsBackend } from "./backend";import { refreshPlugins, runPluginCommand, usePlugins } from "./store";+import { tx } from "@/platform/i18n";export const pluginActionId = (pluginId: string, commandId: string) => `plugin.${pluginId}.${commandId}`;@@ -25,7 +26,7 @@ export function pluginActions(plugins: readonly PluginInfo[]): Action[] {category: c.category ?? p.name,icon: "package",keywords: ["plugin", p.name, p.id],- description: `From plugin ${p.name}`,+ description: tx`From plugin ${p.name}`,run: async ({ arg }) => {await runPluginCommand(p.id, c.id, typeof arg === "string" ? arg : null);},diff --git a/src/features/profiler/executor.ts b/src/features/profiler/executor.tsindex 6c0e7a41b..6d2e630d6 100644--- a/src/features/profiler/executor.ts+++ b/src/features/profiler/executor.ts@@ -4,6 +4,7 @@ import { call, commands, isTauri, type ProfilerInstall, type RunConfig } from "@import { notifications, toolWindowService, type ExecutorLaunch, type RunExecutorContribution } from "@/workbench/contributions";import { profilerSupports } from "./model";import { addSnapshot } from "./store";+import { tx } from "@/platform/i18n";const errorText = (e: unknown) => (e instanceof Error ? e.message : String(e));@@ -35,7 +36,7 @@ function notifyMissing(tool: string, message: string, install: ProfilerInstall |level: "warning",key: `profiler-missing-${tool}`,title: `${tool} is not installed`,- body: line ? `${message} Install it with: ${line}` : homepage ? `${message} ${homepage}` : message,+ body: line ? tx`${message} Install it with: ${line}` : homepage ? `${message} ${homepage}` : message,sticky: true,actions,});diff --git a/src/features/project-tree/ProjectView.tsx b/src/features/project-tree/ProjectView.tsxindex 9c48f5d36..3756fb245 100644--- a/src/features/project-tree/ProjectView.tsx+++ b/src/features/project-tree/ProjectView.tsx@@ -21,7 +21,7 @@ import clsx from "clsx";import { useEditorRegistry } from "@/editor/api";import { executeAction } from "@/platform/actions";import { setContext } from "@/platform/context";-import { useTxTemplate } from "@/platform/i18n";+import { tx, useTxTemplate } from "@/platform/i18n";import { isTauri } from "@/platform/ipc";import type { RootFolder } from "@/platform/languageSettings";import { useEffectiveRoots } from "@/platform/projectRoots";@@ -460,7 +460,7 @@ export function ProjectView() {setDropTarget(valid ? target.key : null);setDrag({paths,- label: paths.length === 1 ? nameOf(paths[0]!) : `${paths.length} items`,+ label: paths.length === 1 ? nameOf(paths[0]!) : tx`${paths.length} items`,x: ev.clientX,y: ev.clientY,copy: ev.altKey,diff --git a/src/features/project-tree/RefactoringPreview.tsx b/src/features/project-tree/RefactoringPreview.tsxindex a5c81c69c..1fe2e8f27 100644--- a/src/features/project-tree/RefactoringPreview.tsx+++ b/src/features/project-tree/RefactoringPreview.tsx@@ -12,6 +12,7 @@ import { Checkbox, Dialog, Icon, fileIconName } from "@/ui";import { nameOf, relativeTo } from "./paths";import { useProjectTree } from "./store";import styles from "./FileRefactor.module.css";+import { tx } from "@/platform/i18n";type EditFile = Extract<WorkspaceEdit["files"][number], { kind: "edit" }>;@@ -67,7 +68,7 @@ function FileGroup({ file, root, included, onToggle }: { file: EditFile; root: sreturn (<li className={styles.previewFile}><div className={styles.previewFileRow}>- <Checkbox checked={included} onChange={onToggle} aria-label={`Include ${nameOf(file.path)}`} />+ <Checkbox checked={included} onChange={onToggle} aria-label={tx`Include ${nameOf(file.path)}`} /><Icon name={fileIconName(nameOf(file.path))} size={14} /><span className={styles.previewName}>{nameOf(file.path)}</span><span className={styles.previewPath}>{relativeTo(root, file.path) || file.path}</span>@@ -117,7 +118,7 @@ function PreviewDialog({ request }: { request: PreviewRequest }) {return (<Dialogopen- title={`Refactoring Preview: ${request.title}`}+ title={tx`Refactoring Preview: ${request.title}`}onClose={() => request.resolve(null)}width={680}buttons={[diff --git a/src/features/project-tree/actions.ts b/src/features/project-tree/actions.tsindex 68b2a1e08..621d6805c 100644--- a/src/features/project-tree/actions.ts+++ b/src/features/project-tree/actions.ts@@ -42,6 +42,7 @@ import {setViewOption,useProjectTree,} from "./store";+import { tx } from "@/platform/i18n";const FOCUS = "projectViewFocus";const OPEN = "projectOpen";@@ -150,7 +151,7 @@ export function registerProjectActions(): () => void {const toggles: Action[] = OPTION_LABELS.map(([key, label]) => ({id: `project.option.${key}`,- title: `Project View: ${label}`,+ title: tx`Project View: ${label}`,category: "View",keywords: ["project", "tree", "toggle"],toggled: () => useProjectTree.getState().options[key],@@ -159,7 +160,7 @@ export function registerProjectActions(): () => void {const modes: Action[] = VIEW_MODES.map(([mode, label]) => ({id: `project.viewMode.${mode}`,- title: `Project View: Show ${label}`,+ title: tx`Project View: Show ${label}`,category: "View",when: OPEN,keywords: ["project", "pane", "scope", "view as"],@@ -335,7 +336,7 @@ export function registerProjectActions(): () => void {copyPath("name", "project.copyFileName", "Copy File Name"),{id: "project.revealInFinder",- title: `Reveal in ${revealLabel()}`,+ title: tx`Reveal in ${revealLabel()}`,category: "Project View",icon: "external-link",when: OPEN,diff --git a/src/features/project-tree/contextMenu.ts b/src/features/project-tree/contextMenu.tsindex ba8961e6d..80ae286a8 100644--- a/src/features/project-tree/contextMenu.ts+++ b/src/features/project-tree/contextMenu.ts@@ -27,6 +27,7 @@ import {vcsArg,} from "./operations";import { isSameOrInside } from "./paths";+import { tx } from "@/platform/i18n";/** Keys handled by the project view itself (the default keymap has no entries for them). */export const LOCAL_KEYS: Record<string, string> = {@@ -352,7 +353,7 @@ export function contextMenuItems(nodes: ProjectNode[]): MenuItem[] {{id: "unmark",label:- current === "excluded" ? "Cancel Exclusion" : `Unmark as ${roles.find(([r]) => r === current)![1]}`,+ current === "excluded" ? "Cancel Exclusion" : tx`Unmark as ${roles.find(([r]) => r === current)![1]}`,run: () => void markDirectory(single.path, null),},]diff --git a/src/features/project-tree/fileRefactor.ts b/src/features/project-tree/fileRefactor.tsindex d8fdee596..79fb54835 100644--- a/src/features/project-tree/fileRefactor.ts+++ b/src/features/project-tree/fileRefactor.ts@@ -12,6 +12,7 @@ import { projectFs } from "./fs";import { isSameOrInside, nameOf, parentOf } from "./paths";import { previewFileRefactoring } from "./RefactoringPreview";import { useProjectTree } from "./store";+import { tx } from "@/platform/i18n";export interface FileRefactorOptions {/** Update references through the language servers. */@@ -262,7 +263,7 @@ export async function runFileRefactoring(notifications().notify({level: "info",title,- body: edited ? `Updated references in ${edited} ${edited === 1 ? "file" : "files"}` : undefined,+ body: !edited ? undefined : edited === 1 ? tx`Updated references in ${edited} file` : tx`Updated references in ${edited} files`,actions: [{ label: "Undo", run: () => void undoFileRefactoring(id) }],key: "project.refactor.done",});@@ -296,7 +297,7 @@ export async function undoFileRefactoring(id = lastMove?.id): Promise<boolean> {level: outcome.conflicts.length ? "warning" : "info",title: "Refactoring undone",body: outcome.conflicts.length- ? `Changed since the refactoring, not reverted: ${outcome.conflicts.map(nameOf).join(", ")}`+ ? tx`Changed since the refactoring, not reverted: ${outcome.conflicts.map(nameOf).join(", ")}`: undefined,key: "project.refactor.done",});diff --git a/src/features/project-tree/operations.ts b/src/features/project-tree/operations.tsindex 47793ff6e..1c8b54213 100644--- a/src/features/project-tree/operations.ts+++ b/src/features/project-tree/operations.ts@@ -37,6 +37,7 @@ import {startEditing,useProjectTree,} from "./store";+import { tx } from "@/platform/i18n";/** Nodes that may be renamed, moved or deleted (not roots, groups or library sources). */const mutable = (n: ProjectNode) => !n.root && !n.placeholder && !n.readOnly;@@ -367,7 +368,7 @@ export async function safeToDelete(files: string[]): Promise<boolean> {if (user.choice) return user.choice === "skip";if (result.status !== "ok" || !result.usages.length) return true;const name = files.length === 1 ? nameOf(files[0]!) : `${files.length} files`;- const subject = files.length === 1 ? `File '${name}'` : `The ${name}`;+ const subject = files.length === 1 ? tx`File '${name}'` : tx`The ${files.length} files`;const answer = await askUsagesDetected(subject, result.usages, files.length > 1);if (answer === "view") viewUsages(name, result.usages);return answer === "delete";diff --git a/src/features/run/ConfigChooser.tsx b/src/features/run/ConfigChooser.tsxindex ce074f0ab..864b594af 100644--- a/src/features/run/ConfigChooser.tsx+++ b/src/features/run/ConfigChooser.tsx@@ -7,6 +7,7 @@ import type { RunConfig } from "@/platform/ipc";import { commandLine, configIcon, groupConfigs } from "./configs";import { canDeleteConfig, CURRENT_FILE, deleteConfig, saveTemporary, selectConfig, startRun, useRun } from "./store";import styles from "./Run.module.css";+import { tx } from "@/platform/i18n";type Row =| { type: "section"; key: string; label: string }@@ -281,7 +282,7 @@ function ConfigChooser() {icon="run"size="small"iconSize={11}- title={`Run '${c.name}'`}+ title={tx`Run '${c.name}'`}tabIndex={-1}onClick={(e) => {e.stopPropagation();@@ -292,7 +293,7 @@ function ConfigChooser() {icon="debug"size="small"iconSize={13}- title={`Debug '${c.name}'`}+ title={tx`Debug '${c.name}'`}tabIndex={-1}onClick={(e) => {e.stopPropagation();diff --git a/src/features/run/ConfigForm.tsx b/src/features/run/ConfigForm.tsxindex 1b0d4698a..dcd55e56f 100644--- a/src/features/run/ConfigForm.tsx+++ b/src/features/run/ConfigForm.tsx@@ -545,7 +545,7 @@ export function ConfigForm({ config, all, type, errors, template, onChange, modiicon="close"size="small"iconSize={10}- title={`Remove '${OPTION_LABELS[id]}'`}+ title={tx`Remove '${OPTION_LABELS[id]}'`}onClick={() => update(optionPatch(id, false))}/></span>diff --git a/src/features/run/RunView.tsx b/src/features/run/RunView.tsxindex c4187ed67..970a1be2b 100644--- a/src/features/run/RunView.tsx+++ b/src/features/run/RunView.tsx@@ -28,6 +28,7 @@ import {import { TestTreeView, formatDuration } from "./TestTreeView";import { StackTracePanel, closeStackTrace, useStackTraces, type StackTraceTab } from "./stackTrace";import styles from "./Run.module.css";+import { tx } from "@/platform/i18n";function failed(s: RunSession): boolean {return s.status === "failed" || (s.status === "finished" && s.exitCode !== 0 && !s.stopped);@@ -81,7 +82,7 @@ function SessionPanel({ session }: { session: RunSession }) {cwd={cwd}onData={(data) => writeTerminal(session.id, data)}onResize={(cols, rows) => resizeTerminal(session.id, cols, rows)}- aria-label={`${session.config.name} terminal`}+ aria-label={tx`${session.config.name} terminal`}/>) : (<ConsoleView@@ -102,7 +103,7 @@ function SessionPanel({ session }: { session: RunSession }) {}: undefined}- aria-label={`${session.config.name} output`}+ aria-label={tx`${session.config.name} output`}/>)}</div>@@ -196,7 +197,7 @@ function sessionItems(sessions: readonly RunSession[]): TabItem[] {closable: true,tooltip:s.status === "finished"- ? `Finished in ${formatDuration((s.endedAt ?? s.startedAt) - s.startedAt)}, exit code ${s.exitCode ?? "?"}`+ ? tx`Finished in ${formatDuration((s.endedAt ?? s.startedAt) - s.startedAt)}, exit code ${s.exitCode ?? "?"}`: undefined,}));}diff --git a/src/features/run/RunWidget.tsx b/src/features/run/RunWidget.tsxindex d95cfde63..eb08ddfc1 100644--- a/src/features/run/RunWidget.tsx+++ b/src/features/run/RunWidget.tsx@@ -85,7 +85,7 @@ export function RunWidget() {size="large"iconSize={16}className={clsx(styles.widgetButton, styles.widgetFilled, styles.widgetFilledRun)}- title={`Rerun '${compoundRunning.length && selected ? selected.name : target.config.name}'`}+ title={tx`Rerun '${compoundRunning.length && selected ? selected.name : target.config.name}'`}shortcut={shortcutLabel("run.run")}onClick={() => (compoundRunning.length && selected ? void startRun(selected) : rerunSession(target.id))}/>@@ -96,10 +96,10 @@ export function RunWidget() {className={clsx(styles.widgetButton, styles.widgetFilled, styles.widgetFilledStop)}title={compoundRunning.length && selected- ? `Stop '${selected.name}'`+ ? tx`Stop '${selected.name}'`: running.length > 1- ? `Stop (${running.length} running)`- : `Stop '${target.config.name}'`+ ? tx`Stop (${running.length} running)`+ : tx`Stop '${target.config.name}'`}shortcut={shortcutLabel("run.stop")}onClick={() =>@@ -155,8 +155,8 @@ export function RunWidget() {title={selected? debugOnly- ? `'${selected.name}' can only be debugged`- : `Run '${selected.name}'`+ ? tx`'${selected.name}' can only be debugged`+ : tx`Run '${selected.name}'`: currentFile? "Run Current File": "Run"@@ -170,7 +170,7 @@ export function RunWidget() {size="large"iconSize={18}className={styles.widgetButton}- title={selected ? `Debug '${selected.name}'` : currentFile ? "Debug Current File" : "Debug"}+ title={selected ? tx`Debug '${selected.name}'` : currentFile ? "Debug Current File" : "Debug"}shortcut={shortcutLabel("run.debug")}disabled={!selected && !currentFile}onClick={() => void executeAction("run.debug")}diff --git a/src/features/run/TestTreeView.tsx b/src/features/run/TestTreeView.tsxindex 0e9ab2444..71aafa6ce 100644--- a/src/features/run/TestTreeView.tsx+++ b/src/features/run/TestTreeView.tsx@@ -6,6 +6,7 @@ import { openTarget } from "./navigate";import { nodeStatus, type TestNode, type TestResults, type TestStatus } from "./testing";import { parseComparison } from "./testing/comparison";import styles from "./Run.module.css";+import { tx } from "@/platform/i18n";/** Test tree filters, kept across runs and restarts (IDEA hides passed tests by default). */const FILTERS_KEY = "openidea.run.testFilters";@@ -39,7 +40,7 @@ export function showTestDiff(node: TestNode): boolean {if (!c) return false;void executeAction("diff.compareTexts", {path: `${node.path.join("/")}.txt`,- title: `Comparison Failure: ${node.name}`,+ title: tx`Comparison Failure: ${node.name}`,left: { text: c.expected, label: c.labels?.expected ?? "Expected" },right: { text: c.actual, label: c.labels?.actual ?? "Actual" },});@@ -136,8 +137,8 @@ export function TestTreeView({ results, version, cwd, selected, onSelect, runninconst items: MenuItem[] = [];if (onRunTests) {items.push(- { label: `Run '${name}'`, verbatim: true, icon: "run", run: () => onRunTests(ids, false) },- { label: `Debug '${name}'`, verbatim: true, icon: "debug", run: () => onRunTests(ids, true) },+ { label: tx`Run '${name}'`, verbatim: true, icon: "run", run: () => onRunTests(ids, false) },+ { label: tx`Debug '${name}'`, verbatim: true, icon: "debug", run: () => onRunTests(ids, true) },{ kind: "separator" },);}diff --git a/src/features/run/contextRun.ts b/src/features/run/contextRun.tsindex 5c3b70bb8..2603ad48b 100644--- a/src/features/run/contextRun.ts+++ b/src/features/run/contextRun.ts@@ -32,6 +32,7 @@ import { runWithExecutor } from "./executors";import { goModulePath, loadGoModules } from "./goModules";import { toolEnv } from "./runtimes";import { adoptTemporary, loadConfigs, modifyTemporary, startRun, useRun } from "./store";+import { tx } from "@/platform/i18n";const CONTENT_LIMIT = 400_000;@@ -180,7 +181,7 @@ export function choiceItems(choices: readonly Produced[], debug: boolean): MenuI{ kind: "header", label: debug ? "Choose configuration to debug" : "Choose configuration to run" },...choices.map((p): MenuItem => ({- label: `${debug ? "Debug" : "Run"} '${p.name}'`,+ label: debug ? tx`Debug '${p.name}'` : tx`Run '${p.name}'`,verbatim: true,icon: debug ? "debug" : "run",shortcut: p.detail,@@ -316,10 +317,10 @@ export function contextMenuItems(menu: ContextMenuId, ctx: MenuGroupContext): Meif (!p) return [];const arg: ContextArg = { path, line, dir, content: dir ? undefined : input.content };return [- { kind: "action", action: "run.runContext", arg, label: `Run '${p.name}'`, icon: "run" },+ { kind: "action", action: "run.runContext", arg, label: tx`Run '${p.name}'`, icon: "run" },// Like IDEA, Debug only where a debugger can run it....(p.debug || p.config?.debugAdapter || p.missing- ? ([{ kind: "action", action: "run.debugContext", arg, label: `Debug '${p.name}'`, icon: "debug" }] as MenuItem[])+ ? ([{ kind: "action", action: "run.debugContext", arg, label: tx`Debug '${p.name}'`, icon: "debug" }] as MenuItem[]): []),{label: "More Run/Debug",diff --git a/src/features/run/dialogs.tsx b/src/features/run/dialogs.tsxindex 3bae27b36..edd3b5eaa 100644--- a/src/features/run/dialogs.tsx+++ b/src/features/run/dialogs.tsx@@ -6,6 +6,7 @@ import { loadSettings } from "@/platform/project";import { Dialog, Input } from "@/ui";import { confirmChecked } from "@/workbench/messages";import styles from "./Run.module.css";+import { tx } from "@/platform/i18n";interface Pending {title: string;@@ -20,8 +21,11 @@ const useRunDialog = create<{ pending: Pending | null }>(() => ({ pending: null*/export async function confirmRerun(name: string, instances = 1): Promise<boolean> {const answer = await confirmChecked({- title: `Process '${name}' Is Running`,- message: `'${name}' is not allowed to run in parallel.\nWould you like to stop ${instances > 1 ? `${instances} running instances` : "the running one"}?`,+ title: tx`Process '${name}' Is Running`,+ message:+ instances > 1+ ? tx`'${name}' is not allowed to run in parallel.\nWould you like to stop ${instances} running instances?`+ : tx`'${name}' is not allowed to run in parallel.\nWould you like to stop the running one?`,ok: "Stop and Rerun",checkbox: "Do not ask again",});@@ -39,8 +43,8 @@ export async function confirmRerun(name: string, instances = 1): Promise<boolean/** IDEA's question before closing a Run tab whose process still runs. Resolves true for Terminate. */export async function confirmTerminate(name: string): Promise<boolean> {const answer = await confirmChecked({- title: `Process '${name}' Is Running`,- message: `Do you want to terminate the process '${name}'?`,+ title: tx`Process '${name}' Is Running`,+ message: tx`Do you want to terminate the process '${name}'?`,ok: "Terminate",checkbox: "Do not ask again",});diff --git a/src/features/run/index.ts b/src/features/run/index.tsindex 7f8978c56..1355f5ca5 100644--- a/src/features/run/index.ts+++ b/src/features/run/index.ts@@ -65,6 +65,7 @@ import {stopSession,useRun,} from "./store";+import { tx } from "@/platform/i18n";function hasProject() {return !!useProject.getState().project;@@ -117,7 +118,7 @@ async function debugConfig(config: RunConfig, chain: readonly string[] = []) {group: "run",level: "warning",title: "Debugger is not available",- body: `Running '${config.name}' without the debugger.`,+ body: tx`Running '${config.name}' without the debugger.`,key: "run-no-debugger",});await startRun(config, undefined, undefined, { prepared: true });diff --git a/src/features/run/navigate.ts b/src/features/run/navigate.tsindex 2d73e7ba4..77c18078d 100644--- a/src/features/run/navigate.ts+++ b/src/features/run/navigate.ts@@ -3,6 +3,7 @@ import { call, commands, isTauri, nextRequestId } from "@/platform/ipc";import { useProject } from "@/platform/project";import { editorService, notifications } from "@/workbench/contributions";import { joinPath, type FileTarget } from "./links";+import { tx } from "@/platform/i18n";async function exists(path: string): Promise<boolean> {const slash = path.lastIndexOf("/");@@ -99,7 +100,7 @@ export async function openTarget(target: FileTarget, cwd: string, focus = true):group: "run",level: "info",title: "No sources for this class",- body: `${target.className.split("$")[0]} is not part of the project, and no library sources are available for it.`,+ body: tx`${target.className.split("$")[0]!} is not part of the project, and no library sources are available for it.`,key: "run-link",});return;diff --git a/src/features/run/producers.ts b/src/features/run/producers.tsindex a6fb12759..87d74641c 100644--- a/src/features/run/producers.ts+++ b/src/features/run/producers.ts@@ -16,6 +16,7 @@ import { applicationConfig, jvmModuleDir } from "./application";import { formatArgs } from "./configs";import { contextConfig, fileRole, projectPython, testBasesFor, testConfigFor } from "./context";import { detectRunTargets, targetConfig, targetLanguage, type RunTarget } from "./targets";+import { tx } from "@/platform/i18n";export interface LocatedTool {path: string | null;@@ -300,7 +301,7 @@ const LANGUAGE_NAMES: Partial<Record<ScriptLanguage, string>> = {function missing(lang: ScriptLanguage, file: string, tools: string[]): Missing {const what = LANGUAGE_NAMES[lang] ?? tools[0] ?? lang;return {- title: `Cannot run '${file}'`,+ title: tx`Cannot run '${file}'`,body: `${what} was not found (looked for ${tools.map((t) => `\`${t}\``).join(", ")}). ${INSTALL[lang] ?? ""}`.trim(),};}@@ -421,7 +422,7 @@ function jsRuntime(lang: "js" | "ts", env: ToolEnv, s: FileSite): Produced {name,scope: "file",missing: {- title: `Cannot run '${name}'`,+ title: tx`Cannot run '${name}'`,body:`Running TypeScript needs Node.js 22.6+ (type stripping), tsx or ts-node. ${found}` +"Upgrade Node.js (https://nodejs.org), or install tsx: `npm install -D tsx` (or `npm install -g tsx`).",diff --git a/src/features/run/runGutter.ts b/src/features/run/runGutter.tsindex e42f206e4..ea69fa1b9 100644--- a/src/features/run/runGutter.ts+++ b/src/features/run/runGutter.ts@@ -22,6 +22,7 @@ import { onTestStatesChanged, testState, testStatesVersion, type TestState } fro/** Languages with gutter run targets (C / C++ `main` included). */const hasGutterTargets = (path: string) => !!targetLanguage(path) || /\.(c|cpp|cc|cxx)$/.test(path);import styles from "./Run.module.css";+import { tx } from "@/platform/i18n";interface PlacedTarget extends RunTarget {/** Line start offset in the current state. */@@ -104,9 +105,9 @@ export function targetMenuItems(target: RunTarget, path: string, content: string// Like IDEA, Debug only where a debugger can run it.const debuggable = !p || !!(p.debug || p.config?.debugAdapter || p.missing);return [- { label: `Run '${name}'`, icon: "run", shortcut: shortcutLabel("run.runContext"), ...pick(false) } as MenuItem,+ { label: tx`Run '${name}'`, icon: "run", shortcut: shortcutLabel("run.runContext"), ...pick(false) } as MenuItem,...(debuggable- ? [{ label: `Debug '${name}'`, icon: "debug", shortcut: shortcutLabel("run.debugContext"), ...pick(true) } as MenuItem]+ ? [{ label: tx`Debug '${name}'`, icon: "debug", shortcut: shortcutLabel("run.debugContext"), ...pick(true) } as MenuItem]: []),...runExecutors().filter((e) => !!p?.config && e.supports(p.config))diff --git a/src/features/run/services.tsx b/src/features/run/services.tsxindex 597453d8d..348b0a16e 100644--- a/src/features/run/services.tsx+++ b/src/features/run/services.tsx@@ -9,7 +9,7 @@ import { create } from "zustand";import { executeAction } from "@/platform/actions";import type { RunConfig } from "@/platform/ipc";import { useProject } from "@/platform/project";-import { useT, useTxTemplate } from "@/platform/i18n";+import { tx, useT, useTxTemplate } from "@/platform/i18n";import { Button, EmptyState, T } from "@/ui";import type { MenuItem } from "@/ui";import {@@ -120,7 +120,7 @@ export function runServiceItems(key: TYPE_PREFIX + kind,label: kindLabel(kind),icon: configIcon({ kind, isTest: false }),- detail: running ? `${running} running` : undefined,+ detail: running ? tx`${running} running` : undefined,children,};});diff --git a/src/features/run/stackTrace.tsx b/src/features/run/stackTrace.tsxindex 991326735..485d66ebb 100644--- a/src/features/run/stackTrace.tsx+++ b/src/features/run/stackTrace.tsx@@ -15,6 +15,7 @@ import { ConsoleView } from "./ConsoleView";import { findOutputLinks } from "./links";import { useRun } from "./store";import styles from "./StackTrace.module.css";+import { tx } from "@/platform/i18n";export interface StackTraceTab {id: string;@@ -142,7 +143,7 @@ export function StackTracePanel({ tab }: { tab: StackTraceTab }) {follow={false}onFollowChange={() => {}}cwd={root}- aria-label={`Stack trace ${tab.title}`}+ aria-label={tx`Stack trace ${tab.title}`}/>);}diff --git a/src/features/run/store.ts b/src/features/run/store.tsindex 05270508f..e7c7b045e 100644--- a/src/features/run/store.ts+++ b/src/features/run/store.ts@@ -21,6 +21,7 @@ import { failedTestPaths, leafTestPaths, rerunFailedConfig, testsConfig } from "import { compoundChildren } from "./configs";import { TerminalOutput } from "./terminalOutput";import { typeFor } from "./types";+import { tx } from "@/platform/i18n";/** The permanent "Current File" pseudo-configuration of the chooser (runs the active file's context). */export const CURRENT_FILE = "current-file";@@ -549,7 +550,7 @@ export async function startRun(}} catch (e) {const message = e instanceof Error ? e.message : String(e);- enqueue(sessionId, { kind: "stderr", text: `Error running '${config.name}': ${message}\n` });+ enqueue(sessionId, { kind: "stderr", text: tx`Error running '${config.name}': ${message}\n` });flush(sessionId);patchSession(sessionId, { status: "failed", endedAt: Date.now() });notifications().notify({ group: "run", level: "error", title: `Error running '${config.name}'`, body: message });@@ -795,7 +796,7 @@ export async function sendStdin(sessionId: string, text: string): Promise<void>try {await call(commands.runStdin(session.runId, text + "\n"));} catch (e) {- enqueue(sessionId, { kind: "system", text: `Cannot write to stdin: ${e instanceof Error ? e.message : String(e)}\n` });+ enqueue(sessionId, { kind: "system", text: tx`Cannot write to stdin: ${e instanceof Error ? e.message : String(e)}\n` });}}diff --git a/src/features/run/types.ts b/src/features/run/types.tsindex 9d30c8a11..f9a69453c 100644--- a/src/features/run/types.ts+++ b/src/features/run/types.ts@@ -11,6 +11,7 @@ import {type RunConfigTypeContribution,} from "@/workbench/contributions";import { formatArgs, parseArgs, uid, uniqueName } from "./configs";+import { tx } from "@/platform/i18n";export const COMPOUND = "compound";@@ -203,21 +204,21 @@ function buildToolType(id: string,label: string,icon: string,- tasksLabel: string,+ tasks: { label: string; description: string },wrapper: { unix: string; windows: string; plain: string; label: string; byDefault: boolean },): RunConfigTypeContribution {return {id,label,icon,- description: `Run ${label} ${tasksLabel.toLowerCase()}`,+ description: tasks.description,defaults: wrapper.byDefault ? { wrapper: "true" } : {},ownsWorkingDirectory: true,fields: [- { key: "projectDir", label: `${label} project`, mono: true, placeholder: "Project root" },+ { key: "projectDir", label: tx`${label} project`, mono: true, placeholder: "Project root" },{key: "tasks",- label: tasksLabel,+ label: tasks.label,mono: true,required: true,suggestions: (configs) => argsOf(configs, id, 0),@@ -244,7 +245,7 @@ function buildToolType(};}-const gradle = buildToolType("gradle", "Gradle", "file-gradle", "Tasks", {+const gradle = buildToolType("gradle", "Gradle", "file-gradle", { label: "Tasks", description: "Run Gradle tasks" }, {unix: "gradlew",windows: "gradlew.bat",plain: "gradle",@@ -252,7 +253,7 @@ const gradle = buildToolType("gradle", "Gradle", "file-gradle", "Tasks", {byDefault: true,});-const maven = buildToolType("maven", "Maven", "file-maven", "Goals", {+const maven = buildToolType("maven", "Maven", "file-maven", { label: "Goals", description: "Run Maven goals" }, {unix: "mvnw",windows: "mvnw.cmd",plain: "mvn",diff --git a/src/features/search/bookmarks/BookmarksView.tsx b/src/features/search/bookmarks/BookmarksView.tsxindex 247ce263a..393e5856f 100644--- a/src/features/search/bookmarks/BookmarksView.tsx+++ b/src/features/search/bookmarks/BookmarksView.tsx@@ -3,7 +3,7 @@ import clsx from "clsx";import { executeAction } from "@/platform/actions";import { shortcutLabel } from "@/platform/keymap";import { confirm } from "@/workbench/messages";-import { useT, useTx } from "@/platform/i18n";+import { tx, useT, useTx } from "@/platform/i18n";import { EmptyState, Icon, IconButton, Tree, fileIconName, showContextMenu, type MenuItem } from "@/ui";import { basename, openLocation, relPath } from "../common/open";import {@@ -118,7 +118,10 @@ async function removeList(list: BookmarkList, count: number) {count &&!(await confirm({title: "Delete Bookmark List",- message: `Delete the list '${list.name}' with its ${count} bookmark${count === 1 ? "" : "s"}?`,+ message:+ count === 1+ ? tx`Delete the list '${list.name}' with its ${count} bookmark?`+ : tx`Delete the list '${list.name}' with its ${count} bookmarks?`,ok: "Delete",})))@@ -263,7 +266,7 @@ export function BookmarksView() {...(bookmarks.length ? [{ label: "Move to Another List", submenu: moveMenu(bookmarks, lists) }] : []),{ kind: "separator" as const },{- label: targets.length > 1 ? `Delete ${targets.length} Bookmarks` : "Delete Bookmark",+ label: targets.length > 1 ? tx`Delete ${targets.length} Bookmarks` : "Delete Bookmark",danger: true,run: () => removeNodes(targets),},diff --git a/src/features/search/index.ts b/src/features/search/index.tsindex c61173f46..f086032d4 100644--- a/src/features/search/index.ts+++ b/src/features/search/index.ts@@ -43,6 +43,7 @@ import { RecentPopupsOverlay } from "./recent/RecentPopups";import { cycleSwitcher, hideRecentPopup, showRecentPopup } from "./recent/store";import { FileStructureOverlay, useFileStructurePopup } from "./structure/StructureView";import { useOutline, useStructureOptions } from "./structure/store";+import { tx } from "@/platform/i18n";/** Single-line editor selection, used to prefill search fields. */function editorSelectionText(): string | null {@@ -452,7 +453,7 @@ export function activate(): void | (() => void) {...[..."0123456789"].flatMap((d) => [{id: `navigate.toggleBookmark${d}`,- title: `Toggle Bookmark ${d}`,+ title: tx`Toggle Bookmark ${d}`,category: "Bookmarks",when: "projectOpen && textEditorActive",run: () => {@@ -462,7 +463,7 @@ export function activate(): void | (() => void) {},{id: `navigate.gotoBookmark${d}`,- title: `Go to Bookmark ${d}`,+ title: tx`Go to Bookmark ${d}`,category: "Bookmarks",when: "projectOpen",run: () => {diff --git a/src/features/services/docker.tsx b/src/features/services/docker.tsxindex 52442d216..55277aa17 100644--- a/src/features/services/docker.tsx+++ b/src/features/services/docker.tsx@@ -14,7 +14,7 @@ import type {DockerObject,DockerRegistry,} from "@/platform/ipc";-import { useTx, useTxTemplate } from "@/platform/i18n";+import { tx, useTx, useTxTemplate } from "@/platform/i18n";import { call, commands, isCancelled, nextRequestId } from "@/platform/ipc";import { Button, EmptyState, IconButton, Spinner, Tabs, Toggle, T } from "@/ui";import type { MenuItem } from "@/ui";@@ -168,7 +168,7 @@ async function removeConnectionPrompt(c: DockerConnection) {if (await confirm({title: "Remove Docker Connection",- message: `Remove the connection '${c.name}' from Services?`,+ message: tx`Remove the connection '${c.name}' from Services?`,ok: "Remove",}))@@ -179,7 +179,7 @@ async function removeRegistryPrompt(r: DockerRegistry) {if (await confirm({title: "Remove Docker Registry",- message: `Remove the registry '${r.name}' and its saved password?`,+ message: tx`Remove the registry '${r.name}' and its saved password?`,ok: "Remove",}))diff --git a/src/features/services/ops.ts b/src/features/services/ops.tsindex 4f358b416..62d0f6de0 100644--- a/src/features/services/ops.ts+++ b/src/features/services/ops.ts@@ -1,5 +1,5 @@/** What the Services toolbar, context menu and `docker.*` actions do with a node of a connection. */-import { txTemplate } from "@/platform/i18n";+import { tx, txTemplate } from "@/platform/i18n";import type { PruneTarget } from "@/platform/ipc";import { executeAction } from "@/platform/actions";import type { MenuItem } from "@/ui";@@ -47,6 +47,24 @@ function composeAction(conn: string, n: Extract<ServiceNode, { kind: "compose" }return composeOp(conn, n.project, first?.composeFiles ?? [], first?.composeWorkingDir ?? null, op).then(() => undefined);}+function deleteQuestion(kind: "container" | "image" | "volume" | "network", label: string, running: boolean) {+ switch (kind) {+ case "container":+ return {+ title: "Delete Container",+ message: running+ ? tx`Delete container '${label}'? It is running and will be stopped.`+ : tx`Delete container '${label}'?`,+ };+ case "image":+ return { title: "Delete Image", message: tx`Delete image '${label}'?` };+ case "volume":+ return { title: "Delete Volume", message: tx`Delete volume '${label}'?` };+ case "network":+ return { title: "Delete Network", message: tx`Delete network '${label}'?` };+ }+}+export async function remove(t: DockerTarget | null) {if (!t || !canRemove(t)) return;const n = t.node;@@ -54,7 +72,7 @@ export async function remove(t: DockerTarget | null) {if (n.kind === "compose") {const ok = await confirm({title: "Compose Down",- message: `Stop and remove the containers and networks of '${label}'?`,+ message: tx`Stop and remove the containers and networks of '${label}'?`,ok: "Down",});if (ok) await composeAction(t.conn, n, "down");@@ -64,8 +82,7 @@ export async function remove(t: DockerTarget | null) {const what = n.kind;const running = n.kind === "container" && isRunning(n.container);const answer = await confirmChecked({- title: `Delete ${what[0]!.toUpperCase()}${what.slice(1)}`,- message: `Delete ${what} '${label}'?${running ? " It is running and will be stopped." : ""}`,+ ...deleteQuestion(what, label, running),ok: "Delete",checkbox: n.kind === "image" ? "Force (also untag / remove when used by stopped containers)" : undefined,});@@ -107,6 +124,23 @@ export async function prunePrompt(conn: string, target: PruneTarget) {if (ok) await prune(conn, target);}+function pruneLabel(target: PruneTarget): string {+ switch (target) {+ case "containers":+ return tx("Prune Unused Containers…");+ case "images":+ return tx("Prune Dangling Images…");+ case "allImages":+ return tx("Prune Unused Images…");+ case "volumes":+ return tx("Prune Unused Volumes…");+ case "networks":+ return tx("Prune Unused Networks…");+ case "system":+ return tx("Prune Everything Unused…");+ }+}+export function pruneMenu(conn: string): MenuItem[] {return PRUNE.map(([target, label]) => ({ label, run: () => void prunePrompt(conn, target) }));}@@ -155,7 +189,7 @@ export function nodeMenu(t: DockerTarget): MenuItem[] {if (n.kind === "group") {const target: PruneTarget = n.group === "containers" ? "containers" : n.group === "images" ? "images" : n.group === "volumes" ? "volumes" : "networks";items.push({- label: txTemplate(`Prune ${n.group === "images" ? "Dangling Images" : `Unused ${n.group[0]!.toUpperCase()}${n.group.slice(1)}`}…`),+ label: pruneLabel(target),run: () => void prunePrompt(conn, target),});}diff --git a/src/features/services/runTypes.ts b/src/features/services/runTypes.tsindex 4f2ca0518..25413b5d5 100644--- a/src/features/services/runTypes.ts+++ b/src/features/services/runTypes.ts@@ -11,6 +11,7 @@ import { call, commands, type RunConfig } from "@/platform/ipc";import { registerRunConfigType, type RunConfigTypeContribution } from "@/workbench/contributions";import { imageTag, targetTitle, type DockerTarget } from "./compose";import { connections, endpointOf, loadSettings, useServices } from "./store";+import { tx } from "@/platform/i18n";export const DOCKERFILE = "docker-dockerfile";export const DOCKER_IMAGE = "docker-image";@@ -279,7 +280,7 @@ export function gutterActions(config: typedConfig(dockerfileType, `docker:dockerfile:${file}`, file, { ...params, runImage: "true" }),},{- title: `Build Image '${params.tag}'`,+ title: tx`Build Image '${params.tag}'`,config: typedConfig(dockerfileType, `docker:build:${file}`, `Build ${file}`, params),},];diff --git a/src/features/settings/components/Form.tsx b/src/features/settings/components/Form.tsxindex d5fa308dc..98c91225c 100644--- a/src/features/settings/components/Form.tsx+++ b/src/features/settings/components/Form.tsx@@ -146,7 +146,7 @@ export function NumberInput({ id, value, onChange, min, max, step = 1, integer,aria-label={aria["aria-label"]}aria-valuemin={min}aria-valuemax={max}- title={invalid ? `Enter a value between ${min} and ${max}` : undefined}+ title={invalid ? tx`Enter a value between ${min} and ${max}` : undefined}onChange={(e) => {setDraft(e.target.value);const n = parseNumberInput(e.target.value, { min, max, integer });diff --git a/src/features/settings/keymap/KeymapPage.tsx b/src/features/settings/keymap/KeymapPage.tsxindex 9fbf95632..c1be71848 100644--- a/src/features/settings/keymap/KeymapPage.tsx+++ b/src/features/settings/keymap/KeymapPage.tsx@@ -52,6 +52,7 @@ import { KeymapNameDialog } from "./KeymapDialogs";import { RecordShortcutDialog } from "./RecordShortcutDialog";import { StrokeRecorder } from "./StrokeRecorder";import styles from "./Keymap.module.css";+import { tx } from "@/platform/i18n";type KNode =| { kind: "group"; key: string; name: string; path: string[]; children: KNode[] }@@ -206,14 +207,14 @@ export function KeymapPage() {...Object.keys(PRESETS).map((id) => ({ value: id, label: PRESET_TITLES[id] ?? id })),...Object.entries(customs).sort(([, a], [, b]) => a.name.localeCompare(b.name))- .map(([id, k]) => ({ value: id, label: k.name, detail: `based on ${PRESET_TITLES[k.parent] ?? k.parent}` })),+ .map(([id, k]) => ({ value: id, label: k.name, detail: tx`based on ${PRESET_TITLES[k.parent] ?? k.parent}` })),];const confirmDelete = async () => {if (!(await confirm({title: "Delete Keymap",- message: `Delete keymap '${keymapName(selectedId, customs)}'?`,+ message: tx`Delete keymap '${keymapName(selectedId, customs)}'?`,ok: "Delete",})))@@ -252,7 +253,7 @@ export function KeymapPage() {{ kind: "separator" },...(bindings.length? bindings.map((b) => ({- label: `Remove ${formatBinding(b)}`,+ label: tx`Remove ${formatBinding(b)}`,icon: "minus",run: () => change(removeBinding(draft, action.id, b)),}))diff --git a/src/features/settings/keymap/RecordShortcutDialog.tsx b/src/features/settings/keymap/RecordShortcutDialog.tsxindex f1e857899..ae7010832 100644--- a/src/features/settings/keymap/RecordShortcutDialog.tsx+++ b/src/features/settings/keymap/RecordShortcutDialog.tsx@@ -12,6 +12,7 @@ import { findConflicts, resolveBindings, type Conflict, type KeymapDraft } fromimport { groupPath } from "./groups";import { StrokeRecorder } from "./StrokeRecorder";import styles from "./Keymap.module.css";+import { tx } from "@/platform/i18n";export interface RecordShortcutDialogProps {action: Pick<Action, "id" | "title" | "category" | "when">;@@ -61,7 +62,7 @@ export function RecordShortcutDialog({ action, actions, draft, onCancel, onSubmi<DialogopenonClose={onCancel}- title={`Keyboard Shortcut: ${action.title}`}+ title={tx`Keyboard Shortcut: ${action.title}`}width={440}buttons={[{ label: "OK", role: "default", disabled: !binding || already, onClick: () => void ok() },diff --git a/src/features/settings/languages/ProjectStructurePage.tsx b/src/features/settings/languages/ProjectStructurePage.tsxindex dfdebf81f..58f1745b6 100644--- a/src/features/settings/languages/ProjectStructurePage.tsx+++ b/src/features/settings/languages/ProjectStructurePage.tsx@@ -31,6 +31,7 @@ import { initProjectRoots, useDetectedRoots } from "@/platform/projectRoots";import { choosePath } from "./api";import { useProjectSetting } from "./components";import styles from "./Sdk.module.css";+import { tx } from "@/platform/i18n";interface DirNode {path: string;@@ -136,7 +137,7 @@ function ContentRoots({ root }: { root: string }) {icon="close"size="small"iconSize={12}- title={`Remove content root ${r}`}+ title={tx`Remove content root ${r}`}onClick={() => setRoots(list.filter((x) => x !== r))}/></div>@@ -305,7 +306,7 @@ export function ProjectStructurePage() {icon="close"size="small"iconSize={12}- title={`Unmark ${shown}`}+ title={tx`Unmark ${shown}`}onClick={() => setPs(markFolder(ps, x.path, null, detected))}/></div>diff --git a/src/features/settings/pages/FileTypes.tsx b/src/features/settings/pages/FileTypes.tsxindex 531659cfa..ebf4bee05 100644--- a/src/features/settings/pages/FileTypes.tsx+++ b/src/features/settings/pages/FileTypes.tsx@@ -19,6 +19,7 @@ import {import { GlobListEditor, Row } from "../components/Form";import { useSetting } from "../components/context";import styles from "./FileTypes.module.css";+import { tx } from "@/platform/i18n";function useLanguages(): LanguageInfo[] {const [langs, setLangs] = useState<LanguageInfo[]>([]);@@ -108,7 +109,7 @@ export function RecognizedFileTypes() {value={patterns}onChange={(next) => setAssoc(applyPatternEdit(current, langs, selected, next))}placeholder="*.ext"- aria-label={`File name patterns of ${selected.name}`}+ aria-label={tx`File name patterns of ${selected.name}`}/></Row><Row@@ -120,7 +121,7 @@ export function RecognizedFileTypes() {value={hashbangs}onChange={(next) => setAssoc(setHashbangs(current, selected.id, next))}placeholder="interpreter"- aria-label={`Hashbang patterns of ${selected.name}`}+ aria-label={tx`Hashbang patterns of ${selected.name}`}/></Row>{selected.firstLine && (diff --git a/src/features/settings/pages/behavior.tsx b/src/features/settings/pages/behavior.tsxindex 8b26a387b..5afe55657 100644--- a/src/features/settings/pages/behavior.tsx+++ b/src/features/settings/pages/behavior.tsx@@ -27,7 +27,7 @@ import {import { ACCENT_PRESETS, LIMITS, type ThemeId } from "../model/schema";import type { PageSpec } from "./spec";import styles from "./Behavior.module.css";-import { useT } from "@/platform/i18n";+import { tx, useT } from "@/platform/i18n";import { BUILTIN_THEMES } from "@/platform/themes";@@ -465,14 +465,14 @@ function NotificationGroupsTable() {value={v.display}options={DISPLAY_OPTIONS}onChange={(display) => update(g.id, { display })}- aria-label={`${g.title} popup type`}+ aria-label={tx`${g.title} popup type`}/></td><td className={styles.center}><Checkboxchecked={v.log}onChange={(log) => update(g.id, { log })}- aria-label={`Show ${g.title} in tool window`}+ aria-label={tx`Show ${g.title} in tool window`}/></td></tr>diff --git a/src/features/settings/pages/editor/colorScheme.tsx b/src/features/settings/pages/editor/colorScheme.tsxindex 128ab419a..b6f10a663 100644--- a/src/features/settings/pages/editor/colorScheme.tsx+++ b/src/features/settings/pages/editor/colorScheme.tsx@@ -21,6 +21,7 @@ import { Row, Select } from "../../components/Form";import { useSetting } from "../../components/context";import { editorPage } from "./kit";import styles from "./Editor.module.css";+import { tx } from "@/platform/i18n";type Overrides = Record<string, Record<string, TextAttributesOverride>>;@@ -238,7 +239,7 @@ function ColorInput({<InputmonoclassName={styles.swatchInput}- aria-label={`${label} hex`}+ aria-label={tx`${label} hex`}value={draft ?? value}invalid={draft !== null && !HEX_COLOR.test(draft)}onChange={(e) => {diff --git a/src/features/settings/pages/editor/font.tsx b/src/features/settings/pages/editor/font.tsxindex 25e0eb205..73391f4a3 100644--- a/src/features/settings/pages/editor/font.tsx+++ b/src/features/settings/pages/editor/font.tsx@@ -11,6 +11,7 @@ import { FONT_WEIGHTS, fontWeightOf, fontWeightVars } from "@/platform/editorSetimport { LIMITS } from "../../model/schema";import { editorPage } from "./kit";import styles from "./Editor.module.css";+import { tx } from "@/platform/i18n";const CANDIDATES = ["JetBrains Mono",@@ -156,7 +157,7 @@ function WeightRow({ label, value, onChange, defaultWeight, hint }: { label: straria-label={label}/>{custom && (- <NumberInput value={weight} onChange={(n) => onChange(fontWeightOf(n, defaultWeight))} min={100} max={900} step={50} integer aria-label={`${label} custom value`} />+ <NumberInput value={weight} onChange={(n) => onChange(fontWeightOf(n, defaultWeight))} min={100} max={900} step={50} integer aria-label={tx`${label} custom value`} />)}</Row>);diff --git a/src/features/settings/pages/editor/inspections.tsx b/src/features/settings/pages/editor/inspections.tsxindex f57b53cbf..69a0103f5 100644--- a/src/features/settings/pages/editor/inspections.tsx+++ b/src/features/settings/pages/editor/inspections.tsx@@ -64,6 +64,7 @@ import {type LanguageServers,} from "./inspectionsModel";import styles from "./Inspections.module.css";+import { tx } from "@/platform/i18n";let languagesCache: LanguageServers[] | null = null;@@ -175,7 +176,7 @@ function InspectionsPage() {const isCopy = location.key !== null;const confirmDelete = async () => {- if (!(await confirm({ title: "Delete Profile", message: `Delete inspection profile '${label}'?`, ok: "Delete" })))+ if (!(await confirm({ title: "Delete Profile", message: tx`Delete inspection profile '${label}'?`, ok: "Delete" })))return;apply(deleteProfile(settings, profileId));};@@ -418,7 +419,7 @@ function InspectionRow({checked={state === "on"}indeterminate={state === "mixed"}onChange={() => onToggle(state !== "on")}- aria-label={`Enable ${node.name}`}+ aria-label={tx`Enable ${node.name}`}/></span></span>diff --git a/src/features/settings/pages/editor/inspectionsModel.ts b/src/features/settings/pages/editor/inspectionsModel.tsindex 358a20dd3..9f85990cb 100644--- a/src/features/settings/pages/editor/inspectionsModel.ts+++ b/src/features/settings/pages/editor/inspectionsModel.ts@@ -21,6 +21,7 @@ import {type ProfileOverrides,type SeenCode,} from "@/platform/inspections";+import { tx } from "@/platform/i18n";export interface InspectionNode {/** Unique in the tree (a server serving several languages appears under each). */@@ -45,14 +46,16 @@ function serverNode(group: string, server: string, codes: readonly SeenCode[], lkey: `${group}/${id}`,id,name: server,- description: `Problems the ${server} language server reports${languages ? ` in ${languages} files` : ""}. Severity "As reported" keeps the level the server assigns; a code below can override it.`,+ description: languages+ ? tx`Problems the ${server} language server reports in ${languages} files. Severity "As reported" keeps the level the server assigns; a code below can override it.`+ : tx`Problems the ${server} language server reports. Severity "As reported" keeps the level the server assigns; a code below can override it.`,children: [...codes].sort((a, b) => a.code.localeCompare(b.code, undefined, { numeric: true })).map((c) => ({key: `${group}/${codeInspectionId(id, c.code)}`,id: codeInspectionId(id, c.code),name: c.code,- description: `${server} problems with code ${c.code}${c.source && c.source !== server ? ` (${c.source})` : ""}.${c.sample ? `\n\nExample: ${c.sample}` : ""}`,+ description: codeDescription(server, c),children: [],})),};@@ -270,3 +273,11 @@ export function deleteProfile(s: InspectionSettingsValid, id: ProfileId): Inspecconst profile = s.profile === id ? (level === "project" ? "project" : "default") : s.profile;return { ...s, [field]: rest, profile };}++function codeDescription(server: string, { code, source, sample }: SeenCode): string {+ const what =+ source && source !== server+ ? tx`${server} problems with code ${code} (${source}).`+ : tx`${server} problems with code ${code}.`;+ return sample ? tx`${what}\n\nExample: ${sample}` : what;+}diff --git a/src/features/settings/pages/tools.tsx b/src/features/settings/pages/tools.tsxindex 0750d581d..24c923abd 100644--- a/src/features/settings/pages/tools.tsx+++ b/src/features/settings/pages/tools.tsx@@ -19,6 +19,7 @@ import { selectPage, setQuery } from "../model/staging";import type { PageSpec } from "./spec";import { BoundToggle, Grid, Indented, PageLink, TableEditor } from "./workflowControls";import styles from "./Workflow.module.css";+import { tx } from "@/platform/i18n";export const TOOLS_GROUP = "Tools";@@ -468,7 +469,7 @@ function ExternalToolsEditor() {onMouseDown={() => setSelected(t.id)}><Checkbox- aria-label={`Enable ${t.name}`}+ aria-label={tx`Enable ${t.name}`}checked={t.enabled}onChange={(on) => setTools(tools.map((x) => (x.id === t.id ? { ...x, enabled: on } : x)))}/>diff --git a/src/features/settings/pages/vcs.tsx b/src/features/settings/pages/vcs.tsxindex bde64e8d3..dec8219f4 100644--- a/src/features/settings/pages/vcs.tsx+++ b/src/features/settings/pages/vcs.tsx@@ -13,6 +13,7 @@ import { useSetting } from "../components/context";import type { PageSpec } from "./spec";import { BoundToggle, Grid, Indented, RadioRow, TableEditor, ToggleNumber } from "./workflowControls";import styles from "./Workflow.module.css";+import { tx } from "@/platform/i18n";const L = WORKFLOW_LIMITS;@@ -110,7 +111,7 @@ function GitExecutableRow() {monoclassName={styles.wide}value={path}- placeholder={detected ? `Auto-detected: ${detected}` : "Auto-detected"}+ placeholder={detected ? tx`Auto-detected: ${detected}` : "Auto-detected"}onChange={(e) => {setPath(e.target.value);setResult(null);diff --git a/src/features/templates/files/NewFileDialog.tsx b/src/features/templates/files/NewFileDialog.tsxindex 97c42c323..1e1e08636 100644--- a/src/features/templates/files/NewFileDialog.tsx+++ b/src/features/templates/files/NewFileDialog.tsx@@ -9,6 +9,7 @@ import { createFromTemplate, packageFor } from "./create";import { planFile, withKind, type FileTemplate } from "./model";import { useFileTemplates } from "./store";import styles from "./NewFileDialog.module.css";+import { tx } from "@/platform/i18n";interface Request {directory: string;@@ -185,17 +186,17 @@ function NameStep({<DialogopenonClose={close}- title={`New ${template.name}`}+ title={tx`New ${template.name}`}width={380}position="top"- aria-label={`New ${template.name}`}+ aria-label={tx`New ${template.name}`}><div className={styles.form}><Inputdata-autofocusvalue={name}invalid={!!error}- placeholder={effective.extension ? `Name (.${effective.extension})` : "File name with extension"}+ placeholder={effective.extension ? tx`Name (.${effective.extension})` : "File name with extension"}aria-label="Name"onChange={(e) => {setName(e.target.value);diff --git a/src/features/templates/index.ts b/src/features/templates/index.tsindex 7de5f4ef4..440a4ab11 100644--- a/src/features/templates/index.ts+++ b/src/features/templates/index.ts@@ -22,6 +22,7 @@ import type { FileTemplate } from "./files/model";import { syncTemplatesFromStorage } from "./sync";import { tagAtCaret, updateTag } from "./emmet/editor";import { promptAbbreviation, UpdateTagDialogHost } from "./emmet/UpdateTagDialog";+import { tx } from "@/platform/i18n";export { EXTRA_COMPLETION_KEY } from "./editor";@@ -42,7 +43,7 @@ async function updateTagWithEmmet() {notifications().notify({level: "warning",title: "Cannot update the tag",- body: `'${abbreviation}' does not describe a single element.`,+ body: tx`'${abbreviation}' does not describe a single element.`,key: "emmet-update-tag",});}@@ -78,7 +79,7 @@ function directoryOf(arg: unknown): string | null {function newFileAction(t: FileTemplate): Action {return {id: `templates.new.${t.id}`,- title: t.id === "file" ? "New Empty File…" : `New ${t.name}…`,+ title: t.id === "file" ? "New Empty File…" : tx`New ${t.name}…`,category: "File",icon: t.icon,when: "projectOpen",diff --git a/src/features/templates/settings/FileTemplatesPage.tsx b/src/features/templates/settings/FileTemplatesPage.tsxindex 5dcf838bd..e67fc0567 100644--- a/src/features/templates/settings/FileTemplatesPage.tsx+++ b/src/features/templates/settings/FileTemplatesPage.tsx@@ -136,7 +136,7 @@ function FilesTab() {<Checkboxchecked={t.enabled !== false}onChange={(v) => saveFileTemplate({ ...t, enabled: v })}- aria-label={`Enable ${t.name}`}+ aria-label={tx`Enable ${t.name}`}/><Icon name={t.icon} size={14} /><span className={clsx(isModifiedFileTemplate(t.id) && styles.modified)}>{t.name}</span>diff --git a/src/features/templates/settings/LiveTemplatesPage.tsx b/src/features/templates/settings/LiveTemplatesPage.tsxindex 0ee676cc0..dbe32ea2b 100644--- a/src/features/templates/settings/LiveTemplatesPage.tsx+++ b/src/features/templates/settings/LiveTemplatesPage.tsx@@ -15,6 +15,7 @@ import {} from "../live/store";import { BUILTIN_IDS } from "../live/builtins";import styles from "./Settings.module.css";+import { tx } from "@/platform/i18n";export function groupTemplates(templates: readonly LiveTemplate[], filter: string): Array<[string, LiveTemplate[]]> {const q = filter.trim().toLowerCase();@@ -106,7 +107,7 @@ export function LiveTemplatesPage() {<Checkboxchecked={t.enabled !== false}onChange={(v) => saveTemplate({ ...t, enabled: v })}- aria-label={`Enable ${t.abbrev}`}+ aria-label={tx`Enable ${t.abbrev}`}/><span className={clsx(styles.itemLabel, isModifiedBuiltin(t.id) && styles.modified)}>{t.abbrev}@@ -243,7 +244,7 @@ function TemplateEditor({ template: t }: { template: LiveTemplate }) {value={v.expression ?? ""}placeholder="className()"onChange={(e) => setVar(v.name, { expression: e.target.value || undefined })}- aria-label={`${v.name} expression`}+ aria-label={tx`${v.name} expression`}/></td><td>@@ -252,14 +253,14 @@ function TemplateEditor({ template: t }: { template: LiveTemplate }) {value={v.defaultValue ?? ""}placeholder='"value"'onChange={(e) => setVar(v.name, { defaultValue: e.target.value || undefined })}- aria-label={`${v.name} default value`}+ aria-label={tx`${v.name} default value`}/></td><td><Checkboxchecked={!!v.skipIfDefined}onChange={(c) => setVar(v.name, { skipIfDefined: c })}- aria-label={`Skip ${v.name} if defined`}+ aria-label={tx`Skip ${v.name} if defined`}/></td></tr>diff --git a/src/features/templates/settings/PostfixPage.tsx b/src/features/templates/settings/PostfixPage.tsxindex c8f097f33..fcb7aff90 100644--- a/src/features/templates/settings/PostfixPage.tsx+++ b/src/features/templates/settings/PostfixPage.tsx@@ -5,6 +5,7 @@ import { Checkbox, T } from "@/ui";import { POSTFIX_GROUPS, POSTFIX_TEMPLATES } from "../postfix/model";import { setPostfixTemplateEnabled, updatePostfixSettings, usePostfixSettings } from "../postfix/store";import styles from "./Settings.module.css";+import { tx } from "@/platform/i18n";export function PostfixPage() {const settings = usePostfixSettings();@@ -59,7 +60,7 @@ export function PostfixPage() {checked={!disabled.has(t.id)}disabled={!settings.enabled}onChange={(v) => setPostfixTemplateEnabled(t.id, v)}- aria-label={`Enable .${t.key}`}+ aria-label={tx`Enable .${t.key}`}/><span className={styles.mono}>.{t.key}</span><span className={styles.itemDetail}>{t.description}</span>diff --git a/src/features/todo/TodoSettingsPage.tsx b/src/features/todo/TodoSettingsPage.tsxindex beb6e0f95..f7a34e3fc 100644--- a/src/features/todo/TodoSettingsPage.tsx+++ b/src/features/todo/TodoSettingsPage.tsx@@ -3,6 +3,7 @@ import { Button, Checkbox, IconButton, Input, Select, T } from "@/ui";import { DEFAULT_PATTERNS, type TodoPattern } from "./model";import { updateTodoSettings, useTodoSettings } from "./store";import styles from "./TodoSettingsPage.module.css";+import { tx } from "@/platform/i18n";const COLORS = [{ value: "var(--info)", label: "Blue" },@@ -55,7 +56,7 @@ export function TodoSettingsPage() {<Checkboxchecked={p.enabled}onChange={(v) => patch(p.id, { enabled: v })}- aria-label={`Enable ${p.keyword}`}+ aria-label={tx`Enable ${p.keyword}`}/><Inputmono@@ -69,7 +70,7 @@ export function TodoSettingsPage() {value={p.color}options={COLORS}onChange={(v) => patch(p.id, { color: v })}- aria-label={`${p.keyword} colour`}+ aria-label={tx`${p.keyword} colour`}/><IconButtonicon="trash"diff --git a/src/features/todo/TodoView.tsx b/src/features/todo/TodoView.tsxindex 8e799ecb4..69c39dfa5 100644--- a/src/features/todo/TodoView.tsx+++ b/src/features/todo/TodoView.tsx@@ -41,6 +41,7 @@ import {} from "./model";import { scanProject, scanScope, updateTodoSettings, useTodoSettings, useTodos } from "./store";import styles from "./TodoView.module.css";+import { tx } from "@/platform/i18n";type Tab = "project" | "file" | "scope" | "changes";@@ -224,7 +225,7 @@ function ChangelistBar() {aria-label="Changelist"className={styles.scopeSelect}value={value}- options={lists.map((l) => ({ value: l.id, label: l.name, detail: `${l.files.length} file${l.files.length === 1 ? "" : "s"}` }))}+ options={lists.map((l) => ({ value: l.id, label: l.name, detail: l.files.length === 1 ? tx`${l.files.length} file` : tx`${l.files.length} files` }))}onChange={(id) => useTodoView.setState({ changelist: id })}/></div>diff --git a/src/features/tools/LanguageServersPage.tsx b/src/features/tools/LanguageServersPage.tsxindex a22cef798..549edcc66 100644--- a/src/features/tools/LanguageServersPage.tsx+++ b/src/features/tools/LanguageServersPage.tsx@@ -19,6 +19,7 @@ import {type InstallJob,} from "./store";import styles from "./LanguageServersPage.module.css";+import { tx } from "@/platform/i18n";type Filter = "all" | "missing" | "installed";@@ -48,7 +49,7 @@ export function filterTools(tools: readonly ToolInfo[], query: string, filter: Ffunction JobRow({ name, job }: { name: string; job: InstallJob }) {return (<div className={styles.job}>- <ProgressBar value={job.fraction} aria-label={`Installing ${name}`} className={styles.jobBar} />+ <ProgressBar value={job.fraction} aria-label={tx`Installing ${name}`} className={styles.jobBar} /><div className={styles.jobLine}><span className={styles.jobMessage} title={job.message ?? undefined}>{job.message ?? "Starting…"}@@ -178,7 +179,9 @@ function Details({ tool }: { tool: ToolInfo }) {variant={tool.status === "missing" ? "primary" : "secondary"}disabled={busy}onClick={() => void installTool(tool.name)}- aria-label={`${tool.status === "installed" ? "Reinstall" : "Install"} ${tool.displayName}`}+ aria-label={+ tool.status === "installed" ? tx`Reinstall ${tool.displayName}` : tx`Install ${tool.displayName}`+ }>{tool.status === "installed" ? "Reinstall" : "Install"}</Button>diff --git a/src/features/tools/jdk.ts b/src/features/tools/jdk.tsindex f0479d89c..70f9c24dc 100644--- a/src/features/tools/jdk.ts+++ b/src/features/tools/jdk.ts@@ -21,6 +21,7 @@ import {import { useProject } from "@/platform/project";import { notifications } from "@/workbench/contributions";import { upsertTask } from "@/workbench/tasks";+import { tx } from "@/platform/i18n";const JAVA_SETTINGS = "languages.java";const running = new Map<number, Promise<Sdk | null>>();@@ -59,7 +60,7 @@ export function downloadJdkFor(args: DownloadJdkArgs): Promise<Sdk | null> {title: `${sdk.name} downloaded`,body: args.languageServer? "The Java language server restarts on it."- : `Installed in ${sdk.path}; it is used for projects targeting Java ${args.version}.`,+ : tx`Installed in ${sdk.path}; it is used for projects targeting Java ${args.version}.`,});return sdk;} catch (e) {diff --git a/src/features/tools/missing.ts b/src/features/tools/missing.tsindex f76afb163..f6b823d4e 100644--- a/src/features/tools/missing.ts+++ b/src/features/tools/missing.ts@@ -8,6 +8,7 @@ import { executeAction } from "@/platform/actions";import { onIdeEvent } from "@/platform/ipc";import { notifications } from "@/workbench/contributions";import { installTool, refreshTools, SETTINGS_PAGE_ID, toolByName, useTools } from "./store";+import { tx } from "@/platform/i18n";export const missingKey = (name: string) => `lsp-missing-${name}`;@@ -26,7 +27,7 @@ export async function promptInstall(name: string): Promise<boolean> {group: "tools",level: "warning",title: `${tool.displayName} is not installed`,- body: `Code insight for ${langs} needs ${tool.command}. Install it via ${tool.installMethod}?`,+ body: tx`Code insight for ${langs} needs ${tool.command}. Install it via ${tool.installMethod}?`,key,sticky: true,actions: [diff --git a/src/features/tools/store.ts b/src/features/tools/store.tsindex d9785097a..76baa23b1 100644--- a/src/features/tools/store.ts+++ b/src/features/tools/store.ts@@ -6,6 +6,7 @@ import { isCancelled, nextRequestId } from "@/platform/ipc";import { notifications } from "@/workbench/contributions";import { upsertTask } from "@/workbench/tasks";import { toolsBackend } from "./backend";+import { tx } from "@/platform/i18n";export const SETTINGS_PAGE_ID = "languages.servers";const MAX_LOG_LINES = 400;@@ -99,19 +100,19 @@ export function installTool(name: string, opts: { notificationKey?: string } = {const taskId = `tools:${name}`;const key = opts.notificationKey ?? `tools-install-${name}`;useTools.setState((s) => ({ jobs: { ...s.jobs, [name]: { request, lines: [], fraction: null, message: null } } }));- upsertTask({ id: taskId, title: `Installing ${display}`, message: null, fraction: null, done: false });+ upsertTask({ id: taskId, title: tx`Installing ${display}`, message: null, fraction: null, done: false });const p = (async () => {try {const info = await toolsBackend().install(name, request, (e) => {if (e.type === "line") {patchJob(name, (j) => ({ ...j, lines: [...j.lines, e.text].slice(-MAX_LOG_LINES), message: e.text }));- upsertTask({ id: taskId, title: `Installing ${display}`, message: e.text, fraction: null, done: false });+ upsertTask({ id: taskId, title: tx`Installing ${display}`, message: e.text, fraction: null, done: false });} else {patchJob(name, (j) => ({ ...j, fraction: e.fraction, message: e.message }));upsertTask({id: taskId,- title: `Installing ${display}`,+ title: tx`Installing ${display}`,message: e.message,fraction: e.fraction,done: false,@@ -127,7 +128,7 @@ export function installTool(name: string, opts: { notificationKey?: string } = {group: "tools",level: "info",title: `${info.displayName} installed`,- body: info.version ? `Version ${info.version}` : undefined,+ body: info.version ? tx`Version ${info.version}` : undefined,key,});// Shared packages (e.g. vscode-langservers-extracted) change sibling rows too.@@ -150,7 +151,7 @@ export function installTool(name: string, opts: { notificationKey?: string } = {});return null;} finally {- upsertTask({ id: taskId, title: `Installing ${display}`, message: null, fraction: 1, done: true });+ upsertTask({ id: taskId, title: tx`Installing ${display}`, message: null, fraction: 1, done: true });running.delete(name);}})();diff --git a/src/features/vcs/BranchWidget.tsx b/src/features/vcs/BranchWidget.tsxindex b7302b14b..bed98625b 100644--- a/src/features/vcs/BranchWidget.tsx+++ b/src/features/vcs/BranchWidget.tsx@@ -36,6 +36,7 @@ import {} from "./repoBranches";import { currentRepo, focusRepo, loadBranches, repoName, useVcs } from "./store";import styles from "./BranchWidget.module.css";+import { tx } from "@/platform/i18n";export const useBranchesPopup = create<{ open: boolean }>(() => ({ open: false }));export const showBranchesPopup = () => useBranchesPopup.setState({ open: true });@@ -263,8 +264,8 @@ function BranchesPanel({ onClose, actions: baseActions, root, fallback, onBack }if (!el) return;setMenuFor(row.type === "branch"- ? { items: scoped(branchMenu(row.branch, current, closeAll)), label: `Branch ${row.branch.name}`, el }- : { items: scoped(tagMenu(row.tag, closeAll)), label: `Tag ${row.tag}`, el },+ ? { items: scoped(branchMenu(row.branch, current, closeAll)), label: tx`Branch ${row.branch.name}`, el }+ : { items: scoped(tagMenu(row.tag, closeAll)), label: tx`Tag ${row.tag}`, el },);};@@ -499,12 +500,12 @@ function MultiRepoPanel({ onClose }: { onClose: () => void }) {}setRepoMenu(null);if (row.type === "common") {- setMenuFor({ items: commonBranchMenu(row.branch, roots, closeAll), label: `Branch ${row.branch.name}`, el });+ setMenuFor({ items: commonBranchMenu(row.branch, roots, closeAll), label: tx`Branch ${row.branch.name}`, el });} else if (row.type === "branch") {const items = inRepo(row.repo.root, branchMenu(row.branch, row.repo.head, closeAll));- setMenuFor({ items, label: `Branch ${row.branch.name} of ${row.repo.name}`, el });+ setMenuFor({ items, label: tx`Branch ${row.branch.name} of ${row.repo.name}`, el });} else if (row.type === "tag") {- setMenuFor({ items: inRepo(row.repo.root, tagMenu(row.tag, closeAll)), label: `Tag ${row.tag}`, el });+ setMenuFor({ items: inRepo(row.repo.root, tagMenu(row.tag, closeAll)), label: tx`Tag ${row.tag}`, el });}};const setOpen = (key: string, open: boolean) =>@@ -625,7 +626,7 @@ function MultiRepoPanel({ onClose }: { onClose: () => void }) {placement="right-start"offset={2}autoFocus={repoMenu.focus}- aria-label={`Branches of ${repoName(repoMenu.root)}`}+ aria-label={tx`Branches of ${repoName(repoMenu.root)}`}onClose={closeRepoMenu}className={styles.popup}>diff --git a/src/features/vcs/CommitView.tsx b/src/features/vcs/CommitView.tsxindex b5f70fbd1..e0187afb6 100644--- a/src/features/vcs/CommitView.tsx+++ b/src/features/vcs/CommitView.tsx@@ -464,7 +464,7 @@ function ChangesPanel() {<CheckMarkchecked={agg.checked}indeterminate={agg.indeterminate}- label={`Include ${n.label} in commit`}+ label={tx`Include ${n.label} in commit`}onToggle={() => toggle(selected.has(n.key) && selected.size > 1 ? selectedNodes() : [n])}/>{n.type === "group" ? null : (diff --git a/src/features/vcs/CompareBranches.tsx b/src/features/vcs/CompareBranches.tsxindex 76cc27dcd..868ee8cf1 100644--- a/src/features/vcs/CompareBranches.tsx+++ b/src/features/vcs/CompareBranches.tsx@@ -8,6 +8,7 @@ import { openDialog } from "./dialogs";import { formatTime } from "./model";import { currentRepo, useVcs } from "./store";import styles from "./common.module.css";+import { tx } from "@/platform/i18n";const LIMIT = 2000;@@ -123,7 +124,7 @@ function CompareDialog({ branch, current, onClose }: { branch: string; current:return (<Dialogopen- title={`Compare ${current} with ${branch}`}+ title={tx`Compare ${current} with ${branch}`}onClose={onClose}width={640}buttons={[{ label: "Close", role: "cancel" }]}@@ -136,12 +137,12 @@ function CompareDialog({ branch, current, onClose }: { branch: string; current:items={[{id: "incoming",- label: `In ${branch}, not in ${current}`,+ label: tx`In ${branch}, not in ${current}`,trailing: data ? String(data.incoming.length) : undefined,},{id: "outgoing",- label: `In ${current}, not in ${branch}`,+ label: tx`In ${current}, not in ${branch}`,trailing: data ? String(data.outgoing.length) : undefined,},]}diff --git a/src/features/vcs/GitLog.tsx b/src/features/vcs/GitLog.tsxindex 1c67d88ed..a5472dfff 100644--- a/src/features/vcs/GitLog.tsx+++ b/src/features/vcs/GitLog.tsx@@ -60,6 +60,7 @@ import { branchFolderKeys, branchGroupKeys, buildBranchTree, filterBranchTree, timport { chooseDateRange, chooseMany, promptText } from "./dialogs";import { buildFileTree, dirKeys, type FileTreeNode } from "./fileTree";import styles from "./GitLog.module.css";+import { tx } from "@/platform/i18n";const ROW = 22;const LANE = 12;@@ -577,7 +578,7 @@ export function commitMenu(c: Commit, selection: Commit[] = [c]): MenuItem[] {kind: "action",action: "vcs.log.rebaseOntoCommit",arg: c,- label: `Rebase '${head ?? "HEAD"}' onto Selected Commit`,+ label: tx`Rebase '${head ?? "HEAD"}' onto Selected Commit`,disabled: !head,},{ kind: "action", action: "vcs.log.newBranch", arg: c },diff --git a/src/features/vcs/LocalHistory.tsx b/src/features/vcs/LocalHistory.tsxindex b12652d52..83095c290 100644--- a/src/features/vcs/LocalHistory.tsx+++ b/src/features/vcs/LocalHistory.tsx@@ -15,6 +15,7 @@ import { diffInput } from "./diffInput";import { baseName, formatTime } from "./model";import { errorMessage, runOp } from "./ops";import styles from "./LocalHistory.module.css";+import { tx } from "@/platform/i18n";export { LOCAL_HISTORY_KIND, localHistoryInput, openLocalHistory } from "./localHistoryKind";@@ -92,11 +93,11 @@ export function LocalHistoryEditor({ input }: { input: EditorInput }) {// A file's history at a label: its last revision before the label.const fileAtLabel = atLabel && !view?.folder ? atLabel.get(path) : undefined;- const restore = async (targets: HistoryEntry[], what: string) => {- const ok = await confirmDialog({ title: "Revert", message: `Revert ${what}?`, okLabel: "Revert" });+ const restore = async (targets: HistoryEntry[], question: string) => {+ const ok = await confirmDialog({ title: "Revert", message: question, okLabel: "Revert" });if (!ok) return;await runOp(- `Revert ${what} from Local History`,+ "Revert from Local History",async () => {for (const e of targets) await call(commands.historyRestore(e.path, e.id));},@@ -113,7 +114,7 @@ export function LocalHistoryEditor({ input }: { input: EditorInput }) {if (!isLabel(current)) {void restore([current],- `${baseName(current.path)} to the revision from ${formatTime(current.timestampMs)} (${current.label})`,+ tx`Revert ${baseName(current.path)} to the revision from ${formatTime(current.timestampMs)} (${current.label})?`,);return;}@@ -128,7 +129,9 @@ export function LocalHistoryEditor({ input }: { input: EditorInput }) {}void restore(targets,- `${view.folder ? `${targets.length} files under ${baseName(path)}` : baseName(path)} to label '${current.label}'`,+ view.folder+ ? tx`Revert ${targets.length} files under ${baseName(path)} to label '${current.label}'?`+ : tx`Revert ${baseName(path)} to label '${current.label}'?`,);};diff --git a/src/features/vcs/MergeEditor.tsx b/src/features/vcs/MergeEditor.tsxindex ef5bdbf26..d760b5e6d 100644--- a/src/features/vcs/MergeEditor.tsx+++ b/src/features/vcs/MergeEditor.tsx@@ -8,7 +8,7 @@ import { keymap } from "@codemirror/view";import { unifiedMergeView } from "@codemirror/merge";import type { MergeSides } from "@/bindings";import { embeddedEditorExtensions } from "@/editor/api";-import { useTxTemplate } from "@/platform/i18n";+import { tx, useTxTemplate } from "@/platform/i18n";import { call, commands } from "@/platform/ipc";import { Button, IconButton, Spinner, T } from "@/ui";import { editorService, type EditorInput } from "@/workbench/contributions";@@ -258,7 +258,10 @@ export function MergeEditor({ input }: { input: EditorInput }) {remaining > 0 &&!(await confirmDialog({title: "Unresolved Conflicts",- message: `${remaining} conflict${remaining === 1 ? " is" : "s are"} unresolved and keep the base text. Save and mark the file as resolved anyway?`,+ message:+ remaining === 1+ ? tx`${remaining} conflict is unresolved and keeps the base text. Save and mark the file as resolved anyway?`+ : tx`${remaining} conflicts are unresolved and keep the base text. Save and mark the file as resolved anyway?`,okLabel: "Mark Resolved",})))diff --git a/src/features/vcs/actions.tsx b/src/features/vcs/actions.tsxindex 68b27a466..19571405a 100644--- a/src/features/vcs/actions.tsx+++ b/src/features/vcs/actions.tsx@@ -37,6 +37,7 @@ import {showWorktrees,} from "./gitMenuDialogs";import { refreshNow, repoName } from "./store";+import { tx } from "@/platform/i18n";const VCS = "vcsAvailable";const IN_COMMIT_WINDOW = "vcsAvailable && activeToolWindow == commit";@@ -287,7 +288,7 @@ export function registerVcsActions(): () => void {group: "vcs",level: "info",title: "Submodule changes cannot be rolled back here",- body: `${repoName(submodule)} points to another commit. Check out the recorded commit in the submodule (git submodule update) to revert it.`,+ body: tx`${repoName(submodule)} points to another commit. Check out the recorded commit in the submodule (git submodule update) to revert it.`,});return showRollbackDialog(candidates);}diff --git a/src/features/vcs/branchMenu.ts b/src/features/vcs/branchMenu.tsindex 3b546a531..e665b9d81 100644--- a/src/features/vcs/branchMenu.ts+++ b/src/features/vcs/branchMenu.ts@@ -27,6 +27,7 @@ import { showCompareBranches } from "./CompareBranches";import { showDiffWithWorkingTree } from "./operations";import type { CommonBranch } from "./repoBranches";import { focusRepo } from "./store";+import { tx } from "@/platform/i18n";export function branchMenu(b: Branch, current: string | null, done: () => void = () => {}): MenuItem[] {const run = (fn: () => unknown) => () => {@@ -48,7 +49,7 @@ export function branchMenu(b: Branch, current: string | null, done: () => void =};if (b.current) {return [- { label: `New Branch from '${b.name}'…`, icon: "branch", run: run(() => newBranch()) },+ { label: tx`New Branch from '${b.name}'…`, icon: "branch", run: run(() => newBranch()) },{ kind: "separator" },{ label: "Update", icon: "git-pull", run: run(() => executeAction("vcs.update")) },{ label: "Push…", icon: "git-push", run: run(() => executeAction("vcs.push")) },@@ -60,15 +61,15 @@ export function branchMenu(b: Branch, current: string | null, done: () => void =}const items: MenuItem[] = [{ label: "Checkout", run: run(() => checkoutBranch(b.name)) },- { label: `New Branch from '${b.name}'…`, icon: "branch", run: run(() => newBranch(b.name)) },- ...(current ? [{ label: `Checkout and Rebase onto '${cur}'`, run: run(() => checkoutAndRebase(b.name)) }] : []),+ { label: tx`New Branch from '${b.name}'…`, icon: "branch", run: run(() => newBranch(b.name)) },+ ...(current ? [{ label: tx`Checkout and Rebase onto '${cur}'`, run: run(() => checkoutAndRebase(b.name)) }] : []),{ kind: "separator" },- { label: `Compare with '${cur}'`, icon: "diff", run: run(() => showCompareBranches(b.name)) },+ { label: tx`Compare with '${cur}'`, icon: "diff", run: run(() => showCompareBranches(b.name)) },{ label: "Show Diff with Working Tree", run: run(() => showDiffWithWorkingTree(b.name)) },history,{ kind: "separator" },- { label: `Rebase '${cur}' onto '${b.name}'`, run: run(() => rebaseOnto(b.name)) },- { label: `Merge '${b.name}' into '${cur}'`, run: run(() => mergeIntoCurrent(b.name)) },+ { label: tx`Rebase '${cur}' onto '${b.name}'`, run: run(() => rebaseOnto(b.name)) },+ { label: tx`Merge '${b.name}' into '${cur}'`, run: run(() => mergeIntoCurrent(b.name)) },];if (!b.remote)items.push(@@ -98,7 +99,7 @@ export function tagMenu(tag: string, done: () => void = () => {}): MenuItem[] {};return [{ label: "Checkout", run: run(() => checkoutDetached(tag, tag)) },- { label: `New Branch from '${tag}'…`, icon: "branch", run: run(() => newBranch(tag)) },+ { label: tx`New Branch from '${tag}'…`, icon: "branch", run: run(() => newBranch(tag)) },{ kind: "separator" },{ label: "Compare with Current", icon: "diff", run: run(() => showCompareBranches(tag)) },{ label: "Show Diff with Working Tree", run: run(() => showDiffWithWorkingTree(tag)) },@@ -113,7 +114,7 @@ export function commonBranchMenu(b: CommonBranch, roots: readonly string[], donevoid fn();};const newFrom: MenuItem = {- label: `New Branch from '${b.name}'…`,+ label: tx`New Branch from '${b.name}'…`,icon: "branch",run: run(() => newBranchInRepos(roots, b.name)),};@@ -128,8 +129,8 @@ export function commonBranchMenu(b: CommonBranch, roots: readonly string[], done{ label: "Checkout", run: run(() => checkoutInRepos(b.name, roots)) },newFrom,{ kind: "separator" },- { label: `Rebase Current onto '${b.name}'`, run: run(() => rebaseInRepos(b.name, roots)) },- { label: `Merge '${b.name}' into Current`, run: run(() => mergeInRepos(b.name, roots)) },+ { label: tx`Rebase Current onto '${b.name}'`, run: run(() => rebaseInRepos(b.name, roots)) },+ { label: tx`Merge '${b.name}' into Current`, run: run(() => mergeInRepos(b.name, roots)) },];if (!b.remote)items.push(diff --git a/src/features/vcs/branchOps.ts b/src/features/vcs/branchOps.tsindex d066ec2ae..79ddee418 100644--- a/src/features/vcs/branchOps.ts+++ b/src/features/vcs/branchOps.ts@@ -10,6 +10,7 @@ import { showCommitRange } from "./CompareBranches";import { confirmDialog, promptText } from "./dialogs";import { runOp, runRemote, saveAll } from "./ops";import { conflictedFiles, currentRepo, refreshNow, repoName, useVcs } from "./store";+import { tx } from "@/platform/i18n";const recentKey = () => `openidea.vcs.recentBranches:${useVcs.getState().root ?? ""}`;@@ -50,7 +51,7 @@ async function askSmartCheckout(files: readonly string[]): Promise<CheckoutOptioconst list = files.slice(0, 20).join("\n") + (files.length > 20 ? "\n…" : "");const r = await ask({title: "Git Checkout Problem",- body: `Your local changes to the following files would be overwritten by checkout:\n${list}\n\nSmart Checkout can stash the changes, checkout and unstash them after that.`,+ body: tx`Your local changes to the following files would be overwritten by checkout:\n${list}\n\nSmart Checkout can stash the changes, checkout and unstash them after that.`,icon: "warning",width: 520,buttons: [@@ -105,8 +106,8 @@ async function performCheckout(case "localBranchAhead": {const { local, remote } = outcome;const r = await ask({- title: `Checkout ${remote}`,- body: `Local branch '${local}' has commits that do not exist in '${remote}'. Rebase '${local}' onto '${remote}', or drop local commits?`,+ title: tx`Checkout ${remote}`,+ body: tx`Local branch '${local}' has commits that do not exist in '${remote}'. Rebase '${local}' onto '${remote}', or drop local commits?`,buttons: [{ id: "rebase", label: "Rebase onto Remote", primary: true },{ id: "reset", label: "Drop Local Commits" },@@ -145,7 +146,7 @@ export async function checkoutBranch(name: string) {export async function newBranch(from?: string) {const suggestion = from ? (from.includes("/") ? shortRemoteName(from) : `${from}-copy`) : "";const r = await promptText({- title: from ? `Create New Branch from ${from}` : "Create New Branch",+ title: from ? tx`Create New Branch from ${from}` : "Create New Branch",label: "New branch name:",initial: from && from.includes("/") && !validateBranchName(suggestion) ? suggestion : "",mono: true,@@ -218,7 +219,7 @@ export async function rebaseOnto(branch: string) {export async function renameBranch(name: string) {const r = await promptText({- title: `Rename Branch ${name}`,+ title: tx`Rename Branch ${name}`,label: "New branch name:",initial: name,mono: true,@@ -290,7 +291,7 @@ export async function deleteBranch(name: string) {export async function deleteRemoteBranch(name: string) {const ok = await confirmDialog({title: "Delete Remote Branch",- message: `Delete branch '${shortRemoteName(name)}' on the remote? The remote-tracking branch '${name}' is removed as well.`,+ message: tx`Delete branch '${shortRemoteName(name)}' on the remote? The remote-tracking branch '${name}' is removed as well.`,okLabel: "Delete",danger: true,});@@ -354,8 +355,8 @@ export async function checkoutInRepos(name: string, roots: readonly string[]) {/** New Branch in every repository of `roots` (from HEAD or `from`), checked out by default. */export async function newBranchInRepos(roots: readonly string[], from?: string) {const r = await promptText({- title: from ? `Create New Branch from ${from}` : "Create New Branch",- label: `New branch name (in ${roots.length} repositories):`,+ title: from ? tx`Create New Branch from ${from}` : "Create New Branch",+ label: tx`New branch name (in ${roots.length} repositories):`,initial: from?.includes("/") ? shortRemoteName(from) : "",mono: true,okLabel: "Create",@@ -409,7 +410,7 @@ export async function rebaseInRepos(branch: string, roots: readonly string[]) {export async function deleteInRepos(name: string, roots: readonly string[]) {const ok = await confirmDialog({title: "Delete Branch",- message: `Delete branch '${name}' in ${roots.length} repositories? Unmerged commits are discarded.`,+ message: tx`Delete branch '${name}' in ${roots.length} repositories? Unmerged commits are discarded.`,okLabel: "Delete",danger: true,});diff --git a/src/features/vcs/changeOps.tsx b/src/features/vcs/changeOps.tsxindex 8b86eba83..31433341e 100644--- a/src/features/vcs/changeOps.tsx+++ b/src/features/vcs/changeOps.tsx@@ -14,6 +14,7 @@ import { KIND_COLOR, baseName, dirName, effectiveKind, relTo, rootOf, stripSlashimport { logConsole, runOp, saveAll } from "./ops";import { currentRepo, loadStashes, refreshNow, useVcs } from "./store";import styles from "./common.module.css";+import { tx } from "@/platform/i18n";export function firstLine(message: string): string {return (@@ -230,7 +231,7 @@ function RollbackDialog({ files, onClose }: { files: FileStatus[]; onClose: () =return (<div key={f.path} className={styles.fileRow}><Checkbox- aria-label={`Include ${baseName(f.path)}`}+ aria-label={tx`Include ${baseName(f.path)}`}checked={selected.has(f.path)}onChange={(v) =>setSelected((s) => {@@ -366,10 +367,10 @@ export interface UnstashOptions {export function unstashTitles(o: UnstashOptions): { title: string; success: string } {const ref = `stash@{${o.index}}`;if (o.branch)- return { title: `Unstash ${ref} as branch ${o.branch}`, success: `Unstashed ${ref} on branch ${o.branch}` };+ return { title: tx`Unstash ${ref} as branch ${o.branch}`, success: `Unstashed ${ref} on branch ${o.branch}` };return o.pop- ? { title: `Pop ${ref}`, success: `Unstashed ${ref}` }- : { title: `Apply ${ref}`, success: `Applied ${ref}` };+ ? { title: tx`Pop ${ref}`, success: `Unstashed ${ref}` }+ : { title: tx`Apply ${ref}`, success: `Applied ${ref}` };}export async function unstash(o: UnstashOptions) {@@ -455,7 +456,9 @@ function UnstashDialog({ initial, onClose }: { initial: number; onClose: () => vexport async function dropStash(index: number, message: string) {const ok = await confirmDialog({title: "Drop Stash",- message: `Drop stash@{${index}}${message ? ` “${message}”` : ""}? This cannot be undone.`,+ message: message+ ? tx`Drop ${`stash@{${index}}`} “${message}”? This cannot be undone.`+ : tx`Drop ${`stash@{${index}}`}? This cannot be undone.`,okLabel: "Drop",danger: true,});diff --git a/src/features/vcs/changelistsUi.tsx b/src/features/vcs/changelistsUi.tsxindex b9277f486..6ac014aba 100644--- a/src/features/vcs/changelistsUi.tsx+++ b/src/features/vcs/changelistsUi.tsx@@ -19,6 +19,7 @@ import { useCommit } from "./commitStore";import { confirmDialog, openDialog } from "./dialogs";import { useVcs } from "./store";import styles from "./common.module.css";+import { tx } from "@/platform/i18n";interface FormValue {name: string;@@ -159,7 +160,10 @@ export async function deleteChangelist(id: string) {if (count) {const ok = await confirmDialog({title: "Delete Changelist",- message: `Changelist '${list.name}' contains ${count} change${count === 1 ? "" : "s"}. They will be moved to '${activeList(state).name}'. Delete the changelist?`,+ message:+ count === 1+ ? tx`Changelist '${list.name}' contains ${count} change. It will be moved to '${activeList(state).name}'. Delete the changelist?`+ : tx`Changelist '${list.name}' contains ${count} changes. They will be moved to '${activeList(state).name}'. Delete the changelist?`,okLabel: "Delete",danger: true,});@@ -247,7 +251,7 @@ function MoveDialog({ paths, onClose }: { paths: readonly string[]; onClose: ()disabled={mode !== "existing"}aria-label="Existing changelist"onChange={setTarget}- options={others.map((l) => ({ value: l.id, label: l.id === state.active ? `${l.name} (active)` : l.name }))}+ options={others.map((l) => ({ value: l.id, label: l.id === state.active ? tx`${l.name} (active)` : l.name }))}/><label className={styles.radioRow}><input type="radio" name="target" checked={mode === "new"} onChange={() => setMode("new")} />diff --git a/src/features/vcs/changes.ts b/src/features/vcs/changes.tsindex d4bd0a5b7..07d61eea9 100644--- a/src/features/vcs/changes.ts+++ b/src/features/vcs/changes.ts@@ -1,6 +1,7 @@/** Commit tool window model: change groups, directory tree, inclusion (pure). */import type { ChangelistState, FileStatus } from "@/bindings";import { baseName, dirName, effectiveKind, relTo, repoLabel, rootOf, stripSlash, type EffectiveKind } from "./model";+import { tx } from "@/platform/i18n";export type GroupId = "conflicts" | "changes" | "unversioned";@@ -90,7 +91,13 @@ function fileNode(fs: FileStatus, root: string, group: GroupId, flat: boolean, sfiles: [fs],kind,path,- detail: fs.renamedFrom ? `${flat && dir ? `${dir} · ` : ""}from ${fs.renamedFrom}` : flat ? dir : undefined,+ detail: !fs.renamedFrom+ ? flat+ ? dir+ : undefined+ : flat && dir+ ? tx`${dir} · from ${fs.renamedFrom}`+ : tx`from ${fs.renamedFrom}`,};}diff --git a/src/features/vcs/commitChecks.tsx b/src/features/vcs/commitChecks.tsxindex 0f7cbe155..b9a85f10d 100644--- a/src/features/vcs/commitChecks.tsx+++ b/src/features/vcs/commitChecks.tsx@@ -15,6 +15,7 @@ import { baseName, relTo } from "./model";import { logConsole } from "./ops";import { currentRepo, useVcs } from "./store";import styles from "./common.module.css";+import { tx } from "@/platform/i18n";// ---------------------------------------------------------------------------// Diagnostics seen per file (Analyze code)@@ -249,12 +250,12 @@ export async function runCommitChecks(files: readonly CommitCandidate[], amend:}const { errors, warnings, files: n } = problemCounts(existing);if (errors + warnings > 0) {- const parts = [errors && plural(errors, "error"), warnings && plural(warnings, "warning")]- .filter(Boolean)- .join(" and ");+ const errorCount = errors === 1 ? tx`${errors} error` : tx`${errors} errors`;+ const warningCount = warnings === 1 ? tx`${warnings} warning` : tx`${warnings} warnings`;+ const found = !warnings ? errorCount : !errors ? warningCount : tx`${errorCount} and ${warningCount}`;problems.push({title: "Code analysis",- text: `${parts} found in ${plural(n, "file")}`,+ text: n === 1 ? tx`${found} found in ${n} file` : tx`${found} found in ${n} files`,details: {label: "Review",run: () => {diff --git a/src/features/vcs/compare.tsx b/src/features/vcs/compare.tsxindex 8fee4bef8..283b6c9f4 100644--- a/src/features/vcs/compare.tsx+++ b/src/features/vcs/compare.tsx@@ -10,6 +10,7 @@ import { maybeEditorService, notifications } from "@/workbench/contributions";import { focusedDiffNavigator } from "./diffNavigator";import { openDiff, type DiffData } from "./diffInput";import { baseName } from "./model";+import { tx } from "@/platform/i18n";function argPath(arg: unknown): string | undefined {if (typeof arg === "string") return arg;@@ -44,7 +45,7 @@ export function compareFilesData(leftPath: string, rightPath: string): DiffDataexport function clipboardDiffData(path: string, clipboard: string, selection: string | null): DiffData {return {path,- title: `Clipboard ↔ ${baseName(path)}${selection ? " (selection)" : ""}`,+ title: selection ? tx`Clipboard ↔ ${baseName(path)} (selection)` : tx`Clipboard ↔ ${baseName(path)}`,left: { type: "text", text: clipboard, label: "Clipboard" },right: selection ? { type: "text", text: selection, label: "Selection" } : { type: "worktree", label: displayPath(path) },};diff --git a/src/features/vcs/gitMenuDialogs.tsx b/src/features/vcs/gitMenuDialogs.tsxindex a722db9b7..65b731330 100644--- a/src/features/vcs/gitMenuDialogs.tsx+++ b/src/features/vcs/gitMenuDialogs.tsx@@ -12,6 +12,7 @@ import { confirmDialog, openDialog } from "./dialogs";import { errorMessage, runOp, runRemote, saveAll } from "./ops";import { currentRepo, loadBranches, refreshNow, useVcs } from "./store";import styles from "./common.module.css";+import { tx } from "@/platform/i18n";// --- shared -----------------------------------------------------------------@@ -153,7 +154,7 @@ function PullDialog({ onClose }: { onClose: () => void }) {return (<Dialogopen- title={`Pull to ${info?.head ?? "HEAD"}`}+ title={tx`Pull to ${info?.head ?? "HEAD"}`}onClose={onClose}width={460}buttons={[@@ -231,7 +232,7 @@ function MergeDialog({ onClose }: { onClose: () => void }) {return (<Dialogopen- title={`Merge into ${head ?? "HEAD"}`}+ title={tx`Merge into ${head ?? "HEAD"}`}onClose={onClose}width={460}buttons={[@@ -253,7 +254,7 @@ function MergeDialog({ onClose }: { onClose: () => void }) {<Inputaria-label="Commit message"value={message}- placeholder={branch ? `Merge branch '${branch}' into ${head ?? "HEAD"}` : ""}+ placeholder={branch ? tx`Merge branch '${branch}' into ${head ?? "HEAD"}` : ""}onChange={(e) => setMessage(e.target.value)}/>)}@@ -391,7 +392,7 @@ function RemotesDialog({ onClose }: { onClose: () => void }) {if (!selected) return;const ok = await confirmDialog({title: "Remove Remote",- message: `Remove remote '${selected}'? Its remote-tracking branches are deleted.`,+ message: tx`Remove remote '${selected}'? Its remote-tracking branches are deleted.`,okLabel: "Remove",danger: true,});@@ -535,7 +536,7 @@ function WorktreesDialog({ onClose }: { onClose: () => void }) {if (!current || current.main) return;const ok = await confirmDialog({title: "Remove Worktree",- message: `Remove the worktree at ${current.path}? Its folder is deleted.`,+ message: tx`Remove the worktree at ${current.path}? Its folder is deleted.`,okLabel: "Remove",danger: true,});@@ -545,7 +546,7 @@ function WorktreesDialog({ onClose }: { onClose: () => void }) {} catch (e) {const force = await confirmDialog({title: "Remove Worktree",- message: `${errorMessage(e)}\n\nRemove it anyway, discarding its changes?`,+ message: tx`${errorMessage(e)}\n\nRemove it anyway, discarding its changes?`,okLabel: "Force Remove",danger: true,});diff --git a/src/features/vcs/index.ts b/src/features/vcs/index.tsindex 8aa1e3405..0ba1e6788 100644--- a/src/features/vcs/index.ts+++ b/src/features/vcs/index.ts@@ -38,6 +38,7 @@ import { installFileConfirmations } from "./confirmations";import { installIncomingCheck } from "./incoming";import { installGitLog } from "./logStore";import { installVcsStore, onConflictsAppeared, onConflictsCleared, useVcs } from "./store";+import { tx } from "@/platform/i18n";function trackTitleItem(): () => void {let dispose: (() => void) | null = null;@@ -60,6 +61,11 @@ function trackTitleItem(): () => void {};}+function conflictsBody(names: string[]): string {+ const list = names.slice(0, 3).join(", ") + (names.length > 3 ? "…" : "");+ return names.length === 1 ? tx`${names.length} file has conflicts: ${list}` : tx`${names.length} files have conflicts: ${list}`;+}+export function activate(): () => void {onConflictsAppeared((files) =>notifications().notify({@@ -67,10 +73,7 @@ export function activate(): () => void {level: "warning",key: "vcs.conflicts",title: "Merge conflicts",- body: `${files.length} file${files.length === 1 ? " has" : "s have"} conflicts: ${files- .slice(0, 3)- .map((f) => baseName(f.path))- .join(", ")}${files.length > 3 ? "…" : ""}`,+ body: conflictsBody(files.map((f) => baseName(f.path))),sticky: true,actions: [{ label: "Resolve…", run: showConflictsDialog }],}),diff --git a/src/features/vcs/model.ts b/src/features/vcs/model.tsindex d3a5f767e..5b4ac19dd 100644--- a/src/features/vcs/model.ts+++ b/src/features/vcs/model.ts@@ -2,6 +2,7 @@import type { ChangeKind, FileStatus } from "@/bindings";import type { FileDecoration } from "@/workbench/contributions";import { formatDay, formatTimestamp } from "@/platform/dateFormat";+import { tx } from "@/platform/i18n";/** What a file looks like in IDEA's change lists (one kind per file). */export type EffectiveKind = "modified" | "added" | "deleted" | "renamed" | "untracked" | "ignored" | "conflicted";@@ -62,7 +63,7 @@ export function statusDecorations(status: readonly FileStatus[], propagate = truif (!kind) continue;const deco: FileDecoration = {color: KIND_COLOR[kind],- tooltip: fs.renamedFrom ? `${KIND_LABEL[kind]} (from ${fs.renamedFrom})` : KIND_LABEL[kind],+ tooltip: fs.renamedFrom ? tx`${KIND_LABEL[kind]} (from ${fs.renamedFrom})` : KIND_LABEL[kind],};if (kind === "ignored") deco.faded = true;// Settings › Version Control › Show directories with changed descendants.diff --git a/src/features/vcs/operations.tsx b/src/features/vcs/operations.tsxindex f1f17559f..5ad795438 100644--- a/src/features/vcs/operations.tsx+++ b/src/features/vcs/operations.tsx@@ -16,6 +16,7 @@ import { runGitOperation, runOp } from "./ops";import { reloadLog, useGitLog } from "./logStore";import { conflictedFiles, currentRepo, currentRepoRoot, refreshNow, repoOf, useVcs } from "./store";import styles from "./common.module.css";+import { tx } from "@/platform/i18n";// ---------------------------------------------------------------------------// Operation in progress@@ -70,12 +71,25 @@ function notInProgress(expected: InProgress | null) {notifications().notify({group: "vcs",level: "info",- title: expected- ? `No ${OP_NOUN[expected].toLowerCase()} in progress`- : "No merge, rebase, cherry-pick or revert in progress",+ title: expected ? noneInProgress(expected) : "No merge, rebase, cherry-pick or revert in progress",});}+function noneInProgress(op: InProgress): string {+ switch (op) {+ case "rebase":+ return tx("No rebase in progress");+ case "merge":+ return tx("No merge in progress");+ case "cherry-pick":+ return tx("No cherry-pick in progress");+ case "revert":+ return tx("No revert in progress");+ case "am":+ return tx("No patch application in progress");+ }+}+/*** Continue / Skip / Abort of the operation in progress. `expected` restricts the* action to one kind (e.g. Git › Continue Rebase).@@ -306,7 +320,7 @@ export function validateTagName(name: string, existing: readonly string[] = []):export async function newTagOn(commit: Commit) {const existing = await call(commands.vcsTags(currentRepo())).catch(() => [] as string[]);const r = await promptText({- title: `Create New Tag On ${short(commit.id)}`,+ title: tx`Create New Tag On ${short(commit.id)}`,label: "Enter the name of new tag:",mono: true,okLabel: "Create",@@ -456,7 +470,11 @@ function ChangesBetweenDialog({ from, to, onClose }: { from: Revision; to: Revisreturn (<Dialogopen- title={`Changes between ${from.label} and ${to ? to.label : "Local Working Tree"}`}+ title={+ to+ ? tx`Changes between ${from.label} and ${to.label}`+ : tx`Changes between ${from.label} and Local Working Tree`+ }onClose={onClose}width={620}buttons={[diff --git a/src/features/vcs/patches.tsx b/src/features/vcs/patches.tsxindex 0c58ead65..1ed9c86d3 100644--- a/src/features/vcs/patches.tsx+++ b/src/features/vcs/patches.tsx@@ -11,6 +11,7 @@ import { FileChecklist, defaultChangeFiles, reportApply } from "./shelf";import { activeList, useChangelists } from "./changelists";import { useVcs } from "./store";import styles from "./common.module.css";+import { tx } from "@/platform/i18n";export type PatchOrigin = { kind: "changes"; files: FileStatus[] } | { kind: "commits"; commits: Commit[] };@@ -213,7 +214,7 @@ function ApplyPatchDialog({ patch, source, onClose }: { patch: string; source: sreturn (<Dialogopen- title={`Apply Patch: ${source}`}+ title={tx`Apply Patch: ${source}`}onClose={onClose}width={600}footerStart={diff --git a/src/features/vcs/rebase.tsx b/src/features/vcs/rebase.tsxindex 262d041af..e351e5267 100644--- a/src/features/vcs/rebase.tsx+++ b/src/features/vcs/rebase.tsx@@ -28,6 +28,7 @@ import {} from "./rebasePlan";import { currentRepo, refreshNow, useVcs } from "./store";import styles from "./common.module.css";+import { tx } from "@/platform/i18n";const short = (id: string) => id.slice(0, 8);@@ -147,7 +148,7 @@ export async function dropCommits(commits: Commit[]) {return refuse("Cannot drop commits", "At least one commit of the branch must be kept");const ok = await confirmDialog({title: "Drop Commits",- message: `Drop ${commits.length} commits from the current branch? Their changes are removed.`,+ message: tx`Drop ${commits.length} commits from the current branch? Their changes are removed.`,okLabel: "Drop",danger: true,});@@ -167,7 +168,7 @@ async function dropCommit(commit: Commit) {return refuse("Cannot drop commit", "It is the only commit of the branch");const ok = await confirmDialog({title: "Drop Commit",- message: `Drop commit ${short(commit.id)} “${commit.summary}” from the current branch? Its changes are removed.`,+ message: tx`Drop commit ${short(commit.id)} “${commit.summary}” from the current branch? Its changes are removed.`,okLabel: "Drop",danger: true,});@@ -293,7 +294,7 @@ function InteractiveRebaseDialog({ range, onClose }: { range: RebaseRange; onCloreturn (<Dialogopen- title={`Rebasing ${range.commits.length} commit${range.commits.length === 1 ? "" : "s"}${range.base ? ` onto ${short(range.base)}` : " from the root"}`}+ title={rebaseTitle(range.commits.length, range.base && short(range.base))}onClose={onClose}width={720}footerStart={problem ? <span className={styles.error}>{problem}</span> : undefined}@@ -311,7 +312,7 @@ function InteractiveRebaseDialog({ range, onClose }: { range: RebaseRange; onClo<Select<RebaseAction>value={r.action}options={ACTIONS}- aria-label={`Action for ${short(r.commit.id)}`}+ aria-label={tx`Action for ${short(r.commit.id)}`}className={styles.rebaseAction}onChange={(action) => update(i, { action })}/>@@ -354,3 +355,8 @@ function InteractiveRebaseDialog({ range, onClose }: { range: RebaseRange; onClo</Dialog>);}++function rebaseTitle(n: number, onto: string | null): string {+ if (onto) return n === 1 ? tx`Rebasing ${n} commit onto ${onto}` : tx`Rebasing ${n} commits onto ${onto}`;+ return n === 1 ? tx`Rebasing ${n} commit from the root` : tx`Rebasing ${n} commits from the root`;+}diff --git a/src/features/vcs/remoteUi.tsx b/src/features/vcs/remoteUi.tsxindex 742088310..5684327a9 100644--- a/src/features/vcs/remoteUi.tsx+++ b/src/features/vcs/remoteUi.tsx@@ -341,7 +341,7 @@ function PushDialog({ target: pushTarget, onClose }: { target: PushTarget; onCloreturn (<Dialogopen- title={head ? `Push Commits to ${upstream ?? "remote"}` : "Push"}+ title={head ? tx`Push Commits to ${upstream ?? "remote"}` : "Push"}onClose={onClose}width={620}footerStart={@@ -453,7 +453,7 @@ async function confirmForcePush(target: string): Promise<boolean> {if (target && silentForcePushTargets().includes(target)) return true;const r = await ask({title: "Force Push",- body: `You're going to force push to '${target}'. It may overwrite commits at the remote. Are you sure you want to proceed?`,+ body: tx`You're going to force push to '${target}'. It may overwrite commits at the remote. Are you sure you want to proceed?`,icon: "warning",checkbox: target ? "Don't warn about this target" : undefined,buttons: [{ id: "force", label: "Force Push", primary: true }],diff --git a/src/features/vcs/shelf.tsx b/src/features/vcs/shelf.tsxindex 5cbc25770..092391103 100644--- a/src/features/vcs/shelf.tsx+++ b/src/features/vcs/shelf.tsx@@ -19,6 +19,7 @@ import { errorMessage, logConsole, runOp, saveAll } from "./ops";import { conflictedFiles, refreshNow, useVcs } from "./store";import styles from "./common.module.css";import viewStyles from "./CommitView.module.css";+import { tx } from "@/platform/i18n";interface ShelfState {shelves: ShelvedChangeList[];@@ -89,7 +90,7 @@ export function FileChecklist({return (<div key={f.path} className={styles.fileRow}><Checkbox- aria-label={`Include ${baseName(f.path)}`}+ aria-label={tx`Include ${baseName(f.path)}`}checked={selected.has(f.path)}onChange={(v) => {const n = new Set(selected);@@ -232,7 +233,7 @@ function UnshelveDialog({ entry, onClose }: { entry: ShelvedChangeList; onClose:onChange={setTarget}options={lists.lists.map((l) => ({value: l.id,- label: l.id === lists.active ? `${l.name} (active)` : l.name,+ label: l.id === lists.active ? tx`${l.name} (active)` : l.name,}))}/><Checkbox checked={remove} onChange={setRemove} label="Remove successfully applied files from the shelf" />@@ -244,7 +245,7 @@ function UnshelveDialog({ entry, onClose }: { entry: ShelvedChangeList; onClose:export async function deleteShelf(entry: ShelvedChangeList) {const ok = await confirmDialog({title: "Delete Shelved Changes",- message: `Delete “${entry.name}” from the shelf? This cannot be undone.`,+ message: tx`Delete “${entry.name}” from the shelf? This cannot be undone.`,okLabel: "Delete",danger: true,});diff --git a/src/features/vim/VimSettingsPage.tsx b/src/features/vim/VimSettingsPage.tsxindex fc00f8749..b0df4f57a 100644--- a/src/features/vim/VimSettingsPage.tsx+++ b/src/features/vim/VimSettingsPage.tsx@@ -7,6 +7,7 @@ import { conflictRows, VIM_KEYS } from "./conflicts";import { loadRcFile, useVimRc } from "./rcFile";import { updateVimSettings, useVimSettings, type Handler } from "./settings";import styles from "./Vim.module.css";+import { tx } from "@/platform/i18n";const HANDLERS = [{ value: "vim" as const, label: "Vim" },@@ -120,7 +121,7 @@ export function VimSettingsPage() {value={r.current}options={HANDLERS}onChange={(v) => setHandler(r.stroke, v)}- aria-label={`Handler for ${r.stroke}`}+ aria-label={tx`Handler for ${r.stroke}`}/></td></tr>diff --git a/src/features/web/index.ts b/src/features/web/index.tsindex ba78dcbf1..df7451c1e 100644--- a/src/features/web/index.ts+++ b/src/features/web/index.ts@@ -19,6 +19,7 @@ import {useBrowsers,useWebPreview,} from "./browsers";+import { tx } from "@/platform/i18n";interface OpenArg {path?: string;@@ -105,7 +106,7 @@ export function activate(): () => void {kind: "action",action: "web.openInBrowser",arg: { path },- label: `Open '${basename(path)}' in Browser`,+ label: tx`Open '${basename(path)}' in Browser`,icon: "web",},];diff --git a/src/features/welcome/ProjectsPage.tsx b/src/features/welcome/ProjectsPage.tsxindex d820259a2..660d908e1 100644--- a/src/features/welcome/ProjectsPage.tsx+++ b/src/features/welcome/ProjectsPage.tsx@@ -19,6 +19,7 @@ import {import { askRemoveRecent, ProjectBadge, recentMenu } from "./RecentList";import { filterRecent, openRecent, useRecent, type RecentMatch } from "./recent";import styles from "./Welcome.module.css";+import { tx } from "@/platform/i18n";function HeaderButtons() {const canClone = useActions((s) => s.actions.has("vcs.clone"));@@ -29,7 +30,7 @@ function HeaderButtons() {<Buttondisabled={opening}onClick={() => void executeAction("file.openProject")}- title={openKey ? `Open (${openKey})` : "Open"}+ title={openKey ? tx`Open (${openKey})` : "Open"}><T>Open</T></Button>diff --git a/src/features/welcome/RecentList.tsx b/src/features/welcome/RecentList.tsxindex 906f284c1..2c3c158d3 100644--- a/src/features/welcome/RecentList.tsx+++ b/src/features/welcome/RecentList.tsx@@ -16,12 +16,13 @@ import { confirm } from "@/workbench/messages";import { projectColorVars, projectInitials } from "@/workbench/projectColor";import { filterRecent, openRecent, removeRecent, useRecent, type RecentMatch } from "./recent";import styles from "./Welcome.module.css";+import { tx } from "@/platform/i18n";/** IDEA's "Remove Recent Project" confirmation, then removes it from the list. */export async function askRemoveRecent(project: RecentProject) {const ok = await confirm({title: "Remove Recent Project",- message: `Remove '${project.name}' from the list of recent projects?`,+ message: tx`Remove '${project.name}' from the list of recent projects?`,ok: "Remove",});if (ok) await removeRecent(project.path);diff --git a/src/platform/i18n.test.ts b/src/platform/i18n.test.tsindex 6f8710e1f..1601395c7 100644--- a/src/platform/i18n.test.ts+++ b/src/platform/i18n.test.ts@@ -127,6 +127,26 @@ describe("t / locales", () => {expect(txTemplate("Something else entirely")).toBe("Something else entirely");});+ it("translates text built by the tx tag, again after the locale changes", async () => {+ await setLocale("en");+ const name = "orders";+ const built = tx`Run '${name}'`;+ expect(built).toBe("Run 'orders'");+ expect(tx`Unknown ${name} text`).toBe("Unknown orders text");+ await setLocale("zh");+ // Built before the catalog loaded: primitives passing it through `tx` translate it.+ expect(tx(built)).toBe("运行 'orders'");+ expect(txTemplate(built)).toBe("运行 'orders'");+ const zh = tx`Run '${name}'`;+ expect(zh).toBe("运行 'orders'");+ // Substituted text is translated when the catalog has it.+ expect(tx`Run '${"Retry"}'`).toBe(`运行 '${tx("Retry")}'`);+ // Values are inserted as they are, braces included.+ expect(tx`Drop ${"stash@{0}"}? This cannot be undone.`).toBe("是否丢弃 stash@{0}?此操作无法撤消。");+ await setLocale("en");+ expect(tx(zh)).toBe("Run 'orders'");+ });+it("lists keys by prefix", () => {const keys = keysWithPrefix("menu.");expect(keys).toContain("menu.file.save");diff --git a/src/platform/i18n.ts b/src/platform/i18n.tsindex 5476691c6..014cc8748 100644--- a/src/platform/i18n.ts+++ b/src/platform/i18n.ts@@ -158,26 +158,97 @@ export function useT(): Translate {return useCallback((key, params) => translateWith({ locale, messages }, key, params), [locale, messages]);}-/** Translates English UI text through the source-text catalog; unknown text is returned as is. */+/**+ * Translates English UI text through the source-text catalog; unknown text is returned as is.+ *+ * As a tag it translates text built at runtime: `` tx`Remove data source '${name}'?` ``+ * looks up `"Remove data source '{name}'?"` (whatever the placeholder names) and fills+ * in the values, each translated as text when the catalog has it. The result is+ * remembered, so the UI primitives, which pass their strings through `tx` as they+ * render, translate it again after a locale change or once the catalog has loaded.+ */+export function tx(strings: TemplateStringsArray, ...values: unknown[]): string;export function tx(text: string): string;export function tx(text: string | undefined): string | undefined;-export function tx(text: string | undefined): string | undefined {- return text && (useI18n.getState().texts[text] ?? text);+export function tx(text: string | TemplateStringsArray | undefined, ...values: unknown[]): string | undefined {+ return translateSource(useI18n.getState().texts, text, values);}/** `tx` bound to the current locale; components re-render when it changes. */export function useTx(): typeof tx {const texts = useI18n((s) => s.texts);return useMemo(() => {+ function bound(strings: TemplateStringsArray, ...values: unknown[]): string;function bound(text: string): string;function bound(text: string | undefined): string | undefined;- function bound(text: string | undefined) {- return text && (texts[text] ?? text);+ function bound(text: string | TemplateStringsArray | undefined, ...values: unknown[]) {+ return translateSource(texts, text, values);}return bound;}, [texts]);}+function translateSource(texts: Catalog, text: string | TemplateStringsArray | undefined, values: unknown[]) {+ if (text === undefined || typeof text === "string") return text && (texts[text] ?? rebuild(texts, text) ?? text);+ return buildText(texts, { strings: text, values });+}++/** Text built by a `tx` tag: the template's literal parts and the interpolated values. */+type Built = { strings: readonly string[]; values: readonly unknown[] };++const MAX_BUILT = 10_000;+/** Text that `tx` tags returned (in English and translated), most recently built last. */+const built = new Map<string, Built>();++function remember(text: string, b: Built) {+ built.delete(text);+ built.set(text, b);+ if (built.size > MAX_BUILT) built.delete(built.keys().next().value!);+}++type Shape = { names: string[]; translation: string };++const shapeCache = new WeakMap<Catalog, Map<string, Shape>>();++/** Source-text templates by their literal parts: `"Run '{name}'"` under `"Run '{}'"`. */+function shapesOf(texts: Catalog): Map<string, Shape> {+ let shapes = shapeCache.get(texts);+ if (shapes) return shapes;+ shapes = new Map();+ for (const [source, translation] of Object.entries(texts)) {+ const names = [...source.matchAll(/\{(\w+)\}/g)].map((m) => m[1]!);+ if (names.length) shapes.set(source.replace(/\{\w+\}/g, "{}"), { names, translation });+ }+ shapeCache.set(texts, shapes);+ return shapes;+}++const interleave = (strings: readonly string[], parts: readonly string[]) =>+ strings.reduce((out, s, i) => out + parts[i - 1] + s);++function formatBuilt(texts: Catalog, { strings, values }: Built): string {+ const parts = values.map((v) => (typeof v === "string" ? (texts[v] ?? rebuild(texts, v) ?? v) : String(v)));+ const shape = shapesOf(texts).get(strings.join("{}"));+ if (!shape) return interleave(strings, parts);+ const params: MessageParams = {};+ shape.names.forEach((name, i) => (params[name] = parts[i]));+ return formatMessage(shape.translation, params);+}++function buildText(texts: Catalog, b: Built): string {+ const english = interleave(b.strings, b.values.map(String));+ remember(english, b);+ const text = formatBuilt(texts, b);+ if (text !== english) remember(text, b);+ return text;+}++/** Text that a `tx` tag built, in the locale of `texts`; `undefined` for any other text. */+function rebuild(texts: Catalog, text: string): string | undefined {+ const b = built.get(text);+ return b && formatBuilt(texts, b);+}+type Template = { pattern: RegExp; names: string[]; translation: string; literal: number };const templateCache = new WeakMap<Catalog, Template[]>();@@ -208,7 +279,7 @@ function templatesOf(texts: Catalog): Template[] {}function translateText(texts: Catalog, text: string): string {- const exact = texts[text];+ const exact = texts[text] ?? rebuild(texts, text);if (exact !== undefined) return exact;for (const { pattern, names, translation } of templatesOf(texts)) {const m = pattern.exec(text);diff --git a/src/platform/inspectionControls.ts b/src/platform/inspectionControls.tsindex 9b5cf3ee8..25ce379d7 100644--- a/src/platform/inspectionControls.ts+++ b/src/platform/inspectionControls.ts@@ -18,6 +18,7 @@ import {type InspectionRef,type ProfileOverrides,} from "./inspections";+import { tx } from "@/platform/i18n";/** Menu rows (structurally `@/ui` `MenuItem`s). */export type ControlItem =@@ -106,7 +107,7 @@ export function problemControls(inspection: InspectionRef): ControlItem[] {return [{id: "inspection.disable",- label: `Disable Inspection '${inspection.name}'`,+ label: tx`Disable Inspection '${inspection.name}'`,verbatim: true,run: () => report(disableInspection(inspection.id)),},diff --git a/src/platform/jdk.ts b/src/platform/jdk.tsindex e0517311f..d1259abe0 100644--- a/src/platform/jdk.ts+++ b/src/platform/jdk.ts@@ -6,6 +6,7 @@import { Channel } from "@tauri-apps/api/core";import { executeAction, getAction } from "./actions";import { call, commands, nextRequestId, type InstallEvent, type Sdk } from "./ipc";+import { tx } from "@/platform/i18n";export const DOWNLOAD_JDK_ACTION = "java.downloadJdk";export const TEMURIN = "temurin";@@ -38,7 +39,7 @@ export function downloadJdkActions(message: string | null | undefined): Array<{const need = requiredJdk(message);if (!need || !getAction(DOWNLOAD_JDK_ACTION)) return [];const args: DownloadJdkArgs = { version: need.version, languageServer: need.languageServer };- return [{ label: `Download JDK ${need.version}`, run: () => void executeAction(DOWNLOAD_JDK_ACTION, args) }];+ return [{ label: tx`Download JDK ${need.version}`, run: () => void executeAction(DOWNLOAD_JDK_ACTION, args) }];}export function isDownloadJdkArgs(arg: unknown): arg is DownloadJdkArgs {diff --git a/src/platform/locales/text/zh.json b/src/platform/locales/text/zh.jsonindex 79df5ddc1..cb52c8407 100644--- a/src/platform/locales/text/zh.json+++ b/src/platform/locales/text/zh.json@@ -2342,7 +2342,6 @@"select specific rows from a table": "从表中选择特定行","select the number of specific rows in a table": "选择表中特定行的数量","surrounded text,": "被包围的文本,",- "the JavaScript debugger (vscode-js-debug)": "JavaScript 调试器 (vscode-js-debug)","the language server's own TypeScript": "语言服务器自带的 TypeScript","update values in a table": "更新表中的值","val declaration": "val 声明",@@ -2692,7 +2691,6 @@"Client Certificate File": "客户端证书文件","Client key file:": "客户端密钥文件:","Client Key File": "客户端密钥文件",- "schemas (databases)": "架构(数据库)","Load Names from Server": "从服务器加载名称","Driver properties": "驱动程序属性","Property name": "属性名称",@@ -3180,7 +3178,6 @@"Unused Images": "未使用的镜像","Unused Volumes": "未使用的卷","Unused Networks": "未使用的网络",- "Unused Containers": "未使用的容器","Everything Unused (System Prune)": "所有未使用的对象(系统清理)","Remove all stopped containers?": "移除所有已停止的容器?","Remove all dangling (untagged) images?": "移除所有悬空(无标签)镜像?",@@ -3189,7 +3186,6 @@"Remove all networks not used by a container?": "移除所有未被容器使用的网络?","Remove stopped containers, unused networks, dangling images and the build cache?": "移除已停止的容器、未使用的网络、悬空镜像和构建缓存?","Prune {target}": "清理{target}",- "Prune {target}…": "清理{target}…","Pruning {target}…": "正在清理 {target}…","Pulling {name}…": "正在拉取 {name}…","containers": "容器",@@ -3453,7 +3449,6 @@"default": "默认","<unchanged>": "<未更改>","Single database mode (show only the configured database)": "单数据库模式(仅显示配置的数据库)",- "databases": "数据库","schemas": "架构","Object filter:": "对象筛选:","e.g. order*, customers (tables, views, routines, sequences)": "例如 order*、customers(表、视图、例程、序列)",@@ -3468,7 +3463,6 @@"<data source>": "<数据源>","Cannot explain the statement": "无法解释该语句","Cannot get the definition of {name}": "无法获取 {name} 的定义",- "Cannot copy the {what}": "无法复制 {what}","Script finished: {length} statement": "脚本已完成:{length} 条语句","Script finished: {length} statements": "脚本已完成:{length} 条语句","Import from Clipboard": "从剪贴板导入",@@ -3622,7 +3616,6 @@"Compare Versions": "比较版本","Select two commits to compare": "选择两个提交进行比较","Label '{value}' added to Local History": "已将标签 '{value}' 添加到本地历史记录",- "No {noun} in progress": "没有正在进行的 {noun}","{doneTitle} successful": "{doneTitle}成功","{file} updated in {commit}": "已在 {commit} 中更新 {file}","Shelved {length} file": "已搁置 {length} 个文件",@@ -3638,7 +3631,6 @@"Open the HTML or SVG file in the default browser through the built-in server": "通过内置服务器在默认浏览器中打开 HTML 或 SVG 文件","Show the HTML file rendered beside the editor": "在编辑器旁显示 HTML 文件的渲染结果","Project folder not found: {name}": "找不到项目文件夹:{name}",- "Cannot open {name}": "无法打开 {name}","Cannot reopen {name}": "无法重新打开 {name}","Edit inspection profile setting": "编辑检查配置文件设置","Disable inspection": "禁用检查",@@ -3685,5 +3677,285 @@"Solarized Light": "Solarized 浅色","Solarized Dark": "Solarized 深色","One Light": "One 浅色",- "One Dark": "One 深色"+ "One Dark": "One 深色",+ "Copied reference: {reference}": "已复制引用:{reference}",+ "{count} lines": "{count} 行",+ "Preview of {path}": "{path} 的预览",+ "Editor for {path}": "{path} 的编辑器",+ "Unwrap '{label}'": "解包 '{label}'",+ "'{name}' is read-only. Make it writable?": "'{name}' 为只读。是否设为可写?",+ "Make '{name}' read-only?": "是否将 '{name}' 设为只读?",+ "Some unsaved edits to {path} could not be applied and were replaced by the file's current content.": "{path} 的部分未保存编辑无法应用,已被文件的当前内容替换。",+ "No editor for “{kind}”": "没有适用于“{kind}”的编辑器",+ "Show usages of {name}": "显示 {name} 的用法",+ "Cannot resolve file '{value}'": "无法解析文件 '{value}'",+ "Reformat File: {name}": "重新格式化文件:{name}",+ "Inspection '{name}' options": "检查 '{name}' 的选项",+ "Choose Declaration of '{label}' ({count} found)": "选择 '{label}' 的声明(找到 {count} 个)",+ "Press {keys} to show dialog with more options": "按 {keys} 显示包含更多选项的对话框",+ "Rename '{oldName}' to '{newName}'": "将 '{oldName}' 重命名为 '{newName}'",+ "Rename '{name}'": "重命名 '{name}'",+ "Change '{word}' to": "将 '{word}' 更改为",+ "Rename '{word}' to": "将 '{word}' 重命名为",+ "Save '{word}' to project-level dictionary": "将 '{word}' 保存到项目级词典",+ "Save '{word}' to application-level dictionary": "将 '{word}' 保存到应用程序级词典",+ "Typo: In word '{word}'": "拼写错误:单词 '{word}'",+ "Can't rename '{name}' without the language server: only local variables can be renamed based on syntax": "没有语言服务器时无法重命名 '{name}':基于语法只能重命名局部变量",+ "Choose Super Class or Interface ({count} found)": "选择超类或接口(找到 {count} 个)",+ "Choose Super Method of {name} ({count} found)": "选择 {name} 的超方法(找到 {count} 个)",+ "Replace all {count} occurrences": "替换全部 {count} 处",+ "↵ Apply · Esc Keep '{name}'": "↵ 应用 · Esc 保留 '{name}'",+ " (in {files} files)": "(位于 {files} 个文件中)",+ "{subject} have {n} usage that is not safe to delete{where}.": "{subject}有 {n} 个用法无法安全删除{where}。",+ "{subject} have {n} usages that are not safe to delete{where}.": "{subject}有 {n} 个用法无法安全删除{where}。",+ "{subject} has {n} usage that is not safe to delete{where}.": "{subject}有 {n} 个用法无法安全删除{where}。",+ "{subject} has {n} usages that are not safe to delete{where}.": "{subject}有 {n} 个用法无法安全删除{where}。",+ "{n} usage found": "找到 {n} 个用法",+ "{n} usages found": "找到 {n} 个用法",+ "Safe Delete {kind} '{name}'": "安全删除{kind} '{name}'",+ "Delete {kind} '{name}'?": "是否删除{kind} '{name}'?",+ "File '{name}'": "文件 '{name}'",+ "The {count} files": "这 {count} 个文件",+ "Delete “{title}”? Its branch {branch} is kept.": "是否删除“{title}”?其分支 {branch} 将保留。",+ "Delete “{title}”? Files it changed are kept.": "是否删除“{title}”?它更改的文件将保留。",+ "{name} is over 5 MB.": "{name} 超过 5 MB。",+ "{used} / {size} tokens{cost}": "{used} / {size} 个令牌{cost}",+ "Replace in {path}:{line}": "在 {path}:{line} 中替换",+ "Clean up {count} files?": "是否清理 {count} 个文件?",+ "Leave empty to use the folder name ({folder}).": "留空则使用文件夹名称({folder})。",+ "Debug '{name}'": "调试 '{name}'",+ "Open {file}": "打开 {file}",+ "{direction} Hierarchy": "{direction}层次结构",+ "Language servers: {text}": "语言服务器:{text}",+ "Install {name}": "安装 {name}",+ "Restart {name}": "重启 {name}",+ "{count} error": "{count} 个错误",+ "{count} errors": "{count} 个错误",+ "{count} warning": "{count} 个警告",+ "{count} warnings": "{count} 个警告",+ "{errors} and {warnings}": "{errors}和{warnings}",+ "{found} found in {n} file": "在 {n} 个文件中发现{found}",+ "{found} found in {n} files": "在 {n} 个文件中发现{found}",+ "{message} Install it with: {command}": "{message} 安装命令:{command}",+ "Import Data into {schema}.{table}": "将数据导入 {schema}.{table}",+ "Import {count} Rows": "导入 {count} 行",+ "{source} Query History": "{source} 查询历史记录",+ "Local filter of {column}": "{column} 的本地筛选",+ "Values of {column}": "{column} 的值",+ "Copy as {format}": "复制为 {format}",+ "Connect to {name}": "连接到 {name}",+ "SSH: {name}": "SSH:{name}",+ "Modify Table {table}": "修改表 {table}",+ "{label} (seconds)": "{label}(秒)",+ "Succeeded: {version}": "成功:{version}",+ "All databases": "全部数据库",+ "Add databases pattern": "添加数据库模式",+ "All schemas (databases)": "全部架构(数据库)",+ "All schemas": "全部架构",+ "Add schemas (databases) pattern": "添加架构(数据库)模式",+ "Add schemas pattern": "添加架构模式",+ "Data Source: {name}": "数据源:{name}",+ "{table} data": "{table} 数据",+ "{count} rows": "{count} 行",+ "Remove data source '{name}'? Its query console file stays on disk.": "是否移除数据源 '{name}'?其查询控制台文件将保留在磁盘上。",+ "Result {n}": "结果 {n}",+ "{name} has uncommitted changes. Commit or roll them back before switching to auto-commit?": "{name} 有未提交的更改。是否在切换到自动提交前提交或回滚这些更改?",+ "Cannot copy the name": "无法复制名称",+ "Cannot copy the reference": "无法复制引用",+ "Cannot copy the DDL": "无法复制 DDL",+ "Start the remote JVM with -agentlib:jdwp=transport=dt_socket,server=n,address={host}:{port},suspend=y": "使用 -agentlib:jdwp=transport=dt_socket,server=n,address={host}:{port},suspend=y 启动远程 JVM",+ "{class} reloaded": "已重新加载 {class}",+ "The JavaScript debugger (vscode-js-debug) is not installed": "JavaScript 调试器 (vscode-js-debug) 未安装",+ "Delve is not installed": "Delve 未安装",+ "CodeLLDB is not installed": "CodeLLDB 未安装",+ "{name} (child)": "{name}(子进程)",+ "Enable breakpoint at {path}:{line}": "启用位于 {path}:{line} 的断点",+ "Files {count}": "文件 {count}",+ "Commits {count}": "提交 {count}",+ "Conversation {count}": "对话 {count}",+ "Push '{head}' first": "请先推送 '{head}'",+ "Review #{number}": "审查 #{number}",+ "Headers ({count})": "标头 ({count})",+ "Headers": "标头",+ "Delete the macro '{name}'?": "是否删除宏 '{name}'?",+ "{count} processes": "{count} 个进程",+ "Memory: {usage}": "内存:{usage}",+ " Memory {before} → {after}.": " 内存 {before} → {after}。",+ "{count} syntax tree dropped, index compacted.{memory}": "已丢弃 {count} 个语法树,已压缩索引。{memory}",+ "{count} syntax trees dropped, index compacted.{memory}": "已丢弃 {count} 个语法树,已压缩索引。{memory}",+ "Disable {name}": "禁用 {name}",+ "Enable {name}": "启用 {name}",+ "Run {name}": "运行 {name}",+ "Apply theme {name}": "应用主题 {name}",+ "Confirm uninstall {name}": "确认卸载 {name}",+ "From plugin {name}": "来自插件 {name}",+ "{count} items": "{count} 项",+ "Refactoring Preview: {title}": "重构预览:{title}",+ "Include {path}": "包含 {path}",+ "Project View: {option}": "项目视图:{option}",+ "Project View: Show {view}": "项目视图:显示{view}",+ "Reveal in {fileManager}": "在{fileManager}中显示",+ "Unmark as {role}": "取消标记为{role}",+ "Updated references in {count} file": "已更新 {count} 个文件中的引用",+ "Updated references in {count} files": "已更新 {count} 个文件中的引用",+ "Changed since the refactoring, not reverted: {files}": "重构后已更改,未还原:{files}",+ "Remove '{name}'": "移除 '{name}'",+ "{name} output": "{name} 输出",+ "Finished in {duration}, exit code {code}": "已完成,用时 {duration},退出代码 {code}",+ "{name} terminal": "{name} 终端",+ "Stop ({count} running)": "停止({count} 个正在运行)",+ "Rerun '{name}'": "重新运行 '{name}'",+ "Stop '{name}'": "停止 '{name}'",+ "Comparison Failure: {name}": "比较失败:{name}",+ "Process '{name}' Is Running": "进程 '{name}' 正在运行",+ "'{name}' is not allowed to run in parallel.\nWould you like to stop {count} running instances?": "'{name}' 不允许并行运行。\n是否停止 {count} 个正在运行的实例?",+ "'{name}' is not allowed to run in parallel.\nWould you like to stop the running one?": "'{name}' 不允许并行运行。\n是否停止正在运行的实例?",+ "Do you want to terminate the process '{name}'?": "是否终止进程 '{name}'?",+ "Running '{name}' without the debugger.": "正在不使用调试器运行 '{name}'。",+ "{className} is not part of the project, and no library sources are available for it.": "{className} 不属于项目,也没有可用的库源代码。",+ "{count} running": "{count} 个正在运行",+ "Stack trace {title}": "堆栈跟踪 {title}",+ "Error running '{name}': {message}\n": "运行 '{name}' 时出错:{message}\n",+ "Cannot write to stdin: {message}\n": "无法写入 stdin:{message}\n",+ "Run Gradle tasks": "运行 Gradle 任务",+ "Run Maven goals": "运行 Maven 目标",+ "Delete the list '{name}' with its {count} bookmark?": "是否删除列表 '{name}' 及其 {count} 个书签?",+ "Delete the list '{name}' with its {count} bookmarks?": "是否删除列表 '{name}' 及其 {count} 个书签?",+ "Delete {count} Bookmarks": "删除 {count} 个书签",+ "Remove the connection '{name}' from Services?": "是否从服务中移除连接 '{name}'?",+ "Remove the registry '{name}' and its saved password?": "是否移除注册表 '{name}' 及其保存的密码?",+ "Prune Unused Containers…": "清理未使用的容器…",+ "Prune Dangling Images…": "清理悬空镜像…",+ "Prune Unused Images…": "清理未使用的镜像…",+ "Prune Unused Volumes…": "清理未使用的卷…",+ "Prune Unused Networks…": "清理未使用的网络…",+ "Prune Everything Unused…": "清理所有未使用的内容…",+ "Delete Container": "删除容器",+ "Delete container '{name}'? It is running and will be stopped.": "是否删除容器 '{name}'?它正在运行,将被停止。",+ "Delete container '{name}'?": "是否删除容器 '{name}'?",+ "Delete Image": "删除镜像",+ "Delete image '{name}'?": "是否删除镜像 '{name}'?",+ "Delete Volume": "删除卷",+ "Delete volume '{name}'?": "是否删除卷 '{name}'?",+ "Delete Network": "删除网络",+ "Delete network '{name}'?": "是否删除网络 '{name}'?",+ "Stop and remove the containers and networks of '{name}'?": "是否停止并移除 '{name}' 的容器和网络?",+ "Build Image '{tag}'": "构建镜像 '{tag}'",+ "Enter a value between {min} and {max}": "请输入介于 {min} 和 {max} 之间的值",+ "based on {parent}": "基于 {parent}",+ "Delete keymap '{name}'?": "是否删除按键映射 '{name}'?",+ "Remove {shortcut}": "移除 {shortcut}",+ "Keyboard Shortcut: {action}": "键盘快捷键:{action}",+ "Remove content root {path}": "移除内容根 {path}",+ "Unmark {folder}": "取消标记 {folder}",+ "File name patterns of {name}": "{name} 的文件名模式",+ "Hashbang patterns of {name}": "{name} 的 Hashbang 模式",+ "{group} popup type": "{group}弹出类型",+ "Show {group} in tool window": "在工具窗口中显示{group}",+ "{label} hex": "{label}十六进制值",+ "{label} custom value": "{label}自定义值",+ "Delete inspection profile '{name}'?": "是否删除检查配置文件 '{name}'?",+ "{server} problems with code {code} ({source}).": "{server} 报告的代码为 {code} 的问题({source})。",+ "{server} problems with code {code}.": "{server} 报告的代码为 {code} 的问题。",+ "{description}\n\nExample: {sample}": "{description}\n\n示例:{sample}",+ "Problems the {server} language server reports in {languages} files. Severity \"As reported\" keeps the level the server assigns; a code below can override it.": "{server} 语言服务器在 {languages} 文件中报告的问题。严重性“按报告”保留服务器分配的级别;下方的代码可以覆盖它。",+ "Problems the {server} language server reports. Severity \"As reported\" keeps the level the server assigns; a code below can override it.": "{server} 语言服务器报告的问题。严重性“按报告”保留服务器分配的级别;下方的代码可以覆盖它。",+ "Auto-detected: {path}": "自动检测:{path}",+ "New {name}": "新建 {name}",+ "Name (.{extension})": "名称 (.{extension})",+ "'{abbreviation}' does not describe a single element.": "'{abbreviation}' 不是描述单个元素的缩写。",+ "New {name}…": "新建 {name}…",+ "{name} expression": "{name} 表达式",+ "{name} default value": "{name} 默认值",+ "Skip {name} if defined": "已定义时跳过 {name}",+ "Enable .{key}": "启用 .{key}",+ "{keyword} colour": "{keyword} 颜色",+ "{count} file": "{count} 个文件",+ "{count} files": "{count} 个文件",+ "Reinstall {name}": "重新安装 {name}",+ "Installed in {path}; it is used for projects targeting Java {version}.": "已安装到 {path};用于以 Java {version} 为目标的项目。",+ "Code insight for {languages} needs {command}. Install it via {method}?": "{languages} 的代码洞察需要 {command}。是否通过 {method} 安装?",+ "Version {version}": "版本 {version}",+ "Branch {name}": "分支 {name}",+ "Tag {name}": "标签 {name}",+ "Branch {branch} of {repository}": "{repository} 的分支 {branch}",+ "Branches of {root}": "{root} 的分支",+ "Include {name} in commit": "在提交中包含 {name}",+ "Compare {current} with {branch}": "比较 {current} 与 {branch}",+ "Rebase '{head}' onto Selected Commit": "将 '{head}' 变基到所选提交",+ "Revert {file} to the revision from {time} ({label})?": "是否将 {file} 还原到 {time} 的修订({label})?",+ "Revert {count} files under {folder} to label '{label}'?": "是否将 {folder} 下的 {count} 个文件还原到标签 '{label}'?",+ "Revert {file} to label '{label}'?": "是否将 {file} 还原到标签 '{label}'?",+ "Revert from Local History": "从本地历史记录还原",+ "{count} conflict is unresolved and keeps the base text. Save and mark the file as resolved anyway?": "{count} 个冲突未解决,将保留基础文本。仍要保存并将文件标记为已解决吗?",+ "{count} conflicts are unresolved and keep the base text. Save and mark the file as resolved anyway?": "{count} 个冲突未解决,将保留基础文本。仍要保存并将文件标记为已解决吗?",+ "{submodule} points to another commit. Check out the recorded commit in the submodule (git submodule update) to revert it.": "{submodule} 指向另一个提交。请在子模块中签出记录的提交 (git submodule update) 以还原它。",+ "New Branch from '{name}'…": "从 '{name}' 新建分支…",+ "Rebase Current onto '{name}'": "将当前分支变基到 '{name}'",+ "Merge '{name}' into Current": "将 '{name}' 合并到当前分支",+ "Checkout and Rebase onto '{current}'": "签出并变基到 '{current}'",+ "Compare with '{current}'": "与 '{current}' 比较",+ "Rebase '{current}' onto '{name}'": "将 '{current}' 变基到 '{name}'",+ "Merge '{name}' into '{current}'": "将 '{name}' 合并到 '{current}'",+ "Create New Branch from {from}": "从 {from} 创建新分支",+ "Rename Branch {name}": "重命名分支 {name}",+ "Delete branch '{name}' on the remote? The remote-tracking branch '{tracking}' is removed as well.": "是否删除远程上的分支 '{name}'?远程跟踪分支 '{tracking}' 也将被移除。",+ "New branch name (in {count} repositories):": "新分支名称(在 {count} 个仓库中):",+ "Delete branch '{name}' in {count} repositories? Unmerged commits are discarded.": "是否删除 {count} 个仓库中的分支 '{name}'?未合并的提交将被丢弃。",+ "Your local changes to the following files would be overwritten by checkout:\n{files}\n\nSmart Checkout can stash the changes, checkout and unstash them after that.": "签出将覆盖以下文件的本地更改:\n{files}\n\n智能签出可以储藏这些更改,签出后再取消储藏。",+ "Unstash {ref} as branch {branch}": "将 {ref} 取消储藏为分支 {branch}",+ "Pop {ref}": "弹出 {ref}",+ "Apply {ref}": "应用 {ref}",+ "Drop {ref} “{message}”? This cannot be undone.": "是否丢弃 {ref}“{message}”?此操作无法撤消。",+ "Drop {ref}? This cannot be undone.": "是否丢弃 {ref}?此操作无法撤消。",+ "Changelist '{name}' contains {count} change. It will be moved to '{target}'. Delete the changelist?": "变更列表 '{name}' 包含 {count} 个更改,它将被移至 '{target}'。是否删除该变更列表?",+ "Changelist '{name}' contains {count} changes. They will be moved to '{target}'. Delete the changelist?": "变更列表 '{name}' 包含 {count} 个更改,它们将被移至 '{target}'。是否删除该变更列表?",+ "{name} (active)": "{name}(活动)",+ "from {path}": "来自 {path}",+ "{dir} · from {path}": "{dir} · 来自 {path}",+ "Clipboard ↔ {file} (selection)": "剪贴板 ↔ {file}(所选内容)",+ "Clipboard ↔ {file}": "剪贴板 ↔ {file}",+ "Pull to {head}": "拉取到 {head}",+ "Merge into {head}": "合并到 {head}",+ "Merge branch '{branch}' into {head}": "将分支 '{branch}' 合并到 {head}",+ "Remove remote '{name}'? Its remote-tracking branches are deleted.": "是否移除远程 '{name}'?其远程跟踪分支将被删除。",+ "Remove the worktree at {path}? Its folder is deleted.": "是否移除位于 {path} 的工作树?其文件夹将被删除。",+ "{error}\n\nRemove it anyway, discarding its changes?": "{error}\n\n仍要移除并丢弃其更改吗?",+ "{count} file has conflicts: {files}": "{count} 个文件存在冲突:{files}",+ "{count} files have conflicts: {files}": "{count} 个文件存在冲突:{files}",+ "{status} (from {path})": "{status}(来自 {path})",+ "Create New Tag On {commit}": "在 {commit} 上创建新标签",+ "Changes between {from} and Local Working Tree": "{from} 与本地工作树之间的更改",+ "Changes between {from} and {to}": "{from} 与 {to} 之间的更改",+ "No rebase in progress": "没有正在进行的变基",+ "No merge in progress": "没有正在进行的合并",+ "No cherry-pick in progress": "没有正在进行的拣选",+ "No revert in progress": "没有正在进行的还原",+ "No patch application in progress": "没有正在进行的补丁应用",+ "Apply Patch: {source}": "应用补丁:{source}",+ "Drop {count} commits from the current branch? Their changes are removed.": "是否从当前分支丢弃 {count} 个提交?它们的更改将被移除。",+ "Drop commit {id} “{summary}” from the current branch? Its changes are removed.": "是否从当前分支丢弃提交 {id}“{summary}”?其更改将被移除。",+ "Action for {id}": "{id} 的操作",+ "Rebasing {n} commit onto {onto}": "正在将 {n} 个提交变基到 {onto}",+ "Rebasing {n} commits onto {onto}": "正在将 {n} 个提交变基到 {onto}",+ "Rebasing {n} commit from the root": "正在从根变基 {n} 个提交",+ "Rebasing {n} commits from the root": "正在从根变基 {n} 个提交",+ "Push Commits to {remote}": "推送提交到 {remote}",+ "You're going to force push to '{target}'. It may overwrite commits at the remote. Are you sure you want to proceed?": "您将强制推送到 '{target}'。这可能会覆盖远程上的提交。确定要继续吗?",+ "Delete “{name}” from the shelf? This cannot be undone.": "是否从搁置中删除“{name}”?此操作无法撤消。",+ "Handler for {keystroke}": "{keystroke} 的处理程序",+ "Open '{path}' in Browser": "在浏览器中打开 '{path}'",+ "Open ({shortcut})": "打开 ({shortcut})",+ "Remove '{name}' from the list of recent projects?": "是否从最近项目列表中移除 '{name}'?",+ "Disable Inspection '{name}'": "禁用检查 '{name}'",+ "Download JDK {version}": "下载 JDK {version}",+ "Cancel {title}": "取消{title}",+ "Background tasks: {title}": "后台任务:{title}",+ "{files} files · {symbols} symbols": "{files} 个文件 · {symbols} 个符号",+ "{title} view options": "{title}视图选项",+ "{title} views": "{title}视图",+ "{title} options": "{title}选项",+ "Delete the layout '{name}'?": "是否删除布局 '{name}'?",+ "In {left}, not in {right}": "在 {left} 中,不在 {right} 中",+ "Local branch '{local}' has commits that do not exist in '{remote}'. Rebase '{local}' onto '{remote}', or drop local commits?": "本地分支 '{local}' 有 '{remote}' 中不存在的提交。是将 '{local}' 变基到 '{remote}',还是丢弃本地提交?"}diff --git a/src/platform/locales/textCatalog.test.ts b/src/platform/locales/textCatalog.test.tsindex 8f2329a40..0623afba1 100644--- a/src/platform/locales/textCatalog.test.ts+++ b/src/platform/locales/textCatalog.test.ts@@ -14,9 +14,14 @@* - a `TEXT_PROPS` property of an object literal (`{ label: "…" }`): actions, menu* items, select options, dialogs, notifications, settings pages, tool windows;* - the text arguments of `showHint` and `showError`.- * Template literals (`Cannot open ${path}`) are checked only where the text is- * matched against `{name}` templates (`txTemplate`, hints, notification titles);- * elsewhere the lookup is exact and they cannot be translated as written.+ * Text built at runtime is written with the `tx` tag (`` tx`Cannot open ${path}` ``),+ * which looks up `"Cannot open {path}"`; untagged template literals are checked+ * where the text is matched against `{name}` templates (`txTemplate`, hints,+ * notification titles). Elsewhere the lookup is exact, so an untagged template+ * literal can never be translated: it fails here unless `TEMPLATES_AS_WRITTEN` lists+ * it. Tagged or matched text must not splice in English words to be read as part of+ * the sentence (`${kind.toLowerCase()}`, `${n === 1 ? "" : "s"}`): those need one+ * text per variant.** Not seen: text kept in a variable or built by a helper before it reaches `tx`,* and text sent by the backend. Their entries count as used (not stale) as long as@@ -70,9 +75,7 @@ const UNCHECKED_FILES = new Set([]);/** Entries for text the code assembles from parts, which no literal spells out. */-const BUILT_AT_RUNTIME = new Set([- "Unused Containers", // `Unused ${group}` in services/ops.ts-]);+const BUILT_AT_RUNTIME = new Set<string>([]);/** Text that stays as written in every locale: names, code, formats, shortcuts. */const UNTRANSLATED = new Set<string>([@@ -188,10 +191,25 @@ const UNTRANSLATED = new Set<string>(["text",]);+/**+ * Template literals that reach an exact lookup on purpose: the text around the+ * values is code or a format that reads the same in every locale.+ */+const TEMPLATES_AS_WRITTEN = new Set<string>([+ "{name} (#[cfg(test)])", // Rust attribute after a module name+ "HEAD ({renamedFrom})", // Git revision and a path+]);++/**+ * How a text is found in a catalog: as written (`exact`), by matching `{name}`+ * templates (`pattern`, see `txTemplate`), or by its literal parts (`shape`, the `tx` tag).+ */+type Match = "exact" | "pattern" | "shape";+interface Use {text: string;at: string;- template: boolean;+ match: Match;}function walk(dir: string, accept: (path: string) => boolean, out: string[] = []): string[] {@@ -237,23 +255,43 @@ const unwrap = (e: ts.Expression): ts.Expression => (ts.isParenthesizedExpressiofunction templateTexts(node: ts.TemplateExpression): string[] {let out = [node.head.text];for (const span of node.templateSpans) {- const e = unwrap(span.expression);- let parts: string[];- if (- ts.isConditionalExpression(e) &&- ts.isStringLiteralLike(unwrap(e.whenTrue)) &&- ts.isStringLiteralLike(unwrap(e.whenFalse))- )- parts = [(unwrap(e.whenTrue) as ts.StringLiteralLike).text, (unwrap(e.whenFalse) as ts.StringLiteralLike).text];- else {- const words = span.expression.getText().match(/[A-Za-z_]\w*/g) ?? ["value"];- parts = [`{${words[words.length - 1]}}`];- }+ const branches = stringBranches(span.expression);+ const parts = branches ?? [placeholder(span.expression)];out = out.flatMap((head) => parts.map((part) => head + part + span.literal.text));}return out;}+/** Text of a `tx` tag as it looks it up: every `${expr}` is a placeholder. */+function tagText(node: ts.TemplateLiteral): string {+ if (ts.isNoSubstitutionTemplateLiteral(node)) return node.text;+ return node.head.text + node.templateSpans.map((s) => placeholder(s.expression) + s.literal.text).join("");+}++function placeholder(e: ts.Expression): string {+ const words = e.getText().match(/[A-Za-z_]\w*/g) ?? ["value"];+ return `{${words[words.length - 1]}}`;+}++/** The branches of `c ? "a" : "b"`. */+function stringBranches(expr: ts.Expression): string[] | undefined {+ const e = unwrap(expr);+ if (!ts.isConditionalExpression(e)) return undefined;+ const [a, b] = [unwrap(e.whenTrue), unwrap(e.whenFalse)];+ return ts.isStringLiteralLike(a) && ts.isStringLiteralLike(b) ? [a.text, b.text] : undefined;+}++/** A value that changes the case of English text, to splice it into a sentence. */+function changesCase(expr: ts.Expression): boolean {+ let found = false;+ const visit = (n: ts.Node) => {+ if (ts.isPropertyAccessExpression(n) && /^to(Lower|Upper)Case$/.test(n.name.text)) found = true;+ ts.forEachChild(n, visit);+ };+ visit(expr);+ return found;+}+/** `{anything}` → `{}`, so templates compare regardless of placeholder names. */const shape = (text: string) => text.replace(/\{[^{}]*\}/g, "{}");@@ -339,10 +377,16 @@ interface Scan {translated: Use[];/** Every string literal and JSX text, in shape form. */literals: Set<string>;+ /** Template literals that reach an exact lookup, which can never match them. */+ untranslatable: Use[];+ /** Translated templates that splice English words into the sentence. */+ spliced: Use[];}function scanTypeScript(): Scan {const translated: Use[] = [];+ const untranslatable: Use[] = [];+ const spliced: Use[] = [];const literals = new Set<string>();const files = walk(`${ROOT}src`, (p) => /\.tsx?$/.test(p) && !isTest(p) && !p.endsWith("/bindings.ts"));for (const file of files) {@@ -360,7 +404,17 @@ function scanTypeScript(): Scan {for (const m of source.matchAll(/(?:const|let)\s+(\w+)\s*=\s*useTx(Template)?\(\)/g))(m[2] ? template : exact).add(m[1]!);const checked = !UNCHECKED_FILES.has(path);+ const where = (node: ts.Node) => `${path}:${sf.getLineAndCharacterOfPosition(node.getStart()).line + 1}`;const visit = (node: ts.Node) => {+ if (checked && ts.isTaggedTemplateExpression(node) && ts.isIdentifier(node.tag) && exact.has(node.tag.text)) {+ const use: Use = { text: tagText(node.template), at: where(node), match: "shape" };+ translated.push(use);+ if (+ ts.isTemplateExpression(node.template) &&+ node.template.templateSpans.some((s) => stringBranches(s.expression) || changesCase(s.expression))+ )+ spliced.push(use);+ }let texts: string[] | undefined;if (ts.isStringLiteral(node) && ts.isJsxAttribute(node.parent)) texts = [decodeEntities(node.text)];else if (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node)) texts = [node.text];@@ -372,17 +426,22 @@ function scanTypeScript(): Scan {literals.add(shape(text.trim()));}const sink = checked ? sinkOf(node, exact, template) : undefined;- // A template literal only matches a catalog entry where templates are looked up.- if (sink && (sink === "template" || !ts.isTemplateExpression(node))) {- const at = `${path}:${sf.getLineAndCharacterOfPosition(node.getStart()).line + 1}`;- for (const text of texts) translated.push({ text, at, template: ts.isTemplateExpression(node) });+ if (sink) {+ const at = where(node);+ if (!ts.isTemplateExpression(node)) for (const text of texts) translated.push({ text, at, match: "exact" });+ else if (sink === "exact") for (const text of texts) untranslatable.push({ text, at, match: "exact" });+ else {+ for (const text of texts) translated.push({ text, at, match: "pattern" });+ if (node.templateSpans.some((s) => changesCase(s.expression)))+ spliced.push({ text: texts[0]!, at, match: "pattern" });+ }}}ts.forEachChild(node, visit);};visit(sf);}- return { translated, literals };+ return { translated, literals, untranslatable, spliced };}/** String literals of the Rust crates and language definitions (backend messages). */@@ -423,21 +482,43 @@ function templatePatterns(catalog: Record<string, string>): RegExp[] {});}+const report = (uses: Use[]) =>+ [...new Map(uses.map((u) => [u.at, u.text]))].map(([at, text]) => `${at} ${JSON.stringify(text)}`);++it("passes no template literal UI text to an exact lookup; tag it as tx`…`", () => {+ expect(+ report(scan.untranslatable.filter(({ text }) => needsTranslation(text) && !TEMPLATES_AS_WRITTEN.has(text))),+ ).toEqual([]);+});++it("translates built text as whole sentences, one per variant", () => {+ expect(report(scan.spliced)).toEqual([]);+});+describe.each(Object.keys(catalogs))("source-text catalog %s", (locale) => {const catalog = catalogs[locale]!;const patterns = templatePatterns(catalog);+ const shapes = new Set(Object.keys(catalog).map(shape));const has = (text: string) => Object.hasOwn(catalog, text);// Placeholders of the source stand for any text, as the runtime values would.const matchesTemplate = (text: string) => patterns.some((p) => p.test(text.replace(/\{[^{}]*\}/g, "\u0001")));+ const found = ({ text, match }: Use) =>+ has(text) || (match === "pattern" && matchesTemplate(text)) || (match === "shape" && shapes.has(shape(text)));it("translates every literal UI text", () => {const missing = new Map<string, string>();- for (const { text, at, template } of scan.translated)- if (!has(text) && !(template && matchesTemplate(text)) && needsTranslation(text) && !missing.has(text))- missing.set(text, at);+ for (const use of scan.translated)+ if (!found(use) && needsTranslation(use.text) && !missing.has(use.text)) missing.set(use.text, use.at);expect([...missing].map(([text, at]) => `${at} ${JSON.stringify(text)}`)).toEqual([]);});+ it("has one entry per template, whatever its placeholder names", () => {+ const byShape = new Map<string, string[]>();+ for (const key of Object.keys(catalog))+ if (/\{\w+\}/.test(key)) byShape.set(shape(key), [...(byShape.get(shape(key)) ?? []), key]);+ expect([...byShape.values()].filter((keys) => keys.length > 1)).toEqual([]);+ });+it("has no entries whose text no longer appears in the source", () => {const stale = Object.keys(catalog).filter((key) => !scan.literals.has(shape(key)) && !BUILT_AT_RUNTIME.has(key));expect(stale).toEqual([]);diff --git a/src/workbench/StatusBar.tsx b/src/workbench/StatusBar.tsxindex 025ebab5a..8b01e3a2e 100644--- a/src/workbench/StatusBar.tsx+++ b/src/workbench/StatusBar.tsx@@ -6,6 +6,7 @@ import { ErrorBoundary } from "./ErrorBoundary";import { isStatusItemVisible, statusBarMenu, useStatusWidgetOverrides } from "./statusBarWidgets";import { useTasks } from "./tasks";import styles from "./StatusBar.module.css";+import { tx } from "@/platform/i18n";/*** Orders status items: on both sides a higher priority sits closer to the@@ -80,7 +81,7 @@ export function TaskStatus() {<BarButtonref={ref}aria-expanded={open}- aria-label={`Background tasks: ${current.title}`}+ aria-label={tx`Background tasks: ${current.title}`}tooltip={current.message ?? current.title}onClick={() => setOpen((v) => !v)}className={styles.task}@@ -115,7 +116,7 @@ export function TaskStatus() {</span>{t.fraction != null && <span className={styles.taskPct}>{Math.round(t.fraction * 100)}%</span>}{t.cancel && !t.done && (- <IconButton icon="stop" size="small" title={`Cancel ${t.title}`} onClick={() => t.cancel?.()} />+ <IconButton icon="stop" size="small" title={tx`Cancel ${t.title}`} onClick={() => t.cancel?.()} />)}</div><ProgressBar value={t.done ? 1 : t.fraction} aria-label={t.title} />diff --git a/src/workbench/tasks.ts b/src/workbench/tasks.tsindex 04cc9dc5d..d15f4458a 100644--- a/src/workbench/tasks.ts+++ b/src/workbench/tasks.ts@@ -1,6 +1,7 @@/** Background task progress (from `task` / `indexState` backend events). */import { create } from "zustand";import { onIdeEvent } from "@/platform/ipc";+import { tx } from "@/platform/i18n";export interface BackgroundTask {id: number | string;@@ -47,7 +48,7 @@ export function setIndexing(indexing: boolean, files: number, symbols: number) {upsertTask({id: INDEX_TASK_ID,title: "Indexing",- message: indexing ? `${files.toLocaleString()} files · ${symbols.toLocaleString()} symbols` : null,+ message: indexing ? tx`${files.toLocaleString()} files · ${symbols.toLocaleString()} symbols` : null,fraction: null,done: !indexing,});diff --git a/src/workbench/toolwindows/ToolWindows.tsx b/src/workbench/toolwindows/ToolWindows.tsxindex 942154307..5f20c9df6 100644--- a/src/workbench/toolwindows/ToolWindows.tsx+++ b/src/workbench/toolwindows/ToolWindows.tsx@@ -631,7 +631,7 @@ function ToolWindowView({ tw, hidden }: { tw: ToolWindowContribution; hidden: boonClose={() => setTitleOpen(false)}anchor={titleRef}items={titleItems}- aria-label={titleMenu ? `${tx(tw.title)} views` : `${tx(tw.title)} view options`}+ aria-label={titleMenu ? tx`${tw.title} views` : tx`${tw.title} view options`}/></>) : (@@ -674,7 +674,7 @@ function ToolWindowView({ tw, hidden }: { tw: ToolWindowContribution; hidden: boanchor={moreRef}items={more}placement="bottom-end"- aria-label={`${tx(tw.title)} options`}+ aria-label={tx`${tw.title} options`}/></header><div className={styles.body} data-toolwindow-body="">diff --git a/src/workbench/toolwindows/actions.ts b/src/workbench/toolwindows/actions.tsindex 66d1a9511..d1d8380ab 100644--- a/src/workbench/toolwindows/actions.ts+++ b/src/workbench/toolwindows/actions.ts@@ -116,7 +116,7 @@ function layoutActions(): Action[] {when: "toolWindowLayoutsSaved",run: async () => {const name = await pick("Delete Layout");- if (name && (await confirm({ title: "Delete Layout", message: `Delete the layout '${name}'?`, ok: "Delete", icon: "warning" })))+ if (name && (await confirm({ title: "Delete Layout", message: tx`Delete the layout '${name}'?`, ok: "Delete", icon: "warning" })))deleteLayout(name);},},