Skip to content

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.

feat(ui): IDEA-style message dialogs, project widget popup and Chinese UI text

l0ng-ai76d33f030650
diff --git a/src-tauri/src/commands/mod.rs b/src-tauri/src/commands/mod.rs
index 235fdf9cb..e56caeb2f 100644
--- a/src-tauri/src/commands/mod.rs
+++ b/src-tauri/src/commands/mod.rs
@@ -227,6 +227,7 @@ pub fn builder() -> tauri_specta::Builder<tauri::Wry> {
window::window_toggle_fullscreen,
window::window_take_launch,
window::window_close_context,
+ window::window_open_projects,
window::app_quit,
window::app_cancel_quit,
window::menu_configure,
diff --git a/src-tauri/src/commands/window.rs b/src-tauri/src/commands/window.rs
index dcc49989f..0718fe643 100644
--- a/src-tauri/src/commands/window.rs
+++ b/src-tauri/src/commands/window.rs
@@ -59,6 +59,36 @@ pub fn window_take_launch(window: WebviewWindow, windows: State<'_, WindowsState
windows.take_launch(window.label())
}
+#[derive(Serialize, Deserialize, Type)]
+#[serde(rename_all = "camelCase")]
+pub struct OpenProject {
+ pub name: String,
+ pub root: PathBuf,
+ /// Open in the calling window.
+ pub current: bool,
+}
+
+/// Projects open in project windows, in window order (title bar project widget).
+#[tauri::command]
+#[specta::specta]
+pub fn window_open_projects(
+ app: AppHandle,
+ window: WebviewWindow,
+ state: State<'_, AppState>,
+) -> IdeResult<Vec<OpenProject>> {
+ Ok(windows::project_window_labels(&app)
+ .into_iter()
+ .filter_map(|label| {
+ let project = state.project(&label).ok()?;
+ Some(OpenProject {
+ name: project.root.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default(),
+ root: project.root.clone(),
+ current: label == window.label(),
+ })
+ })
+ .collect())
+}
+
#[derive(Serialize, Deserialize, Type)]
#[serde(rename_all = "camelCase")]
pub struct CloseContext {
diff --git a/src/bindings.ts b/src/bindings.ts
index 119fb7d66..076cde334 100644
--- a/src/bindings.ts
+++ b/src/bindings.ts
@@ -434,6 +434,8 @@ export const commands = {
settingsPage: string | null,
} | null>("window_take_launch"),
windowCloseContext: () => __TAURI_INVOKE<CloseContext>("window_close_context"),
+ /** Projects open in project windows, in window order (title bar project widget). */
+ windowOpenProjects: () => typedError<OpenProject[], IdeError>(__TAURI_INVOKE("window_open_projects")),
/** Quits: closes every window, each of which runs its own unsaved-changes check. */
appQuit: () => __TAURI_INVOKE<void>("app_quit"),
/** A window vetoed the quit (user cancelled its unsaved-changes prompt). */
@@ -2716,6 +2718,13 @@ export type OpenOutcome =
/** The caller should open the project in its own window. */
{ kind: "current" };
+export type OpenProject = {
+ name: string,
+ root: string,
+ /** Open in the calling window. */
+ current: boolean,
+};
+
/** A node of a document outline (Structure tool window, breadcrumbs). */
export type OutlineItem = {
name: string,
diff --git a/src/editor/core/view/FindBar.tsx b/src/editor/core/view/FindBar.tsx
index 985d4e891..8ce10a071 100644
--- a/src/editor/core/view/FindBar.tsx
+++ b/src/editor/core/view/FindBar.tsx
@@ -8,7 +8,7 @@ import { useEffect, useLayoutEffect, useRef, type KeyboardEvent } from "react";
import { create } from "zustand";
import clsx from "clsx";
import type { EditorView } from "@codemirror/view";
-import { Button, IconButton, SearchField } from "@/ui";
+import { Button, IconButton, SearchField, T } from "@/ui";
import { editorController, useFindBars, useTabs } from "../controller";
import {
countMatches,
@@ -198,7 +198,11 @@ function FindBarInner({ paneId, replace, seq }: { paneId: string; replace: boole
else run(replaceNext);
} else run(back ? findPrevious : findNext);
} else if (e.altKey && !e.metaKey && !e.ctrlKey) {
- const map: Record<string, "caseSensitive" | "wholeWord" | "regexp"> = { KeyC: "caseSensitive", KeyW: "wholeWord", KeyX: "regexp" };
+ const map: Record<string, "caseSensitive" | "wholeWord" | "regexp"> = {
+ KeyC: "caseSensitive",
+ KeyW: "wholeWord",
+ KeyX: "regexp",
+ };
const k = map[e.code];
if (k) {
e.preventDefault();
@@ -235,17 +239,51 @@ function FindBarInner({ paneId, replace, seq }: { paneId: string; replace: boole
invalid={invalid || none}
onKeyDown={(e) => onKeyDown(e, "find")}
toggles={[
- { id: "case", icon: "case", title: "Match Case", shortcut: "⌥C", pressed: opts.caseSensitive, onToggle: () => toggle("caseSensitive") },
- { id: "word", icon: "word", title: "Words", shortcut: "⌥W", pressed: opts.wholeWord, onToggle: () => toggle("wholeWord") },
- { id: "regex", icon: "regex", title: "Regex", shortcut: "⌥X", pressed: opts.regexp, onToggle: () => toggle("regexp") },
- { id: "scope", icon: "filter", title: "In Selection", shortcut: "⌥E", pressed: scoped, onToggle: () => toggleScope(paneId) },
+ {
+ id: "case",
+ icon: "case",
+ title: "Match Case",
+ shortcut: "⌥C",
+ pressed: opts.caseSensitive,
+ onToggle: () => toggle("caseSensitive"),
+ },
+ {
+ id: "word",
+ icon: "word",
+ title: "Words",
+ shortcut: "⌥W",
+ pressed: opts.wholeWord,
+ onToggle: () => toggle("wholeWord"),
+ },
+ {
+ id: "regex",
+ icon: "regex",
+ title: "Regex",
+ shortcut: "⌥X",
+ pressed: opts.regexp,
+ onToggle: () => toggle("regexp"),
+ },
+ {
+ id: "scope",
+ icon: "filter",
+ title: "In Selection",
+ shortcut: "⌥E",
+ pressed: scoped,
+ onToggle: () => toggleScope(paneId),
+ },
]}
/>
<div className={styles.findButtons}>
<span className={clsx(styles.findCount, (none || invalid) && styles.findCountNone)} aria-live="polite">
{counter}
</span>
- <IconButton icon="arrow-up" title="Previous Occurrence" shortcut="⇧↵" size="small" onClick={() => run(findPrevious)} />
+ <IconButton
+ icon="arrow-up"
+ title="Previous Occurrence"
+ shortcut="⇧↵"
+ size="small"
+ onClick={() => run(findPrevious)}
+ />
<IconButton icon="arrow-down" title="Next Occurrence" shortcut="↵" size="small" onClick={() => run(findNext)} />
<IconButton
icon="replace"
@@ -270,10 +308,10 @@ function FindBarInner({ paneId, replace, seq }: { paneId: string; replace: boole
/>
<div className={styles.replaceButtons}>
<Button size="small" onClick={() => run(replaceNext)} disabled={!opts.search || invalid}>
- Replace
+ <T>Replace</T>
</Button>
<Button size="small" onClick={() => run(replaceAll)} disabled={!opts.search || invalid}>
- Replace All
+ <T>Replace All</T>
</Button>
</div>
</>
diff --git a/src/editor/core/view/NavBarPopup.tsx b/src/editor/core/view/NavBarPopup.tsx
index a08a6fe0e..a196795a8 100644
--- a/src/editor/core/view/NavBarPopup.tsx
+++ b/src/editor/core/view/NavBarPopup.tsx
@@ -9,11 +9,19 @@ import clsx from "clsx";
import { create } from "zustand";
import { call, commands, isTauri, type OutlineItem } from "@/platform/ipc";
import { useProject } from "@/platform/project";
-import { Icon, Popup } from "@/ui";
+import { Icon, Popup, T } from "@/ui";
import { editorController, useEditorStatus } from "../controller";
import { useOutline } from "../model/document";
import { symbolChain } from "./outline";
-import { dirChildren, iconOf, navSegments, stepSegment, symbolChildren, type NavChild, type NavSegment } from "./navBar";
+import {
+ dirChildren,
+ iconOf,
+ navSegments,
+ stepSegment,
+ symbolChildren,
+ type NavChild,
+ type NavSegment,
+} from "./navBar";
import styles from "./NavBarPopup.module.css";
export const useNavBarPopup = create<{ open: boolean; seq: number }>(() => ({ open: false, seq: 0 }));
@@ -48,7 +56,12 @@ function NavBar({ path, line, col }: { path: string; line: number; col: number }
const project = useProject((s) => s.project);
const outline = useOutline((s) => s[path]);
const initial = useMemo(
- () => navSegments(project ? { root: project.root, name: project.name } : null, path, outline ? symbolChain(outline, line, col) : []),
+ () =>
+ navSegments(
+ project ? { root: project.root, name: project.name } : null,
+ path,
+ outline ? symbolChain(outline, line, col) : [],
+ ),
// The bar is a snapshot of where ⌘↑ was pressed.
// eslint-disable-next-line react-hooks/exhaustive-deps
[],
@@ -76,7 +89,10 @@ function NavBar({ path, line, col }: { path: string; line: number; col: number }
const choose = (child: NavChild) => {
if (!list) return;
if (child.kind === "dir") {
- const segs: NavSegment[] = [...segments.slice(0, list.seg + 1), { kind: "dir", path: child.path, label: child.label }];
+ const segs: NavSegment[] = [
+ ...segments.slice(0, list.seg + 1),
+ { kind: "dir", path: child.path, label: child.label },
+ ];
setSegments(segs);
setActive(segs.length - 1);
void openList(segs.length - 1, segs);
@@ -101,7 +117,8 @@ function NavBar({ path, line, col }: { path: string; line: number; col: number }
if (e.key === "ArrowLeft") move(-1);
else if (e.key === "ArrowRight") move(1);
else if (e.key === "ArrowDown" && !list) void openList(active);
- else if (e.key === "ArrowDown" && list) setList({ ...list, active: Math.min(list.items.length - 1, list.active + 1) });
+ else if (e.key === "ArrowDown" && list)
+ setList({ ...list, active: Math.min(list.items.length - 1, list.active + 1) });
else if (e.key === "ArrowUp" && list) setList({ ...list, active: Math.max(0, list.active - 1) });
else if (e.key === "Enter" && list) {
const child = list.items[list.active];
@@ -123,8 +140,23 @@ function NavBar({ path, line, col }: { path: string; line: number; col: number }
}, [list]);
return (
- <Popup open anchor={anchor} placement="bottom-start" offset={0} onClose={close} aria-label="Navigation bar" className={styles.popup}>
- <div className={styles.root} tabIndex={0} data-autofocus onKeyDown={onKeyDown} role="toolbar" aria-label="Navigation bar">
+ <Popup
+ open
+ anchor={anchor}
+ placement="bottom-start"
+ offset={0}
+ onClose={close}
+ aria-label="Navigation bar"
+ className={styles.popup}
+ >
+ <div
+ className={styles.root}
+ tabIndex={0}
+ data-autofocus
+ onKeyDown={onKeyDown}
+ role="toolbar"
+ aria-label="Navigation bar"
+ >
<div className={styles.bar}>
{segments.map((s, i) => (
<span key={`${i}:${s.path}:${s.label}`} className={styles.segmentWrap}>
@@ -147,8 +179,18 @@ function NavBar({ path, line, col }: { path: string; line: number; col: number }
))}
</div>
{list && (
- <div ref={listRef} className={styles.list} style={{ marginLeft: list.left }} role="listbox" aria-label="Children">
- {list.items.length === 0 && <div className={styles.empty}>Nothing here</div>}
+ <div
+ ref={listRef}
+ className={styles.list}
+ style={{ marginLeft: list.left }}
+ role="listbox"
+ aria-label="Children"
+ >
+ {list.items.length === 0 && (
+ <div className={styles.empty}>
+ <T>Nothing here</T>
+ </div>
+ )}
{list.items.map((c, i) => (
<div
key={`${c.path}:${c.label}:${i}`}
diff --git a/src/editor/lsp/Popups.module.css b/src/editor/lsp/Popups.module.css
index 6a85ef4a5..49f684468 100644
--- a/src/editor/lsp/Popups.module.css
+++ b/src/editor/lsp/Popups.module.css
@@ -277,13 +277,7 @@
border-radius: 2px;
}
-.choiceMessage {
- padding: 14px 16px 4px;
- font-size: var(--fs-ui);
- color: var(--fg);
-}
.choiceDetail {
- padding: 4px 16px 12px;
- font-size: var(--fs-ui);
+ margin-top: 4px;
color: var(--fg-muted);
}
diff --git a/src/editor/lsp/Popups.test.tsx b/src/editor/lsp/Popups.test.tsx
index 405484ed7..45c4f6342 100644
--- a/src/editor/lsp/Popups.test.tsx
+++ b/src/editor/lsp/Popups.test.tsx
@@ -45,7 +45,7 @@ describe("Usages Detected dialog", () => {
expect(useLspPopup.getState().popup).toBeNull();
});
- it("Windows: View Usages · Delete Anyway · Cancel; Escape and the close button cancel", () => {
+ it("Windows: View Usages · Delete Anyway · Cancel; Escape and Cancel cancel", () => {
usePlatform.setState({ os: "windows" });
render(<LspPopups />);
let { cancel } = openUsagesDetected();
@@ -53,7 +53,7 @@ describe("Usages Detected dialog", () => {
fireEvent.keyDown(document.body, { key: "Escape" });
expect(cancel).toHaveBeenCalledTimes(1);
({ cancel } = openUsagesDetected());
- fireEvent.click(screen.getByRole("button", { name: "Close" }));
+ fireEvent.click(screen.getByRole("button", { name: "Cancel" }));
expect(cancel).toHaveBeenCalledTimes(1);
expect(screen.queryByRole("dialog")).toBeNull();
});
diff --git a/src/editor/lsp/Popups.tsx b/src/editor/lsp/Popups.tsx
index 7d7540205..3bd714f1f 100644
--- a/src/editor/lsp/Popups.tsx
+++ b/src/editor/lsp/Popups.tsx
@@ -1,7 +1,19 @@
/** React popups for LSP editor features, rendered as a workbench overlay. */
import { useEffect, useMemo, useRef, useState, type KeyboardEvent } from "react";
import clsx from "clsx";
-import { Button, Dialog, HighlightedText, Icon, Input, List, Popup, SymbolBadge, fileIconName, fuzzyMatch } from "@/ui";
+import {
+ Button,
+ Dialog,
+ HighlightedText,
+ Icon,
+ Input,
+ List,
+ Popup,
+ SymbolBadge,
+ fileIconName,
+ fuzzyMatch,
+ T,
+} from "@/ui";
import { basename, relativePath, useProject } from "@/platform/project";
import { editorService } from "@/workbench/contributions";
import { closePopup, useLspPopup, type ListPopupItem, type LspPopup } from "./popupStore";
@@ -24,9 +36,7 @@ function ListPopup({ popup }: { popup: Extract<LspPopup, { kind: "list" }> }) {
const [query, setQuery] = useState("");
const filtered = useMemo(() => {
if (!query) return popup.items.map((item) => ({ item, match: null as number[] | null }));
- return popup.items
- .map((item) => ({ item, match: fuzzyMatch(item.label, query) }))
- .filter((r) => r.match !== null);
+ return popup.items.map((item) => ({ item, match: fuzzyMatch(item.label, query) })).filter((r) => r.match !== null);
}, [popup.items, query]);
const firstEnabled = Math.max(
0,
@@ -59,7 +69,9 @@ function ListPopup({ popup }: { popup: Extract<LspPopup, { kind: "list" }> }) {
const width = useMemo(() => {
const chars = Math.max(
popup.title.length,
- ...popup.items.map((i) => i.label.length + (i.preview?.length ?? 0) + (i.detail?.length ?? 0) + (i.shortcut?.length ?? 0)),
+ ...popup.items.map(
+ (i) => i.label.length + (i.preview?.length ?? 0) + (i.detail?.length ?? 0) + (i.shortcut?.length ?? 0),
+ ),
);
return Math.min(720, Math.max(320, chars * 7 + 90));
}, [popup]);
@@ -85,7 +97,11 @@ function ListPopup({ popup }: { popup: Extract<LspPopup, { kind: "list" }> }) {
hoverSelects
aria-label={popup.title}
onActivate={(r) => activate(r.item)}
- empty={<span className={styles.empty}>Nothing matches</span>}
+ empty={
+ <span className={styles.empty}>
+ <T>Nothing matches</T>
+ </span>
+ }
renderItem={({ item, match }) => (
<div
className={clsx(styles.item, item.disabled && styles.disabled, item.emphasis && styles.emphasis)}
@@ -125,7 +141,14 @@ function RenamePopup({ popup }: { popup: Extract<LspPopup, { kind: "rename" }> }
return true;
};
return (
- <Popup open anchor={popup.anchor} placement="bottom-start" onClose={closePopup} aria-label={popup.title} className={styles.renamePopup}>
+ <Popup
+ open
+ anchor={popup.anchor}
+ placement="bottom-start"
+ onClose={closePopup}
+ aria-label={popup.title}
+ className={styles.renamePopup}
+ >
<form
onSubmit={(e) => {
e.preventDefault();
@@ -143,7 +166,8 @@ function RenamePopup({ popup }: { popup: Extract<LspPopup, { kind: "rename" }> }
value={value}
onChange={(e) => setValue(e.target.value)}
onKeyDown={(e) => {
- if ((e.key === "ArrowDown" || e.key === "ArrowUp") && pick(e.key === "ArrowDown" ? 1 : -1)) e.preventDefault();
+ if ((e.key === "ArrowDown" || e.key === "ArrowUp") && pick(e.key === "ArrowDown" ? 1 : -1))
+ e.preventDefault();
}}
invalid={!value.trim()}
aria-label="New name"
@@ -214,14 +238,11 @@ function DefinitionPopup({ popup }: { popup: Extract<LspPopup, { kind: "definiti
</span>
<span className={styles.spacer} />
<Button size="small" variant="ghost" onClick={open}>
- Open
+ <T>Open</T>
</Button>
</div>
<div className={clsx(popup.themeClasses, styles.docScope)}>
- <DomContent
- className={styles.defBody}
- build={() => renderCode(popup.text, popup.language, "cm-lsp-code")}
- />
+ <DomContent className={styles.defBody} build={() => renderCode(popup.text, popup.language, "cm-lsp-code")} />
</div>
</Popup>
);
@@ -276,23 +297,23 @@ function PreviewDialog({ popup }: { popup: Extract<LspPopup, { kind: "preview" }
})}
</ul>
) : (
- <ul className={styles.previewList} aria-label="Changes">
- {summary.entries.map((e) => (
- <li key={e.path} className={styles.previewRow}>
- <Icon name={fileIconName(basename(e.path))} size={14} className={styles.itemIcon} />
- <span className={styles.previewName}>{basename(e.path)}</span>
- <span className={styles.previewPath}>{relativePath(root, e.path)}</span>
- <span className={styles.spacer} />
- {e.operation === "rename" && e.to && <span className={styles.previewOp}>→ {basename(e.to)}</span>}
- {e.operation && e.operation !== "rename" && <span className={styles.previewOp}>{e.operation}</span>}
- {e.edits > 0 && (
- <span className={styles.previewCount}>
- {e.edits} {e.edits === 1 ? "occurrence" : "occurrences"}
- </span>
- )}
- </li>
- ))}
- </ul>
+ <ul className={styles.previewList} aria-label="Changes">
+ {summary.entries.map((e) => (
+ <li key={e.path} className={styles.previewRow}>
+ <Icon name={fileIconName(basename(e.path))} size={14} className={styles.itemIcon} />
+ <span className={styles.previewName}>{basename(e.path)}</span>
+ <span className={styles.previewPath}>{relativePath(root, e.path)}</span>
+ <span className={styles.spacer} />
+ {e.operation === "rename" && e.to && <span className={styles.previewOp}>→ {basename(e.to)}</span>}
+ {e.operation && e.operation !== "rename" && <span className={styles.previewOp}>{e.operation}</span>}
+ {e.edits > 0 && (
+ <span className={styles.previewCount}>
+ {e.edits} {e.edits === 1 ? "occurrence" : "occurrences"}
+ </span>
+ )}
+ </li>
+ ))}
+ </ul>
)}
</Dialog>
);
@@ -309,6 +330,7 @@ function ChoiceDialog({ popup }: { popup: Extract<LspPopup, { kind: "choice" }>
open
onClose={() => answer(popup.onDismiss)}
title={popup.title}
+ icon={popup.icon ?? "question"}
width={460}
buttons={popup.choices.map((c) => ({
label: c.label,
@@ -317,7 +339,7 @@ function ChoiceDialog({ popup }: { popup: Extract<LspPopup, { kind: "choice" }>
onClick: () => answer(c.run),
}))}
>
- <div className={styles.choiceMessage}>{popup.message}</div>
+ {popup.message}
{popup.detail && <div className={styles.choiceDetail}>{popup.detail}</div>}
</Dialog>
);
diff --git a/src/editor/lsp/popupStore.ts b/src/editor/lsp/popupStore.ts
index ba582d328..f402c6967 100644
--- a/src/editor/lsp/popupStore.ts
+++ b/src/editor/lsp/popupStore.ts
@@ -68,6 +68,8 @@ export type LspPopup =
title: string;
message: string;
detail?: string;
+ /** Defaults to `question`. */
+ icon?: "question" | "warning" | "error" | "info";
choices: PopupChoice[];
/** Escape / close button / replaced by another popup. */
onDismiss?: () => void;
diff --git a/src/editor/refactor/safeDelete.ts b/src/editor/refactor/safeDelete.ts
index cdc955abf..e55af3e57 100644
--- a/src/editor/refactor/safeDelete.ts
+++ b/src/editor/refactor/safeDelete.ts
@@ -56,7 +56,9 @@ export function deletionRange(
const restOk =
!rest ||
/^[;,]$/.test(rest) ||
- (!!comments.line && (rest.startsWith(comments.line) || /^[;,]\s*/.test(rest) && rest.replace(/^[;,]\s*/, "").startsWith(comments.line)));
+ (!!comments.line &&
+ (rest.startsWith(comments.line) ||
+ (/^[;,]\s*/.test(rest) && rest.replace(/^[;,]\s*/, "").startsWith(comments.line))));
if (!restOk) return null;
// Attached comments and annotations above (no blank line in between).
@@ -88,7 +90,8 @@ export function deletionRange(
const next = last.number + 1;
if (blank(next) && next < doc.lines) end = doc.line(next).to + 1;
else if (blank(next)) end = doc.line(next).to;
- else if (blank(startLine - 1) && /^[}\])]|^end\b/.test(doc.line(next).text.trim())) start = doc.line(startLine - 1).from;
+ else if (blank(startLine - 1) && /^[}\])]|^end\b/.test(doc.line(next).text.trim()))
+ start = doc.line(startLine - 1).from;
} else if (startLine > 1) {
// Last line: take the line break before it (and a blank line above).
start = doc.line(blank(startLine - 1) && startLine > 2 ? startLine - 2 : startLine - 1).to;
@@ -147,14 +150,17 @@ const FUNCTION_STATEMENT = /function|method|^def|^fn|func|procedure/;
/** Declaration statement of a syntax-resolved local, or why it can't be deleted on its own. */
export function localDeclaration(doc: Text, symbol: LocalSymbol, statement: SyntaxNode | null): Range | string {
if (symbol.kind === "parameter") return "Deleting a parameter changes its call sites; use Change Signature";
- if (symbol.kind === "label" || symbol.kind === "type" || symbol.kind === "macro") return "Caret should be on a variable or function declaration";
+ if (symbol.kind === "label" || symbol.kind === "type" || symbol.kind === "macro")
+ return "Caret should be on a variable or function declaration";
if (!symbol.certain) return `'${symbol.name}' is declared more than once in this scope`;
- if (!statement || !rangeContains(statement.range, symbol.definition.start)) return "The declaration could not be determined";
+ if (!statement || !rangeContains(statement.range, symbol.definition.start))
+ return "The declaration could not be determined";
const kind = statement.kind;
if (symbol.kind === "function") {
return FUNCTION_STATEMENT.test(kind) ? statement.range : "The declaration could not be determined";
}
- if (COMPOUND_STATEMENT.test(kind) || !DECLARATION_STATEMENT.test(kind)) return `'${symbol.name}' is not declared by a separate statement`;
+ if (COMPOUND_STATEMENT.test(kind) || !DECLARATION_STATEMENT.test(kind))
+ return `'${symbol.name}' is not declared by a separate statement`;
const { from, to } = rangeToOffsets(doc, statement.range);
const defEnd = rangeToOffsets(doc, symbol.definition).to;
// Up to the initializer, the statement must declare only this name (no `a, b` / destructuring).
@@ -193,7 +199,13 @@ async function resolveTarget(view: EditorView, ctx: EditorDocContext): Promise<R
if (lsp)
return {
status: "ok",
- target: { name: item.name, kind: kindLabel(item.kind), at: item.selection_range.start, range: item.range, local: null },
+ target: {
+ name: item.name,
+ kind: kindLabel(item.kind),
+ at: item.selection_range.start,
+ range: item.range,
+ local: null,
+ },
};
}
@@ -224,14 +236,20 @@ async function resolveTarget(view: EditorView, ctx: EditorDocContext): Promise<R
reason: `The language server for ${lang} is not available; only local declarations can be deleted safely without it`,
};
}
- return { status: "refused", reason: item ? `'${name}' can't be deleted` : "Caret should be on the name of a declaration" };
+ return {
+ status: "refused",
+ reason: item ? `'${name}' can't be deleted` : "Caret should be on the name of a declaration",
+ };
}
/** LSP references to the target, its own declaration excluded. */
async function findUsages(ctx: EditorDocContext, target: SafeDeleteTarget): Promise<Location[]> {
const outside = (path: string, range: Range) =>
- path !== ctx.path || comparePos(range.start, target.range.start) < 0 || comparePos(range.start, target.range.end) > 0;
- if (target.local) return target.local.references.filter((r) => outside(ctx.path, r)).map((range) => ({ path: ctx.path, range }));
+ path !== ctx.path ||
+ comparePos(range.start, target.range.start) < 0 ||
+ comparePos(range.start, target.range.end) > 0;
+ if (target.local)
+ return target.local.references.filter((r) => outside(ctx.path, r)).map((range) => ({ path: ctx.path, range }));
const refs = await lspRequest(() => commands.lspReferences(ctx.doc, target.at, false));
return refs.filter((l) => outside(l.path, l.range));
}
@@ -242,7 +260,11 @@ async function findUsages(ctx: EditorDocContext, target: SafeDeleteTarget): Prom
export type UsagesAnswer = "view" | "delete" | "cancel";
/** `subject`: "Function 'foo'", "File 'a.ts'", "3 files" (`plural`). */
-export function usagesMessage(subject: string, usages: readonly Location[], plural = false): { message: string; detail: string } {
+export function usagesMessage(
+ subject: string,
+ usages: readonly Location[],
+ plural = false,
+): { 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";
@@ -266,6 +288,7 @@ export function askUsagesDetected(subject: string, usages: readonly Location[],
openPopup({
kind: "choice",
title: "Usages Detected",
+ icon: "warning",
message,
detail,
choices: [
diff --git a/src/features/analysis/AnalysisDialogs.tsx b/src/features/analysis/AnalysisDialogs.tsx
index d6eaa486b..0f4fcd13d 100644
--- a/src/features/analysis/AnalysisDialogs.tsx
+++ b/src/features/analysis/AnalysisDialogs.tsx
@@ -9,7 +9,7 @@ import {
type StructuralLanguage,
} from "@/platform/ipc";
import { basename } from "@/platform/project";
-import { Checkbox, Dialog, Input, Select, Spinner } from "@/ui";
+import { Checkbox, Dialog, Input, Select, Spinner, T } from "@/ui";
import { ScopeFields, openDialog } from "./dialogs";
import { locateDuplicates, loadDuplicateOptions } from "./duplicates";
import { runInspection } from "./inspect";
@@ -45,7 +45,9 @@ function InspectCodeDialog({ onClose }: { onClose: () => void }) {
>
<div className={styles.form}>
<ScopeFields name="inspect-scope" value={scope} onChange={setScope} />
- <div className={styles.hint}>Files are checked by their language servers; files without one are skipped.</div>
+ <div className={styles.hint}>
+ <T>Files are checked by their language servers; files without one are skipped.</T>
+ </div>
</div>
</Dialog>
);
@@ -76,7 +78,9 @@ function DuplicatesDialog({ onClose }: { onClose: () => void }) {
<div className={styles.form}>
<ScopeFields name="duplicates-scope" value={scope} onChange={setScope} />
<label className={styles.fieldRow}>
- <span>Minimum size</span>
+ <span>
+ <T>Minimum size</T>
+ </span>
<Input
className={styles.number}
type="number"
@@ -185,7 +189,9 @@ function StructuralDialog({ replace, onClose }: { replace: boolean; onClose: ()
>
<div className={styles.form}>
<div className={styles.fieldRow}>
- <span>Language</span>
+ <span>
+ <T>Language</T>
+ </span>
<Select
value={language || null}
options={options}
@@ -196,7 +202,7 @@ function StructuralDialog({ replace, onClose }: { replace: boolean; onClose: ()
/>
</div>
<label className={styles.fieldLabel} htmlFor="ssr-template">
- Search template
+ <T>Search template</T>
</label>
<textarea
id="ssr-template"
@@ -211,7 +217,7 @@ function StructuralDialog({ replace, onClose }: { replace: boolean; onClose: ()
{replace && (
<>
<label className={styles.fieldLabel} htmlFor="ssr-replacement">
- Replace template
+ <T>Replace template</T>
</label>
<textarea
id="ssr-replacement"
@@ -224,8 +230,8 @@ function StructuralDialog({ replace, onClose }: { replace: boolean; onClose: ()
</>
)}
<div className={styles.hint}>
- Placeholders: <code>$name$</code> or <code>$NAME</code> match one node, <code>$$$NAME</code> any number of
- nodes (arguments, statements). A placeholder used twice must match equal code.
+ <T>Placeholders:</T> <code>$name$</code> or <code>$NAME</code> <T>match one node,</T> <code>$$$NAME</code>{" "}
+ <T>any number of nodes (arguments, statements). A placeholder used twice must match equal code.</T>
</div>
<ScopeFields name="ssr-scope" value={scope} onChange={setScope} />
</div>
diff --git a/src/features/analysis/dialogs.tsx b/src/features/analysis/dialogs.tsx
index 4f22931a7..b56039143 100644
--- a/src/features/analysis/dialogs.tsx
+++ b/src/features/analysis/dialogs.tsx
@@ -2,7 +2,7 @@
import { Fragment, type ReactNode } from "react";
import { create } from "zustand";
import { isTauri } from "@/platform/ipc";
-import { Button, Input } from "@/ui";
+import { Button, Input, T } from "@/ui";
import { SCOPE_LABELS, currentFile, type ScopeChoice, type ScopeKind } from "./scope";
import styles from "./Analysis.module.css";
@@ -57,7 +57,9 @@ export function ScopeFields({
const file = currentFile();
return (
<fieldset className={styles.scope}>
- <legend className={styles.fieldLabel}>Scope</legend>
+ <legend className={styles.fieldLabel}>
+ <T>Scope</T>
+ </legend>
{KINDS.map((kind) => (
<label key={kind} className={styles.radioRow}>
<input
@@ -81,7 +83,7 @@ export function ScopeFields({
<Button
onClick={() => void browseDirectory(value.directory).then((d) => d && onChange({ ...value, directory: d }))}
>
- Browse…
+ <T>Browse…</T>
</Button>
</div>
)}
diff --git a/src/features/app/InvalidateCaches.tsx b/src/features/app/InvalidateCaches.tsx
index 6047108af..79b1967d5 100644
--- a/src/features/app/InvalidateCaches.tsx
+++ b/src/features/app/InvalidateCaches.tsx
@@ -9,7 +9,7 @@ import { create } from "zustand";
import type { InvalidateCachesOptions } from "@/bindings";
import { registerActions } from "@/platform/actions";
import { call, commands, isTauri } from "@/platform/ipc";
-import { Checkbox, Dialog } from "@/ui";
+import { Checkbox, Dialog, T } from "@/ui";
import { notifications } from "@/workbench/contributions";
import styles from "./app.module.css";
@@ -30,7 +30,11 @@ export const DEFAULT_INVALIDATE_OPTIONS: Required<InvalidateCachesOptions> = {
/** Schedules the invalidation (or none, for Just Restart) and restarts. */
export async function invalidateAndRestart(options: InvalidateCachesOptions | null): Promise<void> {
if (!isTauri()) {
- notifications().notify({ level: "info", title: "Restart is only available in the desktop app", key: "app.invalidateCaches" });
+ notifications().notify({
+ level: "info",
+ title: "Restart is only available in the desktop app",
+ key: "app.invalidateCaches",
+ });
return;
}
try {
@@ -78,10 +82,15 @@ export function InvalidateCachesDialog({ onClose = close }: { onClose?: () => vo
>
<div className={styles.invalidateBody}>
<p className={styles.invalidateText}>
- The caches will be invalidated and rebuilt on the next startup: the symbol index of every project and the
- syntax caches.
+ <T>
+ {
+ "The caches will be invalidated and rebuilt on the next startup: the symbol index of every project and the syntax caches."
+ }
+ </T>
</p>
- <div className={styles.invalidateHeading}>Optional:</div>
+ <div className={styles.invalidateHeading}>
+ <T>Optional:</T>
+ </div>
<Checkbox
label="Clear file system cache and Local History"
checked={options.localHistory}
@@ -99,7 +108,7 @@ export function InvalidateCachesDialog({ onClose = close }: { onClose?: () => vo
/>
{options.localHistory && (
<p className={styles.invalidateWarning} role="note">
- Local History of all projects will be deleted.
+ <T>Local History of all projects will be deleted.</T>
</p>
)}
</div>
diff --git a/src/features/app/__tests__/closeGuard.test.ts b/src/features/app/__tests__/closeGuard.test.ts
index 5a710d67c..efa6a68f5 100644
--- a/src/features/app/__tests__/closeGuard.test.ts
+++ b/src/features/app/__tests__/closeGuard.test.ts
@@ -28,7 +28,7 @@ describe("decideClose", () => {
it("confirms exit for the last window when enabled", async () => {
const { d, asked } = deps([{ button: "exit", checked: false }]);
await expect(decideClose({ ...base, confirmExit: true }, d)).resolves.toBe(true);
- expect(asked[0]?.title).toBe("Exit OpenIDEA?");
+ expect(asked[0]?.title).toBe("Confirm Exit");
expect(d.disableConfirmExit).not.toHaveBeenCalled();
});
diff --git a/src/features/app/app.module.css b/src/features/app/app.module.css
index 243794e6d..30c501584 100644
--- a/src/features/app/app.module.css
+++ b/src/features/app/app.module.css
@@ -1,10 +1,3 @@
-.promptBody {
- margin: 0;
- padding: 14px 16px;
- color: var(--fg);
- line-height: 1.5;
-}
-
/* About (JetBrains-style: logo left, product facts as plain lines) */
.about {
display: flex;
diff --git a/src/features/app/closeGuard.ts b/src/features/app/closeGuard.ts
index 2f76a82f3..8ca3b59e3 100644
--- a/src/features/app/closeGuard.ts
+++ b/src/features/app/closeGuard.ts
@@ -59,6 +59,7 @@ export async function decideClose(input: CloseInput, deps: CloseDeps): Promise<b
{ id: "discard", label: t("app.unsaved.discard") },
{ id: "save", label: t("app.unsaved.save"), primary: true },
],
+ icon: "warning",
});
if (r.button === "cancel") return false;
if (r.button === "save") {
diff --git a/src/features/app/index.ts b/src/features/app/index.ts
index 45b5a87aa..7706038f1 100644
--- a/src/features/app/index.ts
+++ b/src/features/app/index.ts
@@ -15,6 +15,9 @@ import { PromptOverlay } from "./prompt";
import { installWindowTitle } from "./title";
import { installLaunchHandling, windowActions } from "./windows";
+/** The UI locale of a secondary (Settings) window. */
+export const activateLocale = installLocaleSync;
+
export function activate(): () => void {
const disposers = [
installLocaleSync(),
diff --git a/src/features/app/prompt.tsx b/src/features/app/prompt.tsx
index 5e434095d..b57fc421f 100644
--- a/src/features/app/prompt.tsx
+++ b/src/features/app/prompt.tsx
@@ -2,8 +2,7 @@
import { useState } from "react";
import { create } from "zustand";
import { useT } from "@/platform/i18n";
-import { Checkbox, Dialog } from "@/ui";
-import styles from "./app.module.css";
+import { Checkbox, Dialog, type MessageIconKind } from "@/ui";
export interface PromptButton {
id: string;
@@ -17,6 +16,8 @@ export interface PromptRequest {
/** Declaration order (IDEA `createActions`); the dialog orders them per platform. A Cancel button (id `cancel`) is added unless present. */
buttons: PromptButton[];
checkbox?: string;
+ /** Defaults to `question`. */
+ icon?: MessageIconKind;
}
export interface PromptResult {
@@ -64,20 +65,21 @@ function PromptDialog({ request }: { request: NonNullable<PromptState["current"]
open
onClose={() => done("cancel")}
title={request.title}
- width={420}
- footerStart={
- request.checkbox && <Checkbox checked={checked} onChange={setChecked} label={request.checkbox} />
- }
+ icon={request.icon ?? "question"}
+ width={520}
+ footerStart={request.checkbox && <Checkbox checked={checked} onChange={setChecked} label={request.checkbox} />}
buttons={[
...request.buttons.map((b) => ({
label: b.label,
role: b.primary ? ("default" as const) : b.id === "cancel" ? ("cancel" as const) : ("extra" as const),
onClick: () => done(b.id),
})),
- ...(request.buttons.some((b) => b.id === "cancel") ? [] : [{ label: t("common.cancel"), role: "cancel" as const }]),
+ ...(request.buttons.some((b) => b.id === "cancel")
+ ? []
+ : [{ label: t("common.cancel"), role: "cancel" as const }]),
]}
>
- <p className={styles.promptBody}>{request.body}</p>
+ {request.body}
</Dialog>
);
}
diff --git a/src/features/app/windows.ts b/src/features/app/windows.ts
index 7557653d0..50940fb97 100644
--- a/src/features/app/windows.ts
+++ b/src/features/app/windows.ts
@@ -76,8 +76,8 @@ export async function openProjectWithPolicy(path: string): Promise<void> {
title: t("app.window.askTitle"),
body: t("app.window.askBody", { name: basename(path) }),
buttons: [
- { id: "same", label: t("app.window.askThis") },
- { id: "new", label: t("app.window.askNew"), primary: true },
+ { id: "new", label: t("app.window.askNew") },
+ { id: "same", label: t("app.window.askThis"), primary: true },
{ id: "cancel", label: t("common.cancel") },
],
checkbox: t("app.window.askRemember"),
@@ -86,7 +86,9 @@ export async function openProjectWithPolicy(path: string): Promise<void> {
mode = r.button;
if (r.checked) {
try {
- useProject.setState({ settings: await call(commands.settingsSet("global", "general.openProjectIn", JSON.stringify(mode))) });
+ useProject.setState({
+ settings: await call(commands.settingsSet("global", "general.openProjectIn", JSON.stringify(mode))),
+ });
} catch {
/* the choice still applies to this open */
}
diff --git a/src/features/build-tools/BuildToolView.tsx b/src/features/build-tools/BuildToolView.tsx
index 41d63dee4..7026d69f8 100644
--- a/src/features/build-tools/BuildToolView.tsx
+++ b/src/features/build-tools/BuildToolView.tsx
@@ -4,7 +4,19 @@ import clsx from "clsx";
import type { BuildTool, GradleModel, MavenModel, RunConfig } from "@/platform/ipc";
import { useProject } from "@/platform/project";
import { editorService } from "@/workbench/contributions";
-import { Button, Checkbox, EmptyState, Icon, IconButton, Spinner, Tree, showContextMenu, type MenuItem, type TreeRowState } from "@/ui";
+import {
+ Button,
+ Checkbox,
+ EmptyState,
+ Icon,
+ IconButton,
+ Spinner,
+ Tree,
+ showContextMenu,
+ type MenuItem,
+ type TreeRowState,
+ T,
+} from "@/ui";
import {
gradleChildren,
gradleRoots,
@@ -19,7 +31,16 @@ import {
withGradleOptions,
type BuildNode,
} from "./model";
-import { createRunConfig, initialExpanded, runConfig, setCurrentProject, setExpanded, setProfile, syncTool, useBuild } from "./store";
+import {
+ createRunConfig,
+ initialExpanded,
+ runConfig,
+ setCurrentProject,
+ setExpanded,
+ setProfile,
+ syncTool,
+ useBuild,
+} from "./store";
import styles from "./BuildTools.module.css";
export function MavenView() {
@@ -31,11 +52,15 @@ export function GradleView() {
}
/** The run configuration a runnable node (or several of one project) starts. */
-export function nodeConfig(nodes: readonly BuildNode[], model: { maven?: MavenModel | null; gradle?: GradleModel | null }) {
+export function nodeConfig(
+ nodes: readonly BuildNode[],
+ model: { maven?: MavenModel | null; gradle?: GradleModel | null },
+) {
const settings = useBuild.getState().settings;
const first = nodes[0];
if (!first) return null;
- if (first.kind === "runConfig") return first.config.kind === "gradle" ? withGradleOptions(first.config, settings.gradle) : first.config;
+ if (first.kind === "runConfig")
+ return first.config.kind === "gradle" ? withGradleOptions(first.config, settings.gradle) : first.config;
if ((first.kind === "phase" || first.kind === "goal") && model.maven) {
const same = nodes.filter(
(n): n is Extract<BuildNode, { kind: "phase" | "goal" }> =>
@@ -45,19 +70,37 @@ export function nodeConfig(nodes: readonly BuildNode[], model: { maven?: MavenMo
return mavenGoalConfig(first.project, goals, model.maven, settings.maven);
}
if (first.kind === "task" && model.gradle) {
- const same = nodes.filter((n): n is Extract<BuildNode, { kind: "task" }> => n.kind === "task" && n.project.path === first.project.path);
- return gradleTaskConfig(model.gradle, first.project, same.map((n) => n.task.name), settings.gradle);
+ const same = nodes.filter(
+ (n): n is Extract<BuildNode, { kind: "task" }> => n.kind === "task" && n.project.path === first.project.path,
+ );
+ return gradleTaskConfig(
+ model.gradle,
+ first.project,
+ same.map((n) => n.task.name),
+ settings.gradle,
+ );
}
return null;
}
/** Memoised children lookup (node objects stay stable while the model is unchanged). */
-function childrenOf(tool: BuildTool, maven: MavenModel | null, gradle: GradleModel | null, configs: readonly RunConfig[]) {
+function childrenOf(
+ tool: BuildTool,
+ maven: MavenModel | null,
+ gradle: GradleModel | null,
+ configs: readonly RunConfig[],
+) {
const cache = new Map<string, BuildNode[] | undefined>();
return (n: BuildNode) => {
if (cache.has(n.key)) return cache.get(n.key);
const kids =
- tool === "maven" ? (maven ? mavenChildren(n, maven, configs) : undefined) : gradle ? gradleChildren(n, gradle, configs) : undefined;
+ tool === "maven"
+ ? maven
+ ? mavenChildren(n, maven, configs)
+ : undefined
+ : gradle
+ ? gradleChildren(n, gradle, configs)
+ : undefined;
cache.set(n.key, kids);
return kids;
};
@@ -95,7 +138,12 @@ function Toolbar({ tool, selection }: { tool: BuildTool; selection: BuildNode[]
disabled={!runnable.length}
onClick={runSelected}
/>
- <IconButton icon="run-anything" size="small" iconSize={16} action={maven ? "maven.executeGoal" : "gradle.executeTask"} />
+ <IconButton
+ icon="run-anything"
+ size="small"
+ iconSize={16}
+ action={maven ? "maven.executeGoal" : "gradle.executeTask"}
+ />
<IconButton
icon="build-offline"
size="small"
@@ -104,7 +152,13 @@ function Toolbar({ tool, selection }: { tool: BuildTool; selection: BuildNode[]
pressed={maven ? settings.maven.offline : settings.gradle.offline}
/>
{maven && (
- <IconButton icon="skip-tests" size="small" iconSize={16} action="maven.toggleSkipTests" pressed={settings.maven.skipTests} />
+ <IconButton
+ icon="skip-tests"
+ size="small"
+ iconSize={16}
+ action="maven.toggleSkipTests"
+ pressed={settings.maven.skipTests}
+ />
)}
<span className={styles.sep} />
<IconButton icon="expand-all" size="small" iconSize={16} action={`${tool}.expandAll`} />
@@ -129,7 +183,9 @@ function Banner({ tool }: { tool: BuildTool }) {
return (
<div className={styles.banner}>
<Icon name={tool === "maven" ? "maven-load-changes" : "gradle-load-changes"} size={16} />
- <span className={styles.bannerText}>Build files changed since the last reload</span>
+ <span className={styles.bannerText}>
+ <T>Build files changed since the last reload</T>
+ </span>
<Button size="small" variant="ghost" onClick={() => void syncTool(tool)}>
{tool === "maven" ? "Load Maven Changes" : "Load Gradle Changes"}
</Button>
@@ -195,7 +251,8 @@ function BuildToolView({ tool }: { tool: BuildTool }) {
const hasModel = tool === "maven" ? !!maven : !!gradle;
useEffect(() => {
- if (model && hasModel && useBuild.getState().expanded[tool].size === 0) setExpanded(tool, initialExpanded(tool, model));
+ if (model && hasModel && useBuild.getState().expanded[tool].size === 0)
+ setExpanded(tool, initialExpanded(tool, model));
}, [model, hasModel, tool]);
const nodesByKey = useCallback(
@@ -230,20 +287,33 @@ function BuildToolView({ tool }: { tool: BuildTool }) {
{ label: `Debug '${config.name}'`, icon: "debug", run: () => runConfig(config, "debug") },
{ kind: "separator" },
);
- if (node.kind === "runConfig") items.push({ kind: "action", action: "run.editConfigs", arg: node.config.id, label: "Edit Configuration…" });
+ if (node.kind === "runConfig")
+ items.push({ kind: "action", action: "run.editConfigs", arg: node.config.id, label: "Edit Configuration…" });
else items.push({ label: "Create Run Configuration…", icon: "edit", run: () => void createRunConfig(config) });
}
if (node.kind === "mavenProject") {
items.push(
- { label: "Open pom.xml", icon: "file-maven", run: () => void editorService().openFile(`${root}/${node.project.pom}`) },
+ {
+ label: "Open pom.xml",
+ icon: "file-maven",
+ run: () => void editorService().openFile(`${root}/${node.project.pom}`),
+ },
{ kind: "action", action: "maven.reload", label: "Reload All Maven Projects" },
{ kind: "action", action: "maven.executeGoal" },
);
}
if (node.kind === "gradleProject") {
const file = node.project.buildFile;
- if (file) items.push({ label: `Open ${file.split("/").pop()}`, icon: "file-gradle", run: () => void editorService().openFile(`${root}/${file}`) });
- items.push({ kind: "action", action: "gradle.reload", label: "Reload All Gradle Projects" }, { kind: "action", action: "gradle.executeTask" });
+ if (file)
+ items.push({
+ label: `Open ${file.split("/").pop()}`,
+ icon: "file-gradle",
+ run: () => void editorService().openFile(`${root}/${file}`),
+ });
+ items.push(
+ { kind: "action", action: "gradle.reload", label: "Reload All Gradle Projects" },
+ { kind: "action", action: "gradle.executeTask" },
+ );
}
if (node.kind === "dependency") {
const d = node.dependency;
@@ -257,7 +327,13 @@ function BuildToolView({ tool }: { tool: BuildTool }) {
return (
<div className={styles.view}>
<div className={styles.loading}>
- {error ? error : loading ? <><Spinner size={14} /> Loading…</> : null}
+ {error ? (
+ error
+ ) : loading ? (
+ <>
+ <Spinner size={14} /> <T>Loading…</T>
+ </>
+ ) : null}
</div>
</div>
);
diff --git a/src/features/build-tools/ExecutePopup.tsx b/src/features/build-tools/ExecutePopup.tsx
index 66a06da9b..5066ca40a 100644
--- a/src/features/build-tools/ExecutePopup.tsx
+++ b/src/features/build-tools/ExecutePopup.tsx
@@ -7,7 +7,7 @@
import { useMemo, useState, type KeyboardEvent } from "react";
import clsx from "clsx";
import type { BuildTool } from "@/platform/ipc";
-import { HighlightedText, Input, List, Popup, Select, listNavigate } from "@/ui";
+import { HighlightedText, Input, List, Popup, Select, listNavigate, T } from "@/ui";
import {
goalCompletions,
gradleTaskConfig,
@@ -115,7 +115,9 @@ function ExecutePopup({ tool }: { tool: BuildTool }) {
<div className={styles.popupBody}>
<div className={styles.popupHeader}>
<span className={styles.popupTitle}>{title}</span>
- <span>Tab to complete, Enter to run</span>
+ <span>
+ <T>Tab to complete, Enter to run</T>
+ </span>
</div>
<div className={styles.inputRow}>
<span className={styles.inputPrefix}>{tool === "maven" ? "mvn" : "gradle"}</span>
@@ -148,14 +150,19 @@ function ExecutePopup({ tool }: { tool: BuildTool }) {
renderItem={(c, state) => (
<div className={clsx(styles.completion, state.active && styles.activeRow)}>
<span className={styles.completionLabel}>
- <HighlightedText text={c.label} indices={c.detail === "recent" ? undefined : [...Array(Math.min(word.length, c.label.length)).keys()]} />
+ <HighlightedText
+ text={c.label}
+ indices={c.detail === "recent" ? undefined : [...Array(Math.min(word.length, c.label.length)).keys()]}
+ />
</span>
{c.detail && <span className={styles.completionDetail}>{c.detail}</span>}
</div>
)}
/>
<div className={styles.popupFooter}>
- <span>Project:</span>
+ <span>
+ <T>Project:</T>
+ </span>
<Select
className={styles.footerSelect}
value={project}
diff --git a/src/features/build/BuildView.tsx b/src/features/build/BuildView.tsx
index 82f81d4bf..35b82e1bf 100644
--- a/src/features/build/BuildView.tsx
+++ b/src/features/build/BuildView.tsx
@@ -19,6 +19,7 @@ import {
Tree,
fileIconName,
type TreeRowState,
+ T,
} from "@/ui";
import type { BuildMessage, Severity } from "@/platform/ipc";
import {
@@ -62,7 +63,9 @@ function rootDetail(status: BuildStatus, durationMs: number | null, errors: numb
if (status === "running") return "running…";
if (status === "cancelled") return "cancelled";
const summary = finishSummary({ success: status === "success", errors, warnings, durationMs });
- return status === "success" ? `finished ${formatDuration(durationMs ?? 0)}` : summary.replace(/^Build failed:?\s*/, "") || "failed";
+ return status === "success"
+ ? `finished ${formatDuration(durationMs ?? 0)}`
+ : summary.replace(/^Build failed:?\s*/, "") || "failed";
}
export function BuildHeaderActions() {
@@ -107,13 +110,18 @@ function BuildTree() {
if (n.kind === "file") {
const errors = n.messages.filter((m) => m.severity === "error").length;
const warnings = n.messages.filter((m) => m.severity === "warning").length;
- const counts = [errors && `${errors} error${errors === 1 ? "" : "s"}`, warnings && `${warnings} warning${warnings === 1 ? "" : "s"}`]
+ const counts = [
+ errors && `${errors} error${errors === 1 ? "" : "s"}`,
+ warnings && `${warnings} warning${warnings === 1 ? "" : "s"}`,
+ ]
.filter(Boolean)
.join(", ");
return (
<span className={styles.row}>
<Icon name={fileIconName(basename(n.path))} size={16} className={styles.fileIcon} />
- <span className={clsx(styles.strong, errors > 0 && styles.fileError, state.selected && styles.selected)}>{basename(n.path)}</span>
+ <span className={clsx(styles.strong, errors > 0 && styles.fileError, state.selected && styles.selected)}>
+ {basename(n.path)}
+ </span>
<span className={styles.muted}>{relativeDir(root, n.path)}</span>
<span className={styles.muted}>{counts}</span>
</span>
@@ -125,7 +133,11 @@ function BuildTree() {
<span className={styles.row} title={m.text}>
<Icon name={SEVERITY_ICON[m.severity]} size={14} className={styles[`sev-${m.severity}`]} />
<span className={styles.message}>{m.text.split("\n")[0]}</span>
- {start && <span className={styles.position}>:{start.line + 1}:{start.col + 1}</span>}
+ {start && (
+ <span className={styles.position}>
+ :{start.line + 1}:{start.col + 1}
+ </span>
+ )}
</span>
);
};
@@ -192,7 +204,11 @@ function BuildConsole() {
{virtualizer.getVirtualItems().map((v) => {
const line = lines[v.index]!;
return (
- <div key={v.key} className={clsx(styles.line, styles[line.kind])} style={{ transform: `translateY(${v.start}px)` }}>
+ <div
+ key={v.key}
+ className={clsx(styles.line, styles[line.kind])}
+ style={{ transform: `translateY(${v.start}px)` }}
+ >
{line.text || " "}
</div>
);
@@ -207,7 +223,9 @@ export function BuildView() {
if (!hasBuild) {
return (
<div className={styles.view}>
- <EmptyState title="No build output">Build the project to see compiler messages here</EmptyState>
+ <EmptyState title="No build output">
+ <T>Build the project to see compiler messages here</T>
+ </EmptyState>
</div>
);
}
diff --git a/src/features/code-insight/HierarchyView.tsx b/src/features/code-insight/HierarchyView.tsx
index d86574247..55f6b90b1 100644
--- a/src/features/code-insight/HierarchyView.tsx
+++ b/src/features/code-insight/HierarchyView.tsx
@@ -1,7 +1,7 @@
/** "hierarchy" tool window: call hierarchy (⌃⌥H) and type hierarchy (⌃H). */
import { useCallback, useMemo } from "react";
import { basename, relativePath, useProject } from "@/platform/project";
-import { EmptyState, IconButton, Spinner, SymbolBadge, Tabs, Tree, badgeKind, type TreeRowState } from "@/ui";
+import { EmptyState, IconButton, Spinner, SymbolBadge, Tabs, Tree, badgeKind, type TreeRowState, T } from "@/ui";
import { openLocation } from "./ipc";
import {
ROOT_ID,
@@ -68,8 +68,7 @@ export function HierarchyView() {
const roots = useMemo<Node[]>(() => (root ? [{ kind: "root", id: ROOT_ID }] : []), [root]);
const getChildren = useCallback(
- (n: Node): Node[] | undefined =>
- children.get(n.id)?.map((c) => ({ kind: "item", id: c.id, node: c }) as Node),
+ (n: Node): Node[] | undefined => children.get(n.id)?.map((c) => ({ kind: "item", id: c.id, node: c }) as Node),
[children],
);
const isExpandable = useCallback(
@@ -82,7 +81,9 @@ export function HierarchyView() {
if (!root)
return (
- <EmptyState>Use Call Hierarchy (⌃⌥H) or Type Hierarchy (⌃H) on a symbol to see its hierarchy here</EmptyState>
+ <EmptyState>
+ <T>Use Call Hierarchy (⌃⌥H) or Type Hierarchy (⌃H) on a symbol to see its hierarchy here</T>
+ </EmptyState>
);
const renderNode = (n: Node, _state: TreeRowState) => {
@@ -95,7 +96,11 @@ export function HierarchyView() {
{basename(root.path)}:{root.line + 1}
</span>
{loading && <Spinner size={12} />}
- {failed.has(ROOT_ID) && <span className={styles.error}>failed to load</span>}
+ {failed.has(ROOT_ID) && (
+ <span className={styles.error}>
+ <T>failed to load</T>
+ </span>
+ )}
{!loading && !failed.has(ROOT_ID) && children.get(ROOT_ID)?.length === 0 && (
<span className={styles.muted}>— no {directionLabel(mode, direction).toLowerCase()} found</span>
)}
@@ -113,7 +118,11 @@ export function HierarchyView() {
{basename(item.path)}:{item.selectionRange.start.line + 1}
</span>
{calls > 1 && <span className={styles.muted}>({calls} calls)</span>}
- {failed.has(n.id) && <span className={styles.error}>failed to load</span>}
+ {failed.has(n.id) && (
+ <span className={styles.error}>
+ <T>failed to load</T>
+ </span>
+ )}
</span>
);
};
diff --git a/src/features/code-insight/ProblemsView.tsx b/src/features/code-insight/ProblemsView.tsx
index c37623d2e..cfe9f1e20 100644
--- a/src/features/code-insight/ProblemsView.tsx
+++ b/src/features/code-insight/ProblemsView.tsx
@@ -6,7 +6,7 @@ import type { Diagnostic, Severity } from "@/bindings";
import { useEditorRegistry } from "@/editor/api";
import { basename, relativeDir, useProject } from "@/platform/project";
import { editorService } from "@/workbench/contributions";
-import { EmptyState, Icon, IconButton, Tabs, Tree, fileIconName, type TreeRowState } from "@/ui";
+import { EmptyState, Icon, IconButton, Tabs, Tree, fileIconName, type TreeRowState, T } from "@/ui";
import { countSeverities, fileDiagnostics, useProblems, type ProblemsMap } from "./problemsStore";
import styles from "./ProblemsView.module.css";
@@ -65,8 +65,20 @@ export function ProblemsHeaderActions() {
return (
<>
<IconButton icon="error" title="Show Errors" size="small" pressed={show.error} onClick={() => toggle("error")} />
- <IconButton icon="warning" title="Show Warnings" size="small" pressed={show.warning} onClick={() => toggle("warning")} />
- <IconButton icon="info" title="Show Infos and Hints" size="small" pressed={show.info} onClick={() => toggle("info")} />
+ <IconButton
+ icon="warning"
+ title="Show Warnings"
+ size="small"
+ pressed={show.warning}
+ onClick={() => toggle("warning")}
+ />
+ <IconButton
+ icon="info"
+ title="Show Infos and Hints"
+ size="small"
+ pressed={show.info}
+ onClick={() => toggle("info")}
+ />
</>
);
}
@@ -80,7 +92,8 @@ export function ProblemsTabs() {
const fileCount = current ? countSeverities(fileDiagnostics(map, current)) : null;
const projectErrors = useMemo(() => {
let n = 0;
- for (const sources of map.values()) for (const items of sources.values()) n += items.filter((d) => d.severity === "error").length;
+ for (const sources of map.values())
+ for (const items of sources.values()) n += items.filter((d) => d.severity === "error").length;
return n;
}, [map]);
return (
@@ -95,7 +108,7 @@ export function ProblemsTabs() {
id: "file",
label: current ? (
<>
- File <span className={styles.tabFile}>{basename(current)}</span>
+ <T>File</T> <span className={styles.tabFile}>{basename(current)}</span>
</>
) : (
"File"
@@ -128,7 +141,10 @@ export function ProblemsView() {
return buildProblemNodes(map, paths, show);
}, [map, tab, current, show]);
- const expanded = useMemo(() => new Set(roots.filter((r) => !collapsed.has(r.key)).map((r) => r.key)), [roots, collapsed]);
+ const expanded = useMemo(
+ () => new Set(roots.filter((r) => !collapsed.has(r.key)).map((r) => r.key)),
+ [roots, collapsed],
+ );
const getChildren = useCallback(
(n: Node): Node[] | undefined =>
@@ -141,15 +157,15 @@ export function ProblemsView() {
const renderNode = (n: Node, state: TreeRowState) => {
if (n.kind === "file") {
const c = countSeverities(n.items);
- const parts = [
- plural(c.error, "error"),
- plural(c.warning, "warning"),
- plural(c.info + c.hint, "info"),
- ].filter(Boolean);
+ const parts = [plural(c.error, "error"), plural(c.warning, "warning"), plural(c.info + c.hint, "info")].filter(
+ Boolean,
+ );
return (
<span className={styles.row}>
<Icon name={fileIconName(basename(n.path))} size={16} className={styles.fileIcon} />
- <span className={clsx(styles.fileName, c.error > 0 && styles.fileError, state.selected && styles.selectedText)}>
+ <span
+ className={clsx(styles.fileName, c.error > 0 && styles.fileError, state.selected && styles.selectedText)}
+ >
{basename(n.path)}
</span>
<span className={styles.muted}>{relativeDir(root, n.path)}</span>
diff --git a/src/features/code-insight/ServerStatus.tsx b/src/features/code-insight/ServerStatus.tsx
index 7233a1cb3..503578874 100644
--- a/src/features/code-insight/ServerStatus.tsx
+++ b/src/features/code-insight/ServerStatus.tsx
@@ -2,7 +2,7 @@
import { useMemo, useRef, useState } from "react";
import clsx from "clsx";
import { getAction, executeAction } from "@/platform/actions";
-import { BarButton, Button, IconButton, Popup } from "@/ui";
+import { BarButton, Button, IconButton, Popup, T } from "@/ui";
import { relativePath, useProject } from "@/platform/project";
import { STATUS_LABEL, restartServer, serversSummary, useServers } from "./servers";
import styles from "./ServerStatus.module.css";
@@ -38,7 +38,9 @@ export function ServerStatus() {
aria-label="Language servers"
>
<div className={styles.panel}>
- <div className={styles.header}>Language Servers</div>
+ <div className={styles.header}>
+ <T>Language Servers</T>
+ </div>
{servers.map((s) => (
<div key={s.id} className={styles.server}>
<div className={styles.line}>
@@ -55,7 +57,7 @@ export function ServerStatus() {
void executeAction("tools.install", s.name);
}}
>
- Install
+ <T>Install</T>
</Button>
) : (
<IconButton
diff --git a/src/features/code-insight/UsagesView.tsx b/src/features/code-insight/UsagesView.tsx
index 95592f415..000c4bad1 100644
--- a/src/features/code-insight/UsagesView.tsx
+++ b/src/features/code-insight/UsagesView.tsx
@@ -1,7 +1,7 @@
/** "usages" tool window: Find Usages results grouped by file with line previews. */
import { useCallback, useMemo, useState } from "react";
import { basename, relativeDir, useProject } from "@/platform/project";
-import { EmptyState, Icon, IconButton, Spinner, Tabs, Tree, fileIconName, type TreeRowState } from "@/ui";
+import { EmptyState, Icon, IconButton, Spinner, Tabs, Tree, fileIconName, type TreeRowState, T } from "@/ui";
import { openLocation } from "./ipc";
import { trimPreview, usageCount, useUsages, type Usage, type UsageGroup } from "./usages";
import styles from "./UsagesView.module.css";
@@ -68,7 +68,12 @@ export function UsagesView() {
[files],
);
- if (!search) return <EmptyState>Use Find Usages (⌥F7) on a symbol to see its usages here</EmptyState>;
+ if (!search)
+ return (
+ <EmptyState>
+ <T>Use Find Usages (⌥F7) on a symbol to see its usages here</T>
+ </EmptyState>
+ );
const total = usageCount(search.groups);
const setAll = (collapse: boolean) =>
setCollapsed({ id: search.id, keys: collapse ? new Set(files.map((f) => f.key)) : new Set() });
@@ -77,7 +82,9 @@ export function UsagesView() {
if (n.kind === "summary")
return (
<span className={styles.row}>
- <span className={styles.groupLabel}>Found usages</span>
+ <span className={styles.groupLabel}>
+ <T>Found usages</T>
+ </span>
<span className={styles.count}>
{total} {total === 1 ? "result" : "results"}
</span>
@@ -155,7 +162,13 @@ export function UsagesView() {
const u = n.kind === "usage" ? n.usage : n.kind === "file" ? n.group.usages[0] : undefined;
if (u) openLocation(u.path, u.line, u.col);
}}
- empty={!search.loading && !search.error ? <EmptyState>No usages found</EmptyState> : undefined}
+ empty={
+ !search.loading && !search.error ? (
+ <EmptyState>
+ <T>No usages found</T>
+ </EmptyState>
+ ) : undefined
+ }
/>
</div>
</div>
diff --git a/src/features/coverage/CoverageView.tsx b/src/features/coverage/CoverageView.tsx
index 0eeb5ce50..76837c530 100644
--- a/src/features/coverage/CoverageView.tsx
+++ b/src/features/coverage/CoverageView.tsx
@@ -3,7 +3,7 @@ import { useMemo, useState } from "react";
import clsx from "clsx";
import { executeAction } from "@/platform/actions";
import { useProject } from "@/platform/project";
-import { EmptyState, Icon, IconButton, Tabs, Tree, fileIconName } from "@/ui";
+import { EmptyState, Icon, IconButton, Tabs, Tree, fileIconName, T } from "@/ui";
import { editorService } from "@/workbench/contributions";
import { coverageTree, formatPercent, percent, sortTree, type CoverageNode, type SortKey } from "./model";
import { activeSuite, closeSuite, selectSuite, setCoverageVisible, useCoverage } from "./store";
@@ -72,15 +72,23 @@ export function CoverageView() {
const [sort, setSort] = useState<{ key: SortKey; ascending: boolean }>({ key: "name", ascending: true });
const [expanded, setExpanded] = useState<Set<string> | null>(null);
- const roots = useMemo(() => (suite ? sortTree(coverageTree(suite.data, root), sort.key, sort.ascending) : []), [suite, root, sort]);
- const effectiveExpanded = useMemo(() => expanded ?? new Set(roots.filter((n) => n.dir).map((n) => n.path)), [expanded, roots]);
+ const roots = useMemo(
+ () => (suite ? sortTree(coverageTree(suite.data, root), sort.key, sort.ascending) : []),
+ [suite, root, sort],
+ );
+ const effectiveExpanded = useMemo(
+ () => expanded ?? new Set(roots.filter((n) => n.dir).map((n) => n.path)),
+ [expanded, roots],
+ );
if (!suite) {
return (
<EmptyState title="No coverage data">
- <span>Run a configuration with coverage to see which lines its tests execute.</span>
+ <span>
+ <T>Run a configuration with coverage to see which lines its tests execute.</T>
+ </span>
<button type="button" className={styles.link} onClick={() => void executeAction("run.coverage")}>
- Run with Coverage
+ <T>Run with Coverage</T>
</button>
</EmptyState>
);
@@ -92,7 +100,11 @@ export function CoverageView() {
return (
<div className={styles.view}>
- {!visible && <div className={styles.banner}>Coverage is hidden in editors and the project view.</div>}
+ {!visible && (
+ <div className={styles.banner}>
+ <T>Coverage is hidden in editors and the project view.</T>
+ </div>
+ )}
<div className={clsx(styles.header, !branches && styles.noBranches)} role="row">
{columns.map((c) => (
<button
diff --git a/src/features/database/DatabaseView.tsx b/src/features/database/DatabaseView.tsx
index 0b519f841..2523a3ad8 100644
--- a/src/features/database/DatabaseView.tsx
+++ b/src/features/database/DatabaseView.tsx
@@ -9,7 +9,18 @@ import type { DbTableDetails } from "@/platform/ipc";
import { setContext } from "@/platform/context";
import { executeAction } from "@/platform/actions";
import { shortcutLabel } from "@/platform/keymap";
-import { Button, EmptyState, Icon, IconButton, Menu, Tree, showContextMenu, tooltipAttrs, type TreeHandle } from "@/ui";
+import {
+ Button,
+ EmptyState,
+ Icon,
+ IconButton,
+ Menu,
+ Tree,
+ showContextMenu,
+ tooltipAttrs,
+ type TreeHandle,
+ T,
+} from "@/ui";
import { databaseKey, driverIcon, splitTarget, targetOf } from "./model";
import { nodeTarget, type DbNode as Node, type Group } from "./nodes";
import {
@@ -30,7 +41,12 @@ import { DB_VIEW_FOCUS, openTableData } from "./treeActions";
import { newMenu, nodeMenu } from "./treeMenu";
import styles from "./Database.module.css";
-const GROUP_LABELS: Record<Group, string> = { columns: "columns", keys: "keys", foreignKeys: "foreign keys", indexes: "indexes" };
+const GROUP_LABELS: Record<Group, string> = {
+ columns: "columns",
+ keys: "keys",
+ foreignKeys: "foreign keys",
+ indexes: "indexes",
+};
function status<T>(key: string, l: Loaded<T> | undefined, map: (v: T) => Node[]): Node[] | undefined {
if (!l) return undefined;
@@ -90,7 +106,9 @@ export function DatabaseView() {
};
const schemasOf = (key: string, id: string) =>
- status(key, st.schemas[id], (v) => v.map((schema) => ({ kind: "schema", key: `${id}/${schema}`, id, schema }) as Node));
+ status(key, st.schemas[id], (v) =>
+ v.map((schema) => ({ kind: "schema", key: `${id}/${schema}`, id, schema }) as Node),
+ );
const children = (n: Node): readonly Node[] | undefined => {
switch (n.kind) {
@@ -124,7 +142,14 @@ export function DatabaseView() {
const d = st.details[detailsKey(n.id, n.schema, n.table.name)];
if (!d || d.status === "loading") return undefined;
if (d.status === "error") return [{ kind: "message", key: `${n.key}/err`, text: d.message, error: true }];
- return groupsOf(d.value).map((group) => ({ kind: "group", key: `${n.key}/${group}`, id: n.id, schema: n.schema, table: n.table.name, group }));
+ return groupsOf(d.value).map((group) => ({
+ kind: "group",
+ key: `${n.key}/${group}`,
+ id: n.id,
+ schema: n.schema,
+ table: n.table.name,
+ group,
+ }));
}
case "group": {
const d = detailsOf(n.id, n.schema, n.table);
@@ -133,7 +158,13 @@ export function DatabaseView() {
const at = { id: n.id, schema: n.schema, table: n.table };
switch (n.group) {
case "columns":
- return d.columns.map((column) => ({ kind: "column", key: `${n.key}/${column.name}`, column, foreignKey: fkCols.has(column.name), ...at }));
+ return d.columns.map((column) => ({
+ kind: "column",
+ key: `${n.key}/${column.name}`,
+ column,
+ foreignKey: fkCols.has(column.name),
+ ...at,
+ }));
case "keys":
return [{ kind: "key", key: `${n.key}/pk`, columns: primaryKey(d), ...at }];
case "foreignKeys":
@@ -205,7 +236,9 @@ export function DatabaseView() {
return s?.status === "ok" ? String(s.value.length) : undefined;
}
case "folder":
- return String((tablesOf(n.id, n.schema) ?? []).filter((t) => (t.kind === "view") === (n.folder === "views")).length);
+ return String(
+ (tablesOf(n.id, n.schema) ?? []).filter((t) => (t.kind === "view") === (n.folder === "views")).length,
+ );
case "group": {
const d = detailsOf(n.id, n.schema, n.table);
return d ? String(groupSize(d, n.group)) : undefined;
@@ -255,7 +288,7 @@ export function DatabaseView() {
<DatabaseToolbar />
<EmptyState title="No data sources">
<Button variant="ghost" onClick={() => void executeAction("db.newDataSource")}>
- New Data Source…
+ <T>New Data Source…</T>
</Button>
</EmptyState>
</div>
@@ -279,7 +312,13 @@ export function DatabaseView() {
getLabel={label}
getChildren={children}
isExpandable={(n) =>
- n.kind === "source" || n.kind === "database" || n.kind === "schema" || n.kind === "folder" || n.kind === "table" || n.kind === "group"}
+ n.kind === "source" ||
+ n.kind === "database" ||
+ n.kind === "schema" ||
+ n.kind === "folder" ||
+ n.kind === "table" ||
+ n.kind === "group"
+ }
loadChildren={load}
getIcon={(n) => icon(n)}
getDetail={detail}
@@ -289,7 +328,11 @@ export function DatabaseView() {
const d = detail(n);
const counted = n.kind === "source" || n.kind === "database" || n.kind === "folder" || n.kind === "group";
const labelClass =
- n.kind === "message" && n.error ? styles.treeError : n.kind === "key" || n.kind === "foreignKey" ? styles.keyLabel : styles.nodeLabel;
+ n.kind === "message" && n.error
+ ? styles.treeError
+ : n.kind === "key" || n.kind === "foreignKey"
+ ? styles.keyLabel
+ : styles.nodeLabel;
const live = n.kind === "source" && [...st.connected].some((t) => splitTarget(t).id === n.source.id);
return (
<span className={styles.nodeRow}>
@@ -302,14 +345,26 @@ export function DatabaseView() {
)}
<span className={labelClass}>{label(n)}</span>
{d && (
- <span className={n.kind === "source" ? styles.treeBadge : counted ? styles.treeCount : n.kind === "column" ? styles.treeType : styles.treeDetail}>
+ <span
+ className={
+ n.kind === "source"
+ ? styles.treeBadge
+ : counted
+ ? styles.treeCount
+ : n.kind === "column"
+ ? styles.treeType
+ : styles.treeDetail
+ }
+ >
{d}
</span>
)}
</span>
);
}}
- onSelectionChange={(_, lead) => useDatabase.setState({ selectedSource: lead ? nodeTarget(lead) : null, selectedNode: lead })}
+ onSelectionChange={(_, lead) =>
+ useDatabase.setState({ selectedSource: lead ? nodeTarget(lead) : null, selectedNode: lead })
+ }
onActivate={(n) => {
if (n.kind === "table") openTableData(n.id, n.schema, n.table.name);
else if (n.kind === "source") void openConsole(n.source.id ?? "");
@@ -355,7 +410,14 @@ function DatabaseToolbar() {
aria-expanded={newOpen}
onClick={() => setNewOpen(!newOpen)}
/>
- <Menu open={newOpen} anchor={plus} items={newMenu()} placement="bottom-start" onClose={() => setNewOpen(false)} aria-label="New" />
+ <Menu
+ open={newOpen}
+ anchor={plus}
+ items={newMenu()}
+ placement="bottom-start"
+ onClose={() => setNewOpen(false)}
+ aria-label="New"
+ />
<IconButton {...button} icon="db-properties" action="db.properties" disabled={!sources.length} />
<span className={styles.dbToolbarSep} />
<IconButton {...button} icon="refresh" action="db.refresh" disabled={!sources.length} />
@@ -372,7 +434,7 @@ function DatabaseToolbar() {
onClick={() => void executeAction("db.goToDdl")}
{...tooltipAttrs("Go to DDL", shortcutLabel("db.goToDdl"))}
>
- DDL
+ <T>DDL</T>
</button>
</div>
);
diff --git a/src/features/database/Dialogs.tsx b/src/features/database/Dialogs.tsx
index d9a1c7c00..a833cf560 100644
--- a/src/features/database/Dialogs.tsx
+++ b/src/features/database/Dialogs.tsx
@@ -10,7 +10,7 @@ import {
type DbSshAuth,
type DbSslMode,
} from "@/platform/ipc";
-import { Button, Checkbox, Dialog, Input, Select, Tabs, lazyComponent } from "@/ui";
+import { Button, Checkbox, Dialog, Input, Select, Tabs, lazyComponent, T } from "@/ui";
import { connectRemedy, fileSourceName, newSourceId, sshLabel } from "./model";
import { closeDialog, saveSource, useDatabase } from "./store";
import styles from "./Database.module.css";
@@ -147,7 +147,7 @@ function SourceDialog({
width={560}
footerStart={
<Button onClick={() => void runTest()} disabled={busy || !valid}>
- Test Connection
+ <T>Test Connection</T>
</Button>
}
buttons={[
@@ -169,19 +169,35 @@ function SourceDialog({
]}
/>
)}
- <div className={styles.form} role={sqlite ? undefined : "tabpanel"} id={sqlite ? undefined : `db-source-panel-${tab}`}>
+ <div
+ className={styles.form}
+ role={sqlite ? undefined : "tabpanel"}
+ id={sqlite ? undefined : `db-source-panel-${tab}`}
+ >
{sqlite || tab === "general" ? (
<>
<label className={styles.formLabel} htmlFor="db-name">
- Name:
+ <T>Name:</T>
</label>
- <Input id="db-name" value={s.name ?? ""} placeholder={name} onChange={(e) => set({ name: e.target.value })} />
- <span className={styles.formLabel}>Driver:</span>
- <Select aria-label="Driver" value={s.driver ?? "postgres"} options={DRIVERS} onChange={(driver) => set({ driver })} />
+ <Input
+ id="db-name"
+ value={s.name ?? ""}
+ placeholder={name}
+ onChange={(e) => set({ name: e.target.value })}
+ />
+ <span className={styles.formLabel}>
+ <T>Driver:</T>
+ </span>
+ <Select
+ aria-label="Driver"
+ value={s.driver ?? "postgres"}
+ options={DRIVERS}
+ onChange={(driver) => set({ driver })}
+ />
{sqlite ? (
<>
<label className={styles.formLabel} htmlFor="db-file">
- File:
+ <T>File:</T>
</label>
<div className={styles.formRow}>
<Input
@@ -191,18 +207,25 @@ function SourceDialog({
placeholder="path/to/database.db (absolute or project-relative)"
onChange={(e) => set({ file: e.target.value || null })}
/>
- <Button onClick={() => void browse()}>Browse…</Button>
+ <Button onClick={() => void browse()}>
+ <T>Browse…</T>
+ </Button>
</div>
</>
) : (
<>
<label className={styles.formLabel} htmlFor="db-host">
- Host:
+ <T>Host:</T>
</label>
<div className={styles.formRow}>
- <Input id="db-host" className={styles.fill} value={s.host ?? ""} onChange={(e) => set({ host: e.target.value })} />
+ <Input
+ id="db-host"
+ className={styles.fill}
+ value={s.host ?? ""}
+ onChange={(e) => set({ host: e.target.value })}
+ />
<label className={styles.formLabel} htmlFor="db-port">
- Port:
+ <T>Port:</T>
</label>
<Input
id="db-port"
@@ -220,11 +243,11 @@ function SourceDialog({
</>
)}
<label className={styles.formLabel} htmlFor="db-user">
- User:
+ <T>User:</T>
</label>
<Input id="db-user" value={s.user ?? ""} onChange={(e) => set({ user: e.target.value })} />
<label className={styles.formLabel} htmlFor="db-password">
- Password:
+ <T>Password:</T>
</label>
<div className={styles.formRow}>
<Input
@@ -242,7 +265,7 @@ function SourceDialog({
/>
</div>
<label className={styles.formLabel} htmlFor="db-database">
- Database:
+ <T>Database:</T>
</label>
<Input id="db-database" value={s.database ?? ""} onChange={(e) => set({ database: e.target.value })} />
</>
@@ -255,7 +278,7 @@ function SourceDialog({
<span />
<Checkbox checked={!!ssh.enabled} onChange={(enabled) => setSsh({ enabled })} label="Use SSH tunnel" />
<label className={styles.formLabel} htmlFor="db-ssh-host">
- Host:
+ <T>Host:</T>
</label>
<div className={styles.formRow}>
<Input
@@ -267,7 +290,7 @@ function SourceDialog({
onChange={(e) => setSsh({ host: e.target.value })}
/>
<label className={styles.formLabel} htmlFor="db-ssh-port">
- Port:
+ <T>Port:</T>
</label>
<Input
id="db-ssh-port"
@@ -280,7 +303,7 @@ function SourceDialog({
/>
</div>
<label className={styles.formLabel} htmlFor="db-ssh-user">
- User:
+ <T>User:</T>
</label>
<Input
id="db-ssh-user"
@@ -289,7 +312,9 @@ function SourceDialog({
placeholder={ssh.auth === "openSsh" ? "from ~/.ssh/config" : ""}
onChange={(e) => setSsh({ user: e.target.value })}
/>
- <span className={styles.formLabel}>Authentication:</span>
+ <span className={styles.formLabel}>
+ <T>Authentication:</T>
+ </span>
<Select
aria-label="SSH authentication type"
disabled={!sshOn}
@@ -300,7 +325,7 @@ function SourceDialog({
{ssh.auth === "keyPair" && (
<>
<label className={styles.formLabel} htmlFor="db-ssh-key">
- Private key:
+ <T>Private key:</T>
</label>
<div className={styles.formRow}>
<Input
@@ -312,7 +337,7 @@ function SourceDialog({
onChange={(e) => setSsh({ keyFile: e.target.value })}
/>
<Button disabled={!sshOn} onClick={() => void browseKey()}>
- Browse…
+ <T>Browse…</T>
</Button>
</div>
</>
@@ -321,7 +346,11 @@ function SourceDialog({
<>
<span />
<span className={styles.formHint}>
- Uses HostName, User, Port, IdentityFile and ProxyJump from ~/.ssh/config, and keys of the SSH agent.
+ <T>
+ {
+ "Uses HostName, User, Port, IdentityFile and ProxyJump from ~/.ssh/config, and keys of the SSH agent."
+ }
+ </T>
</span>
</>
) : (
@@ -348,7 +377,9 @@ function SourceDialog({
</div>
</>
)}
- <span className={styles.formLabel}>SSL:</span>
+ <span className={styles.formLabel}>
+ <T>SSL:</T>
+ </span>
<Select aria-label="SSL mode" value={s.ssl ?? "prefer"} options={SSL} onChange={(ssl) => set({ ssl })} />
</>
)}
@@ -358,7 +389,7 @@ function SourceDialog({
<>
{" "}
<Button size="small" onClick={() => void trustAndRetry()} disabled={busy}>
- Trust Host and Retry
+ <T>Trust Host and Retry</T>
</Button>
</>
)}
@@ -391,12 +422,20 @@ function PasswordDialog({ source, resolve }: { source: DataSource; resolve: (ok:
]}
>
<div className={styles.form}>
- <span className={styles.formLabel}>User:</span>
+ <span className={styles.formLabel}>
+ <T>User:</T>
+ </span>
<span>{source.user || "(default)"}</span>
<label className={styles.formLabel} htmlFor="db-ask-password">
- Password:
+ <T>Password:</T>
</label>
- <Input id="db-ask-password" type="password" autoFocus value={password} onChange={(e) => setPassword(e.target.value)} />
+ <Input
+ id="db-ask-password"
+ type="password"
+ autoFocus
+ value={password}
+ onChange={(e) => setPassword(e.target.value)}
+ />
<span />
<Checkbox checked={save} onChange={setSave} label="Save password" />
</div>
@@ -405,7 +444,15 @@ function PasswordDialog({ source, resolve }: { source: DataSource; resolve: (ok:
}
/** SSH password / key passphrase asked on connect. */
-function SshSecretDialog({ source, prompt, resolve }: { source: DataSource; prompt: string; resolve: (ok: boolean) => void }) {
+function SshSecretDialog({
+ source,
+ prompt,
+ resolve,
+}: {
+ source: DataSource;
+ prompt: string;
+ resolve: (ok: boolean) => void;
+}) {
const [secret, setSecret] = useState("");
const [save, setSave] = useState(!!source.ssh?.saveSecret);
const password = source.ssh?.auth === "password" || /password required/.test(prompt);
@@ -434,7 +481,13 @@ function SshSecretDialog({ source, prompt, resolve }: { source: DataSource; prom
<label className={styles.formLabel} htmlFor="db-ask-ssh-secret">
{password ? "Password:" : "Passphrase:"}
</label>
- <Input id="db-ask-ssh-secret" type="password" autoFocus value={secret} onChange={(e) => setSecret(e.target.value)} />
+ <Input
+ id="db-ask-ssh-secret"
+ type="password"
+ autoFocus
+ value={secret}
+ onChange={(e) => setSecret(e.target.value)}
+ />
<span />
<Checkbox checked={save} onChange={setSave} label="Save password" />
</div>
@@ -453,22 +506,27 @@ function HostKeyDialog({ prompt, resolve }: { prompt: string; resolve: (ok: bool
open
onClose={() => done(false)}
title="Unknown SSH Host"
+ icon="warning"
width={480}
buttons={[
{ label: "Cancel", role: "cancel" },
{ label: "Trust and Connect", role: "default", onClick: () => done(true) },
]}
>
- <div className={styles.dialogText}>
- {prompt}. The authenticity of the host cannot be established. Trust it and add the key to ~/.ssh/known_hosts?
- </div>
+ {prompt}. The authenticity of the host cannot be established. Trust it and add the key to ~/.ssh/known_hosts?
</Dialog>
);
}
/** Overlay host: whichever dialog the store asks for. */
/** IDEA's parameter dialog: one SQL value per query parameter, remembered for the next run. */
-function ParamsDialog({ names, resolve }: { names: string[]; resolve: (values: Record<string, string> | null) => void }) {
+function ParamsDialog({
+ names,
+ resolve,
+}: {
+ names: string[];
+ resolve: (values: Record<string, string> | null) => void;
+}) {
const [values, setValues] = useState<Record<string, string>>(() => {
const last = useDatabase.getState().paramValues;
return Object.fromEntries(names.map((n) => [n, last[n] ?? ""]));
@@ -512,7 +570,9 @@ function ParamsDialog({ names, resolve }: { names: string[]; resolve: (values: R
</Fragment>
))}
<span />
- <span className={styles.formHint}>Values are inserted as SQL: quote strings, e.g. 'abc'.</span>
+ <span className={styles.formHint}>
+ <T>Values are inserted as SQL: quote strings, e.g. 'abc'.</T>
+ </span>
</div>
</Dialog>
);
@@ -529,16 +589,15 @@ function EndTransactionDialog({ source, resolve }: { source: DataSource; resolve
open
onClose={() => done(null)}
title="Switch to Auto-Commit"
- width={420}
+ icon="question"
+ width={460}
buttons={[
{ label: "Cancel", role: "cancel" },
{ label: "Roll Back", onClick: () => done(false) },
{ label: "Commit", role: "default", onClick: () => done(true) },
]}
>
- <div className={styles.dialogText}>
- {source.name} has uncommitted changes. Commit or roll them back before switching to auto-commit?
- </div>
+ {source.name} has uncommitted changes. Commit or roll them back before switching to auto-commit?
</Dialog>
);
}
@@ -547,12 +606,22 @@ export function DatabaseDialogs() {
const dialog = useDatabase((s) => s.dialog);
if (!dialog) return null;
if (dialog.kind === "source")
- return <SourceDialog key={dialog.source?.id ?? "new"} initial={dialog.source} preset={dialog.preset} presetPassword={dialog.password} />;
+ return (
+ <SourceDialog
+ key={dialog.source?.id ?? "new"}
+ initial={dialog.source}
+ preset={dialog.preset}
+ presetPassword={dialog.password}
+ />
+ );
if (dialog.kind === "params") return <ParamsDialog names={dialog.names} resolve={dialog.resolve} />;
if (dialog.kind === "endTransaction") return <EndTransactionDialog source={dialog.source} resolve={dialog.resolve} />;
if (dialog.kind === "sshSecret")
- return <SshSecretDialog key={dialog.source.id} source={dialog.source} prompt={dialog.prompt} resolve={dialog.resolve} />;
+ return (
+ <SshSecretDialog key={dialog.source.id} source={dialog.source} prompt={dialog.prompt} resolve={dialog.resolve} />
+ );
if (dialog.kind === "hostKey") return <HostKeyDialog prompt={dialog.prompt} resolve={dialog.resolve} />;
- if (dialog.kind === "password") return <PasswordDialog key={dialog.source.id} source={dialog.source} resolve={dialog.resolve} />;
+ if (dialog.kind === "password")
+ return <PasswordDialog key={dialog.source.id} source={dialog.source} resolve={dialog.resolve} />;
return <ObjectDialogs />;
}
diff --git a/src/features/database/ObjectDialogs.tsx b/src/features/database/ObjectDialogs.tsx
index ffff4037b..89eba809b 100644
--- a/src/features/database/ObjectDialogs.tsx
+++ b/src/features/database/ObjectDialogs.tsx
@@ -6,7 +6,7 @@
import { useEffect, useMemo, useRef, useState } from "react";
import { call, commands, type DataSource, type DbColumnInfo, type DbDriver } from "@/platform/ipc";
import { highlightInto } from "@/editor/lsp/markdown";
-import { Button, Checkbox, Dialog, IconButton, Input, Popup, Icon } from "@/ui";
+import { Button, Checkbox, Dialog, IconButton, Input, Popup, Icon, T } from "@/ui";
import { parseSourceUrl, sourceLabel, splitTarget } from "./model";
import { nodeTarget, tableOf, type DbNode } from "./nodes";
import {
@@ -158,9 +158,16 @@ function DropDialog({ id, object }: { id: string; object: DbObjectRef }) {
checked={ifExists}
onChange={setIfExists}
label="Use IF EXISTS syntax"
- disabled={(object.kind === "column" && driver !== "postgres") || (object.kind === "index" && driver === "mysql")}
+ disabled={
+ (object.kind === "column" && driver !== "postgres") || (object.kind === "index" && driver === "mysql")
+ }
+ />
+ <Checkbox
+ checked={cascade}
+ onChange={setCascade}
+ label="Use DROP CASCADE syntax"
+ disabled={driver !== "postgres"}
/>
- <Checkbox checked={cascade} onChange={setCascade} label="Use DROP CASCADE syntax" disabled={driver !== "postgres"} />
<SqlPreview sql={sql} />
</div>
</Dialog>
@@ -186,7 +193,7 @@ function TruncateDialog({ id, schema, table }: { id: string; schema: string; tab
>
<div className={styles.dialogBody}>
<div className={styles.dialogLead}>
- Delete all rows of <strong>{table}</strong>?
+ <T>Delete all rows of</T> <strong>{table}</strong>?
</div>
{driver === "postgres" && (
<>
@@ -223,7 +230,21 @@ const TYPES: Record<DbDriver, string[]> = {
"jsonb",
"bytea",
],
- mysql: ["int", "bigint", "smallint", "tinyint(1)", "decimal(10,2)", "double", "varchar(255)", "text", "date", "datetime", "timestamp", "json", "blob"],
+ mysql: [
+ "int",
+ "bigint",
+ "smallint",
+ "tinyint(1)",
+ "decimal(10,2)",
+ "double",
+ "varchar(255)",
+ "text",
+ "date",
+ "datetime",
+ "timestamp",
+ "json",
+ "blob",
+ ],
};
interface ModifyProps {
@@ -260,13 +281,26 @@ function ModifyTableDialog(props: ModifyProps) {
if (!table) return <ModifyTableForm {...props} initial={null} />;
if (details?.status === "ok") return <ModifyTableForm {...props} initial={details.value.columns} />;
return (
- <Dialog open onClose={closeDialog} title={`Modify Table ${table}`} width={440} buttons={[{ label: "Cancel", role: "cancel" }]}>
+ <Dialog
+ open
+ onClose={closeDialog}
+ title={`Modify Table ${table}`}
+ width={440}
+ buttons={[{ label: "Cancel", role: "cancel" }]}
+ >
<div className={styles.dialogText}>{details?.status === "error" ? details.message : "Loading…"}</div>
</Dialog>
);
}
-function ModifyTableForm({ id, schema, table, focusColumn, addColumn, initial }: ModifyProps & { initial: DbColumnInfo[] | null }) {
+function ModifyTableForm({
+ id,
+ schema,
+ table,
+ focusColumn,
+ addColumn,
+ initial,
+}: ModifyProps & { initial: DbColumnInfo[] | null }) {
const driver = driverOf(id);
const [name, setName] = useState(table ?? "table_name");
const [columns, setColumns] = useState<ColumnDraft[]>(() => {
@@ -287,7 +321,8 @@ function ModifyTableForm({ id, schema, table, focusColumn, addColumn, initial }:
}, [columns, driver, schema, table, name]);
const current = columns.find((c) => c.key === selected) ?? null;
- const patch = (p: Partial<ColumnDraft>) => setColumns((cs) => cs.map((c) => (c.key === selected ? { ...c, ...p } : c)));
+ const patch = (p: Partial<ColumnDraft>) =>
+ setColumns((cs) => cs.map((c) => (c.key === selected ? { ...c, ...p } : c)));
const add = () => {
const c = blankColumn(driver, columns.length + 1);
setColumns((cs) => [...cs, c]);
@@ -325,9 +360,15 @@ function ModifyTableForm({ id, schema, table, focusColumn, addColumn, initial }:
<div className={styles.modifyBody}>
<div className={styles.formRow}>
<label className={styles.formLabel} htmlFor="db-table-name">
- Table:
+ <T>Table:</T>
</label>
- <Input id="db-table-name" className={styles.fill} value={name} onChange={(e) => setName(e.target.value)} autoFocus={!table} />
+ <Input
+ id="db-table-name"
+ className={styles.fill}
+ value={name}
+ onChange={(e) => setName(e.target.value)}
+ autoFocus={!table}
+ />
<span className={styles.formHint}>{schema}</span>
</div>
<div className={styles.modifyMain}>
@@ -364,11 +405,16 @@ function ModifyTableForm({ id, schema, table, focusColumn, addColumn, initial }:
{current ? (
<>
<label className={styles.formLabel} htmlFor="db-col-name">
- Name
+ <T>Name</T>
</label>
- <Input id="db-col-name" value={current.name} disabled={current.dropped} onChange={(e) => patch({ name: e.target.value })} />
+ <Input
+ id="db-col-name"
+ value={current.name}
+ disabled={current.dropped}
+ onChange={(e) => patch({ name: e.target.value })}
+ />
<label className={styles.formLabel} htmlFor="db-col-type">
- Data type
+ <T>Data type</T>
</label>
<Input
id="db-col-type"
@@ -379,15 +425,24 @@ function ModifyTableForm({ id, schema, table, focusColumn, addColumn, initial }:
onChange={(e) => patch({ dataType: e.target.value })}
/>
<span />
- <Checkbox checked={current.notNull} disabled={current.dropped || locked} onChange={(notNull) => patch({ notNull })} label="Not null" />
+ <Checkbox
+ checked={current.notNull}
+ disabled={current.dropped || locked}
+ onChange={(notNull) => patch({ notNull })}
+ label="Not null"
+ />
{!table && (
<>
<span />
- <Checkbox checked={current.primaryKey} onChange={(primaryKey) => patch({ primaryKey })} label="Primary key" />
+ <Checkbox
+ checked={current.primaryKey}
+ onChange={(primaryKey) => patch({ primaryKey })}
+ label="Primary key"
+ />
</>
)}
<label className={styles.formLabel} htmlFor="db-col-default">
- Default
+ <T>Default</T>
</label>
<Input
id="db-col-default"
@@ -400,12 +455,16 @@ function ModifyTableForm({ id, schema, table, focusColumn, addColumn, initial }:
{locked && (
<>
<span />
- <span className={styles.formHint}>SQLite can rename or drop an existing column, not change its type, NOT NULL or default.</span>
+ <span className={styles.formHint}>
+ <T>SQLite can rename or drop an existing column, not change its type, NOT NULL or default.</T>
+ </span>
</>
)}
</>
) : (
- <span className={styles.formHint}>Select a column</span>
+ <span className={styles.formHint}>
+ <T>Select a column</T>
+ </span>
)}
</div>
</div>
@@ -434,15 +493,17 @@ function RemoveSourceDialog({ source }: { source: DataSource }) {
open
onClose={closeDialog}
title="Remove Data Source"
- width={440}
+ icon="question"
+ width={460}
buttons={[
{ label: "Cancel", role: "cancel" },
{ label: "Remove", role: "default", onClick: () => void remove() },
]}
>
- <div className={styles.dialogText}>
- Remove data source <strong>{source.name}</strong>? Its query console file stays on disk.
- </div>
+ <>
+ <T>Remove data source</T> <strong>{source.name}</strong>
+ <T>? Its query console file stays on disk.</T>
+ </>
</Dialog>
);
}
@@ -470,7 +531,7 @@ function SourceUrlDialog() {
>
<div className={styles.dialogBody}>
<label className={styles.formLabelLeft} htmlFor="db-url">
- URL:
+ <T>URL:</T>
</label>
<Input
id="db-url"
@@ -521,7 +582,10 @@ function QuickDoc({ node, anchor }: { node: DbNode; anchor: { x: number; y: numb
rows.push(
node.source.driver === "sqlite"
? ["File", node.source.file ?? ""]
- : ["Host", `${node.source.host ?? ""}${node.source.port ? `:${node.source.port}` : ""}${node.source.database ? `/${node.source.database}` : ""}`],
+ : [
+ "Host",
+ `${node.source.host ?? ""}${node.source.port ? `:${node.source.port}` : ""}${node.source.database ? `/${node.source.database}` : ""}`,
+ ],
);
rows.push(["Status", connectedTargets(node.source.id ?? "").length ? "Connected" : "Not connected"]);
break;
@@ -548,7 +612,15 @@ function QuickDoc({ node, anchor }: { node: DbNode; anchor: { x: number; y: numb
definition = `primary key (${node.columns.join(", ")})`;
}
return (
- <Popup open onClose={closeDialog} anchor={anchor} placement="bottom-start" className={styles.quickDoc} role="dialog" aria-label="Quick Documentation">
+ <Popup
+ open
+ onClose={closeDialog}
+ anchor={anchor}
+ placement="bottom-start"
+ className={styles.quickDoc}
+ role="dialog"
+ aria-label="Quick Documentation"
+ >
<dl className={styles.quickDocRows}>
{rows.map(([k, v]) => (
<div key={k}>
@@ -568,7 +640,7 @@ function QuickDoc({ node, anchor }: { node: DbNode; anchor: { x: number; y: numb
openTableData(t.id, t.schema, t.table);
}}
>
- Show table data
+ <T>Show table data</T>
</Button>
</div>
)}
diff --git a/src/features/database/ResultsView.tsx b/src/features/database/ResultsView.tsx
index df0687e95..363d2cec4 100644
--- a/src/features/database/ResultsView.tsx
+++ b/src/features/database/ResultsView.tsx
@@ -6,7 +6,7 @@
import { useEffect, useRef } from "react";
import clsx from "clsx";
import { call, commands } from "@/platform/ipc";
-import { EmptyState, IconButton, Spinner, Tabs, showContextMenu, type MenuItem } from "@/ui";
+import { EmptyState, IconButton, Spinner, Tabs, showContextMenu, type MenuItem, T } from "@/ui";
import { notifications } from "@/workbench/contributions";
import { EXPORT_FORMATS, exportData, type ExportData, type ExportFormat } from "./export";
import { Grid } from "./Grid";
@@ -68,7 +68,10 @@ async function saveExport(format: ExportFormat, data: ExportData) {
let path: string | null;
try {
const { save } = await import("@tauri-apps/plugin-dialog");
- path = await save({ defaultPath: `${data.table}.${f.extension}`, filters: [{ name: f.label, extensions: [f.extension] }] });
+ path = await save({
+ defaultPath: `${data.table}.${f.extension}`,
+ filters: [{ name: f.label, extensions: [f.extension] }],
+ });
} catch {
return;
}
@@ -77,21 +80,26 @@ async function saveExport(format: ExportFormat, data: ExportData) {
await call(commands.dbExportFile(path, exportData(format, data)));
notifications().notify({ level: "info", title: `${data.rows.length} rows exported`, body: path, key: "db-export" });
} catch (e) {
- notifications().notify({ level: "error", title: "Cannot export data", body: e instanceof Error ? e.message : String(e) });
+ notifications().notify({
+ level: "error",
+ title: "Cannot export data",
+ body: e instanceof Error ? e.message : String(e),
+ });
}
}
function exportMenu(data: ExportData): MenuItem[] {
return [
- ...EXPORT_FORMATS.map(
- (f): MenuItem => ({
- label: `Copy as ${f.label}`,
- icon: "copy",
- run: () => void navigator.clipboard?.writeText(exportData(f.id, data)),
- }),
- ),
+ ...EXPORT_FORMATS.map((f): MenuItem => ({
+ label: `Copy as ${f.label}`,
+ icon: "copy",
+ run: () => void navigator.clipboard?.writeText(exportData(f.id, data)),
+ })),
{ kind: "separator" },
- ...EXPORT_FORMATS.map((f): MenuItem => ({ label: `Export to ${f.label} File…`, run: () => void saveExport(f.id, data) })),
+ ...EXPORT_FORMATS.map((f): MenuItem => ({
+ label: `Export to ${f.label} File…`,
+ run: () => void saveExport(f.id, data),
+ })),
];
}
@@ -137,7 +145,11 @@ export function ResultsView() {
const active = useDatabase((s) => s.activeResult);
const hasOutput = useDatabase((s) => s.output.length > 0);
if (!results.length && !hasOutput)
- return <EmptyState title="No results">Execute a statement in a query console with ⌘↩.</EmptyState>;
+ return (
+ <EmptyState title="No results">
+ <T>Execute a statement in a query console with ⌘↩.</T>
+ </EmptyState>
+ );
const tab = results.find((r) => r.id === active);
return (
<div className={styles.view}>
diff --git a/src/features/database/TableEditor.tsx b/src/features/database/TableEditor.tsx
index a61bc2bec..87887dac4 100644
--- a/src/features/database/TableEditor.tsx
+++ b/src/features/database/TableEditor.tsx
@@ -4,8 +4,16 @@
* together in one transaction. Tables without a primary key are read-only.
*/
import { useEffect, useState } from "react";
-import { call, commands, isCancelled, nextRequestId, type DbSortKey, type DbTablePage, type RequestId } from "@/platform/ipc";
-import { Button, EmptyState, IconButton, Input, Select, Spinner } from "@/ui";
+import {
+ call,
+ commands,
+ isCancelled,
+ nextRequestId,
+ type DbSortKey,
+ type DbTablePage,
+ type RequestId,
+} from "@/platform/ipc";
+import { Button, EmptyState, IconButton, Input, Select, Spinner, T } from "@/ui";
import { notifications, type EditorInput } from "@/workbench/contributions";
import { Grid } from "./Grid";
import { buildRowEdits, emptyEdits, hasEdits, type Cell, type PendingEdits } from "./model";
@@ -47,7 +55,12 @@ export function TableEditor({ input }: { input: EditorInput }) {
setLoadedPage({ key, page: p, error: null });
setEdits(emptyEdits());
} catch (e) {
- if (!isCancelled(e)) setLoadedPage((prev) => ({ key, page: prev?.page ?? null, error: e instanceof Error ? e.message : String(e) }));
+ if (!isCancelled(e))
+ setLoadedPage((prev) => ({
+ key,
+ page: prev?.page ?? null,
+ error: e instanceof Error ? e.message : String(e),
+ }));
} finally {
done = true;
}
@@ -184,10 +197,10 @@ export function TableEditor({ input }: { input: EditorInput }) {
onClick={() => setEdits((e) => ({ ...e, inserts: [...e.inserts, new Map()] }))}
/>
<Button size="small" variant="primary" disabled={!dirty} onClick={() => void submit()}>
- Submit
+ <T>Submit</T>
</Button>
<Button size="small" disabled={!dirty} onClick={() => setEdits(emptyEdits())}>
- Revert
+ <T>Revert</T>
</Button>
</>
)}
diff --git a/src/features/debugger/ui/DebugToolWindow.tsx b/src/features/debugger/ui/DebugToolWindow.tsx
index ed961b9b0..791fd6d46 100644
--- a/src/features/debugger/ui/DebugToolWindow.tsx
+++ b/src/features/debugger/ui/DebugToolWindow.tsx
@@ -19,6 +19,7 @@ import {
showContextMenu,
type MenuItem,
type TabItem,
+ T,
} from "@/ui";
import { setMuted, useBreakpoints } from "../breakpoints/store";
import { frameLabel, groupFrames } from "../frames";
@@ -141,7 +142,8 @@ export function DebugToolWindow() {
return (
<div className={styles.emptyWrap}>
<EmptyState title="Not debugging">
- Start a debug configuration with <Kbd action="run.debug" /> or click a line number to set a breakpoint.
+ <T>Start a debug configuration with</T> <Kbd action="run.debug" />{" "}
+ <T>or click a line number to set a breakpoint.</T>
</EmptyState>
</div>
);
@@ -618,4 +620,3 @@ function ConsoleView({ session }: { session: DebugSession }) {
</div>
);
}
-
diff --git a/src/features/debugger/ui/Overlays.tsx b/src/features/debugger/ui/Overlays.tsx
index 821fdf6e3..27bc0b61f 100644
--- a/src/features/debugger/ui/Overlays.tsx
+++ b/src/features/debugger/ui/Overlays.tsx
@@ -4,7 +4,7 @@ import { basename, relativePath, useProject } from "@/platform/project";
import { executeAction } from "@/platform/actions";
import { call, commands, type AttachableProcess, type RunConfig, type Variable } from "@/platform/ipc";
import { maybeEditorService, notifications } from "@/workbench/contributions";
-import { Button, Checkbox, Dialog, Icon, IconButton, Input, Kbd, List, Popup, Toggle } from "@/ui";
+import { Button, Checkbox, Dialog, Icon, IconButton, Input, Kbd, List, Popup, Toggle, T } from "@/ui";
import { isConditional, type BreakpointEntry } from "../breakpoints/model";
import {
removeAllBreakpoints,
@@ -117,7 +117,9 @@ function BreakpointEditor({
label="Enabled"
/>
<label className={styles.field}>
- <span className={styles.label}>Condition</span>
+ <span className={styles.label}>
+ <T>Condition</T>
+ </span>
<Input
mono
value={condition}
@@ -129,7 +131,9 @@ function BreakpointEditor({
/>
</label>
<label className={styles.field}>
- <span className={styles.label}>Hit count</span>
+ <span className={styles.label}>
+ <T>Hit count</T>
+ </span>
<Input
mono
value={hitCondition}
@@ -160,7 +164,7 @@ function BreakpointEditor({
void executeAction("debug.viewBreakpoints");
}}
>
- More <Kbd action="debug.viewBreakpoints" />
+ <T>More</T> <Kbd action="debug.viewBreakpoints" />
</button>
<div className={styles.spacer} />
<Button
@@ -171,10 +175,10 @@ function BreakpointEditor({
closeBreakpointPopover();
}}
>
- Remove
+ <T>Remove</T>
</Button>
<Button size="small" variant="primary" onClick={close}>
- Done
+ <T>Done</T>
</Button>
</div>
</div>
@@ -203,7 +207,9 @@ function SpecialEditor({ bp, at }: { bp: SpecialBreakpoint; at: { x: number; y:
</div>
<Checkbox checked={bp.enabled} onChange={(enabled) => updateSpecial(bp.id, { enabled })} label="Enabled" />
<label className={styles.field}>
- <span className={styles.label}>Condition</span>
+ <span className={styles.label}>
+ <T>Condition</T>
+ </span>
<Input
mono
value={condition}
@@ -214,7 +220,9 @@ function SpecialEditor({ bp, at }: { bp: SpecialBreakpoint; at: { x: number; y:
/>
</label>
<label className={styles.field}>
- <span className={styles.label}>Hit count</span>
+ <span className={styles.label}>
+ <T>Hit count</T>
+ </span>
<Input
mono
value={hitCondition}
@@ -232,7 +240,7 @@ function SpecialEditor({ bp, at }: { bp: SpecialBreakpoint; at: { x: number; y:
void executeAction("debug.viewBreakpoints");
}}
>
- More <Kbd action="debug.viewBreakpoints" />
+ <T>More</T> <Kbd action="debug.viewBreakpoints" />
</button>
<div className={styles.spacer} />
<Button
@@ -243,10 +251,10 @@ function SpecialEditor({ bp, at }: { bp: SpecialBreakpoint; at: { x: number; y:
closeBreakpointPopover();
}}
>
- Remove
+ <T>Remove</T>
</Button>
<Button size="small" variant="primary" onClick={close}>
- Done
+ <T>Done</T>
</Button>
</div>
</div>
@@ -284,8 +292,14 @@ function BreakpointsDialog() {
if (list.length) out.push({ type: "section", key: `section:${label}`, label }, ...list);
};
section("Line Breakpoints", lines);
- section("Method Breakpoints", methods.map((bp) => ({ type: "special" as const, key: bp.id, bp })));
- section("Field Watchpoints", fields.map((bp) => ({ type: "special" as const, key: bp.id, bp })));
+ section(
+ "Method Breakpoints",
+ methods.map((bp) => ({ type: "special" as const, key: bp.id, bp })),
+ );
+ section(
+ "Field Watchpoints",
+ fields.map((bp) => ({ type: "special" as const, key: bp.id, bp })),
+ );
return out;
}, [byFile, methods, fields]);
const items = rows.filter((r) => r.type !== "section");
@@ -328,7 +342,13 @@ function BreakpointsDialog() {
size="small"
onClick={() => setSelected(addMethodBreakpoint("").id)}
/>
- <IconButton icon="trash" title="Remove All Breakpoints" size="small" disabled={!items.length} onClick={removeAll} />
+ <IconButton
+ icon="trash"
+ title="Remove All Breakpoints"
+ size="small"
+ disabled={!items.length}
+ onClick={removeAll}
+ />
</div>
<List
items={rows}
@@ -340,7 +360,11 @@ function BreakpointsDialog() {
onActivate={(r) => goTo(r)}
aria-label="All breakpoints"
className={styles.bpList}
- empty={<div className={styles.empty}>No breakpoints. Click a line number to add one.</div>}
+ empty={
+ <div className={styles.empty}>
+ <T>No breakpoints. Click a line number to add one.</T>
+ </div>
+ }
renderItem={(r) => {
if (r.type === "section") return null;
if (r.type === "special") {
@@ -417,16 +441,29 @@ function ExceptionBreakpoints({ open }: { open: boolean }) {
}, [open]);
return (
<section className={styles.exceptions} aria-label="Exception breakpoints">
- <div className={styles.exceptionsTitle}>Exception Breakpoints</div>
+ <div className={styles.exceptionsTitle}>
+ <T>Exception Breakpoints</T>
+ </div>
{groups.length === 0 ? (
- <div className={styles.exceptionsEmpty}>Start a debug session to see the exception filters of its adapter.</div>
+ <div className={styles.exceptionsEmpty}>
+ <T>Start a debug session to see the exception filters of its adapter.</T>
+ </div>
) : (
groups.map((g) => (
- <div key={g.adapter} className={styles.exceptionGroup} role="group" aria-label={`${g.adapter} exception filters`}>
+ <div
+ key={g.adapter}
+ className={styles.exceptionGroup}
+ role="group"
+ aria-label={`${g.adapter} exception filters`}
+ >
{groups.length > 1 && <div className={styles.exceptionAdapter}>{g.adapter}</div>}
{g.filters.map((f) => (
<span key={f.filter} title={f.description ?? undefined} className={styles.exceptionRow}>
- <Checkbox checked={f.enabled} onChange={(on) => setExceptionFilter(g.adapter, f.filter, on)} label={f.label} />
+ <Checkbox
+ checked={f.enabled}
+ onChange={(on) => setExceptionFilter(g.adapter, f.filter, on)}
+ label={f.label}
+ />
</span>
))}
</div>
@@ -451,17 +488,19 @@ function BreakpointDetail({ row, onGo }: { row: BpRow; onGo: () => void }) {
</span>
<div className={styles.spacer} />
<Button size="small" variant="ghost" onClick={onGo}>
- Go to Source
+ <T>Go to Source</T>
</Button>
<Button size="small" variant="ghost" onClick={() => removeBreakpoint(path, bp.id)}>
- Remove
+ <T>Remove</T>
</Button>
</div>
{st && <div className={styles.statusLine}>{st.verified ? "Verified" : (st.message ?? "Not verified")}</div>}
<Checkbox checked={bp.enabled} onChange={(enabled) => commit({ enabled })} label="Enabled" />
<Checkbox checked={!!bp.temporary} onChange={(temporary) => commit({ temporary })} label="Remove once hit" />
<label className={styles.field}>
- <span className={styles.label}>Condition</span>
+ <span className={styles.label}>
+ <T>Condition</T>
+ </span>
<Input
mono
value={condition}
@@ -471,7 +510,9 @@ function BreakpointDetail({ row, onGo }: { row: BpRow; onGo: () => void }) {
/>
</label>
<label className={styles.field}>
- <span className={styles.label}>Hit count</span>
+ <span className={styles.label}>
+ <T>Hit count</T>
+ </span>
<Input
mono
value={hitCondition}
@@ -481,7 +522,9 @@ function BreakpointDetail({ row, onGo }: { row: BpRow; onGo: () => void }) {
/>
</label>
<label className={styles.field}>
- <span className={styles.label}>Log message</span>
+ <span className={styles.label}>
+ <T>Log message</T>
+ </span>
<Input
mono
value={logMessage}
@@ -508,18 +551,20 @@ function SpecialDetail({ bp, onGo }: { bp: SpecialBreakpoint; onGo: () => void }
<div className={styles.spacer} />
{bp.path && (
<Button size="small" variant="ghost" onClick={onGo}>
- Go to Source
+ <T>Go to Source</T>
</Button>
)}
<Button size="small" variant="ghost" onClick={() => removeSpecial(bp.id)}>
- Remove
+ <T>Remove</T>
</Button>
</div>
{st && <div className={styles.statusLine}>{st.verified ? "Verified" : (st.message ?? "Not verified")}</div>}
<Checkbox checked={bp.enabled} onChange={(enabled) => updateSpecial(bp.id, { enabled })} label="Enabled" />
{bp.kind === "method" ? (
<label className={styles.field}>
- <span className={styles.label}>Method</span>
+ <span className={styles.label}>
+ <T>Method</T>
+ </span>
<Input
mono
value={name}
@@ -534,7 +579,9 @@ function SpecialDetail({ bp, onGo }: { bp: SpecialBreakpoint; onGo: () => void }
<>
<div className={styles.statusLine}>Watching {bp.dataId}</div>
<label className={styles.field}>
- <span className={styles.label}>Suspend on</span>
+ <span className={styles.label}>
+ <T>Suspend on</T>
+ </span>
<span className={styles.exceptionGroup}>
<Checkbox
checked={bp.accessType !== "read"}
@@ -553,7 +600,9 @@ function SpecialDetail({ bp, onGo }: { bp: SpecialBreakpoint; onGo: () => void }
</>
)}
<label className={styles.field}>
- <span className={styles.label}>Condition</span>
+ <span className={styles.label}>
+ <T>Condition</T>
+ </span>
<Input
mono
value={condition}
@@ -563,7 +612,9 @@ function SpecialDetail({ bp, onGo }: { bp: SpecialBreakpoint; onGo: () => void }
/>
</label>
<label className={styles.field}>
- <span className={styles.label}>Hit count</span>
+ <span className={styles.label}>
+ <T>Hit count</T>
+ </span>
<Input
mono
value={hitCondition}
@@ -616,7 +667,7 @@ function EvaluateDialogInner({ initial }: { initial: string }) {
}}
disabled={!expression.trim()}
>
- Add to Watches
+ <T>Add to Watches</T>
</Button>
}
buttons={[
@@ -626,7 +677,9 @@ function EvaluateDialogInner({ initial }: { initial: string }) {
>
<div className={styles.evalBody}>
<label className={styles.field}>
- <span className={styles.label}>Expression</span>
+ <span className={styles.label}>
+ <T>Expression</T>
+ </span>
<Input
mono
value={expression}
@@ -756,7 +809,9 @@ function AttachPopup() {
aria-label="Filter processes"
/>
{state.processes == null ? (
- <div className={styles.empty}>Loading processes…</div>
+ <div className={styles.empty}>
+ <T>Loading processes…</T>
+ </div>
) : state.error ? (
<div className={styles.empty}>{state.error}</div>
) : (
diff --git a/src/features/github/PullRequestsView.tsx b/src/features/github/PullRequestsView.tsx
index 1b5921292..234b33353 100644
--- a/src/features/github/PullRequestsView.tsx
+++ b/src/features/github/PullRequestsView.tsx
@@ -21,6 +21,7 @@ import {
Tabs,
showContextMenu,
type MenuItem,
+ T,
} from "@/ui";
import {
checksSummary,
@@ -43,7 +44,11 @@ const STATES: Array<{ value: PrStateFilter; label: string }> = [
];
function Unavailable({ availability }: { availability: GhAvailability }) {
- const retry = <Button size="small" onClick={() => void refreshAll()}>Retry</Button>;
+ const retry = (
+ <Button size="small" onClick={() => void refreshAll()}>
+ <T>Retry</T>
+ </Button>
+ );
switch (availability.kind) {
case "notInstalled":
return (
@@ -51,12 +56,15 @@ function Unavailable({ availability }: { availability: GhAvailability }) {
title="GitHub CLI is not installed"
actions={
<>
- <Button size="small" onClick={() => void openUrl("https://cli.github.com")}>Install gh…</Button>
+ <Button size="small" onClick={() => void openUrl("https://cli.github.com")}>
+ <T>Install gh…</T>
+ </Button>
{retry}
</>
}
>
- Pull requests use the <code>gh</code> command line tool. Install it, then run <code>gh auth login</code>.
+ <T>Pull requests use the</T> <code>gh</code> <T>command line tool. Install it, then run</T>{" "}
+ <code>gh auth login</code>.
</EmptyState>
);
case "notLoggedIn":
@@ -68,21 +76,29 @@ function Unavailable({ availability }: { availability: GhAvailability }) {
<Button
size="small"
variant="primary"
- onClick={() => void executeAction("terminal.runCommand", { program: "gh", args: ["auth", "login"], name: "gh auth login" })}
+ onClick={() =>
+ void executeAction("terminal.runCommand", {
+ program: "gh",
+ args: ["auth", "login"],
+ name: "gh auth login",
+ })
+ }
>
- Run gh auth login
+ <T>Run gh auth login</T>
</Button>
{retry}
</>
}
>
- Run <code>gh auth login</code> in a terminal, then retry.
+ <T>Run</T> <code>gh auth login</code> <T>in a terminal, then retry.</T>
</EmptyState>
);
case "notGitHub":
return (
<EmptyState title="No GitHub repository" actions={retry}>
- <div>This project has no remote on GitHub.</div>
+ <div>
+ <T>This project has no remote on GitHub.</T>
+ </div>
<div className={styles.hint}>{availability.message}</div>
</EmptyState>
);
@@ -113,11 +129,21 @@ function Filters() {
}, [search]);
return (
<div className={styles.filters}>
- <SearchField value={search} onChange={setSearch} placeholder="Search (GitHub syntax)" aria-label="Search pull requests" className={styles.search} />
+ <SearchField
+ value={search}
+ onChange={setSearch}
+ placeholder="Search (GitHub syntax)"
+ aria-label="Search pull requests"
+ className={styles.search}
+ />
<div className={styles.filterRow}>
<Select value={query.state} options={STATES} onChange={(state) => setQuery({ state })} aria-label="State" />
<Checkbox checked={query.authorMe} onChange={(authorMe) => setQuery({ authorMe })} label="Mine" />
- <Checkbox checked={query.reviewRequested} onChange={(reviewRequested) => setQuery({ reviewRequested })} label="Review requested" />
+ <Checkbox
+ checked={query.reviewRequested}
+ onChange={(reviewRequested) => setQuery({ reviewRequested })}
+ label="Review requested"
+ />
<span className={styles.flex} />
{loading ? <Spinner size={14} /> : <IconButton icon="refresh" size="small" action="github.refresh" />}
<IconButton icon="plus" size="small" action="github.createPullRequest" />
@@ -184,7 +210,12 @@ function PullRequestList() {
function Markdown({ text }: { text: string }) {
const html = useMarkupHtml({ kind: "markdown", value: text });
- if (!text.trim()) return <div className={styles.dim}>No description provided.</div>;
+ if (!text.trim())
+ return (
+ <div className={styles.dim}>
+ <T>No description provided.</T>
+ </div>
+ );
return (
<div
className={styles.markdown}
@@ -225,19 +256,33 @@ function Overview({ pr }: { pr: PullRequestDetails }) {
</span>
{c.url && (
<button type="button" className={styles.link} onClick={() => void openUrl(c.url!)}>
- Details
+ <T>Details</T>
</button>
)}
</div>
))}
</section>
<section className={styles.section}>
- <h3 className={styles.sectionTitle}>Reviewers</h3>
- {pr.reviewers.length === 0 && <div className={styles.dim}>No reviews</div>}
+ <h3 className={styles.sectionTitle}>
+ <T>Reviewers</T>
+ </h3>
+ {pr.reviewers.length === 0 && (
+ <div className={styles.dim}>
+ <T>No reviews</T>
+ </div>
+ )}
{pr.reviewers.map((r) => (
<div key={r.login} className={styles.checkRow}>
<Icon
- name={r.state === "APPROVED" ? "success" : r.state === "CHANGES_REQUESTED" ? "error" : r.state === "REQUESTED" ? "clock" : "info"}
+ name={
+ r.state === "APPROVED"
+ ? "success"
+ : r.state === "CHANGES_REQUESTED"
+ ? "error"
+ : r.state === "REQUESTED"
+ ? "clock"
+ : "info"
+ }
size={14}
className={styles[`review-${r.state}`]}
/>
@@ -276,7 +321,14 @@ function Files({ pr }: { pr: PullRequestDetails }) {
{pr.files.map((f) => {
const slash = f.path.lastIndexOf("/");
return (
- <button key={f.path} type="button" role="listitem" className={styles.fileRow} onClick={(e) => e.detail <= 1 && void openFileDiff(pr, f)} title={f.path}>
+ <button
+ key={f.path}
+ type="button"
+ role="listitem"
+ className={styles.fileRow}
+ onClick={(e) => e.detail <= 1 && void openFileDiff(pr, f)}
+ title={f.path}
+ >
<Icon name="diff" size={14} className={styles[`change-${f.changeType}`]} />
<span className={clsx(styles.fileName, styles[`change-${f.changeType}`])}>{f.path.slice(slash + 1)}</span>
<span className={clsx(styles.dim, styles.ellipsis)}>{slash > 0 ? f.path.slice(0, slash) : ""}</span>
@@ -304,7 +356,11 @@ function Commits({ pr }: { pr: PullRequestDetails }) {
e.preventDefault();
showContextMenu({ x: e.clientX, y: e.clientY }, [
{ label: "Copy Revision Number", icon: "copy", run: () => void navigator.clipboard?.writeText(c.oid) },
- { label: "Open in Browser", icon: "external-link", run: () => void openUrl(`${pr.summary.url}/commits/${c.oid}`) },
+ {
+ label: "Open in Browser",
+ icon: "external-link",
+ run: () => void openUrl(`${pr.summary.url}/commits/${c.oid}`),
+ },
]);
}}
>
@@ -330,13 +386,19 @@ function Conversation({ pr }: { pr: PullRequestDetails }) {
<article key={i} className={styles.comment}>
<header className={styles.commentHead}>
<strong>{t.author}</strong>
- {t.reviewState && <span className={styles[`review-${t.reviewState}`]}>{reviewStateLabel(t.reviewState)}</span>}
+ {t.reviewState && (
+ <span className={styles[`review-${t.reviewState}`]}>{reviewStateLabel(t.reviewState)}</span>
+ )}
<span className={styles.dim}>{relativeTime(t.createdAt)}</span>
</header>
{t.body.trim() && <Markdown text={t.body} />}
</article>
))}
- {threads.length > 0 && <h3 className={styles.sectionTitle}>Review comments</h3>}
+ {threads.length > 0 && (
+ <h3 className={styles.sectionTitle}>
+ <T>Review comments</T>
+ </h3>
+ )}
{threads.map((t) => (
<article key={t.root.id} className={styles.comment}>
<header className={styles.commentHead}>
@@ -377,7 +439,7 @@ function Conversation({ pr }: { pr: PullRequestDetails }) {
setPosting(false);
}}
>
- Comment
+ <T>Comment</T>
</Button>
</div>
</div>
@@ -396,7 +458,7 @@ function Details() {
if (error) return <EmptyState title="Could not load the pull request">{error}</EmptyState>;
return loading ? (
<div className={styles.loading}>
- <Spinner size={14} /> Loading…
+ <Spinner size={14} /> <T>Loading…</T>
</div>
) : (
<EmptyState title="Select a pull request" />
@@ -423,18 +485,24 @@ function Details() {
<span>
#{s.number} by <strong>{s.author}</strong> · {s.baseRef} ← {s.headRef}
</span>
- {reviewDecisionLabel(s.reviewDecision) && <span className={styles.dim}>· {reviewDecisionLabel(s.reviewDecision)}</span>}
- {pr.mergeable === "CONFLICTING" && <span className={styles.conflict}>· Conflicts</span>}
+ {reviewDecisionLabel(s.reviewDecision) && (
+ <span className={styles.dim}>· {reviewDecisionLabel(s.reviewDecision)}</span>
+ )}
+ {pr.mergeable === "CONFLICTING" && (
+ <span className={styles.conflict}>
+ <T>· Conflicts</T>
+ </span>
+ )}
</div>
<div className={styles.actions}>
<Button size="small" icon="branch" onClick={() => void checkoutPullRequest(s.number)}>
- Checkout
+ <T>Checkout</T>
</Button>
<Button size="small" icon="edit" onClick={reviewMenu}>
- Review ▾
+ <T>Review ▾</T>
</Button>
<Button size="small" icon="external-link" onClick={() => void openUrl(s.url)}>
- Open in Browser
+ <T>Open in Browser</T>
</Button>
<span className={styles.flex} />
<IconButton icon="refresh" size="small" title="Reload" onClick={() => void loadDetails(s.number)} />
@@ -496,11 +564,7 @@ export function PullRequestsView() {
if (!useGithub.getState().availability) void refreshAll();
}, []);
if (!availability)
- return (
- <div className={styles.loading}>
- {checking && <Spinner size={14} />} Connecting to GitHub…
- </div>
- );
+ return <div className={styles.loading}>{checking && <Spinner size={14} />} Connecting to GitHub…</div>;
if (availability.kind !== "ready")
return (
<div className={styles.view}>
@@ -529,4 +593,3 @@ export function PullRequestsHeader() {
if (availability?.kind !== "ready") return null;
return <span className={styles.repo}>{availability.repo.nameWithOwner}</span>;
}
-
diff --git a/src/features/github/dialogs.tsx b/src/features/github/dialogs.tsx
index 09cc903d5..1505d1524 100644
--- a/src/features/github/dialogs.tsx
+++ b/src/features/github/dialogs.tsx
@@ -3,7 +3,7 @@ import { Fragment, useEffect, useState, type ReactNode } from "react";
import { create } from "zustand";
import type { ReviewEvent } from "@/platform/ipc";
import { call, commands } from "@/platform/ipc";
-import { Checkbox, Dialog, Input, Select } from "@/ui";
+import { Checkbox, Dialog, Input, Select, T } from "@/ui";
import styles from "./Github.module.css";
interface Entry {
@@ -45,11 +45,22 @@ export interface CreatePrInput {
}
/** Asks for the new pull request's title, description, base branch and options. */
-export function createPullRequestDialog(opts: { head: string; defaultBase: string | null; title: string; needsPush: boolean }) {
+export function createPullRequestDialog(opts: {
+ head: string;
+ defaultBase: string | null;
+ title: string;
+ needsPush: boolean;
+}) {
return open<CreatePrInput>((done) => <CreateDialog {...opts} onDone={done} />);
}
-function CreateDialog(props: { head: string; defaultBase: string | null; title: string; needsPush: boolean; onDone: (v: CreatePrInput | null) => void }) {
+function CreateDialog(props: {
+ head: string;
+ defaultBase: string | null;
+ title: string;
+ needsPush: boolean;
+ onDone: (v: CreatePrInput | null) => void;
+}) {
const [title, setTitle] = useState(props.title);
const [body, setBody] = useState("");
const [base, setBase] = useState(props.defaultBase ?? "");
@@ -95,11 +106,24 @@ function CreateDialog(props: { head: string; defaultBase: string | null; title:
>
<div className={styles.form}>
<div className={styles.formRow}>
- <label className={styles.fieldLabel}>Base:</label>
- <Select value={base || null} options={bases.map((b) => ({ value: b, label: b }))} onChange={setBase} aria-label="Base branch" />
+ <label className={styles.fieldLabel}>
+ <T>Base:</T>
+ </label>
+ <Select
+ value={base || null}
+ options={bases.map((b) => ({ value: b, label: b }))}
+ onChange={setBase}
+ aria-label="Base branch"
+ />
<span className={styles.fieldLabel}>← {props.head}</span>
</div>
- <Input data-autofocus aria-label="Title" placeholder="Title" value={title} onChange={(e) => setTitle(e.target.value)} />
+ <Input
+ data-autofocus
+ aria-label="Title"
+ placeholder="Title"
+ value={title}
+ onChange={(e) => setTitle(e.target.value)}
+ />
<textarea
aria-label="Description"
placeholder="Description (Markdown)"
@@ -117,14 +141,24 @@ function CreateDialog(props: { head: string; defaultBase: string | null; title:
);
}
-const REVIEW_LABEL: Record<ReviewEvent, string> = { approve: "Approve", requestChanges: "Request Changes", comment: "Comment" };
+const REVIEW_LABEL: Record<ReviewEvent, string> = {
+ approve: "Approve",
+ requestChanges: "Request Changes",
+ comment: "Comment",
+};
/** Asks for a review comment; resolves with the chosen event and body. */
export function reviewDialog(number: number, initial: ReviewEvent) {
- return open<{ event: ReviewEvent; body: string }>((done) => <ReviewDialog number={number} initial={initial} onDone={done} />);
+ return open<{ event: ReviewEvent; body: string }>((done) => (
+ <ReviewDialog number={number} initial={initial} onDone={done} />
+ ));
}
-function ReviewDialog(props: { number: number; initial: ReviewEvent; onDone: (v: { event: ReviewEvent; body: string } | null) => void }) {
+function ReviewDialog(props: {
+ number: number;
+ initial: ReviewEvent;
+ onDone: (v: { event: ReviewEvent; body: string } | null) => void;
+}) {
const [body, setBody] = useState("");
const [event, setEvent] = useState<ReviewEvent>(props.initial);
const needsBody = event !== "approve";
@@ -135,7 +169,12 @@ function ReviewDialog(props: { number: number; initial: ReviewEvent; onDone: (v:
onClose={() => props.onDone(null)}
width={520}
buttons={[
- { label: REVIEW_LABEL[event], role: "default", disabled: needsBody && !body.trim(), onClick: () => props.onDone({ event, body }) },
+ {
+ label: REVIEW_LABEL[event],
+ role: "default",
+ disabled: needsBody && !body.trim(),
+ onClick: () => props.onDone({ event, body }),
+ },
{ label: "Cancel", role: "cancel" },
]}
>
@@ -187,8 +226,17 @@ function NumberDialog(props: { title: string; onDone: (v: number | null) => void
if (ok) props.onDone(n);
}}
>
- <label className={styles.fieldLabel}>Pull request number:</label>
- <Input data-autofocus mono aria-label="Pull request number" placeholder="#123" value={value} onChange={(e) => setValue(e.target.value)} />
+ <label className={styles.fieldLabel}>
+ <T>Pull request number:</T>
+ </label>
+ <Input
+ data-autofocus
+ mono
+ aria-label="Pull request number"
+ placeholder="#123"
+ value={value}
+ onChange={(e) => setValue(e.target.value)}
+ />
</form>
</Dialog>
);
diff --git a/src/features/http-client/HttpClientView.tsx b/src/features/http-client/HttpClientView.tsx
index 23dddef94..ae43b6a2d 100644
--- a/src/features/http-client/HttpClientView.tsx
+++ b/src/features/http-client/HttpClientView.tsx
@@ -6,7 +6,7 @@
import { useEffect, useMemo, useState } from "react";
import clsx from "clsx";
import type { HttpExchange, HttpHistoryEntry } from "@/platform/ipc";
-import { EmptyState, IconButton, SplitGroup, SplitHandle, SplitPanel, Spinner, Tabs } from "@/ui";
+import { EmptyState, IconButton, SplitGroup, SplitHandle, SplitPanel, Spinner, Tabs, T } from "@/ui";
import { bodyKind, formatMs, formatSize, prettyBody } from "./format";
import { cancelRunning, clearHistory, refreshHistory, selectEntry, useHttpClient } from "./store";
import styles from "./HttpClient.module.css";
@@ -98,7 +98,9 @@ function ExchangeView({ ex }: { ex: HttpExchange }) {
) : (
<pre className={styles.pre} aria-label="Response body">
{body}
- {r.truncated && <span className={styles.truncated}>{`\n… truncated (${formatSize(r.size)} received)`}</span>}
+ {r.truncated && (
+ <span className={styles.truncated}>{`\n… truncated (${formatSize(r.size)} received)`}</span>
+ )}
</pre>
))}
{tab === "headers" && r && <HeaderTable headers={r.headers} />}
@@ -147,7 +149,9 @@ export function HttpClientView() {
</div>
)}
{history.length === 0 && !running ? (
- <EmptyState title="No requests yet">Run a request from an .http file with the gutter ▶ or ⌘↩.</EmptyState>
+ <EmptyState title="No requests yet">
+ <T>Run a request from an .http file with the gutter ▶ or ⌘↩.</T>
+ </EmptyState>
) : (
history.map((h) => <EntryRow key={h.id} entry={h} selected={h.id === selected} />)
)}
diff --git a/src/features/http-client/editor.tsx b/src/features/http-client/editor.tsx
index 2162120dd..8dbd319bf 100644
--- a/src/features/http-client/editor.tsx
+++ b/src/features/http-client/editor.tsx
@@ -11,8 +11,16 @@ import type { EditorDocContext } from "@/editor/api";
import { shortcutLabel } from "@/platform/keymap";
import { isVirtualUri } from "@/platform/virtualDocs";
import type { HttpRequestBlock } from "@/platform/ipc";
-import { IconButton, Select, iconMarkup } from "@/ui";
-import { cancelRunning, loadEnvironments, parseRequests, runAll, runRequest, setEnvironment, useHttpClient } from "./store";
+import { IconButton, Select, iconMarkup, T } from "@/ui";
+import {
+ cancelRunning,
+ loadEnvironments,
+ parseRequests,
+ runAll,
+ runRequest,
+ setEnvironment,
+ useHttpClient,
+} from "./store";
import styles from "./HttpClient.module.css";
export const HTTP_LANGUAGE = "http";
@@ -63,7 +71,11 @@ class RequestMarker extends GutterMarker {
super();
}
override eq(other: GutterMarker): boolean {
- return other instanceof RequestMarker && other.request.index === this.request.index && other.request.url === this.request.url;
+ return (
+ other instanceof RequestMarker &&
+ other.request.index === this.request.index &&
+ other.request.url === this.request.url
+ );
}
override toDOM(): Node {
const el = document.createElement("div");
@@ -101,7 +113,9 @@ function Toolbar({ path, view }: { path: string | null; view: EditorView }) {
onClick={() => void runAll(path, view.state.doc.toString())}
/>
<IconButton icon="stop" title="Stop" disabled={!running} onClick={cancelRunning} />
- <span className={styles.toolbarLabel}>Run with:</span>
+ <span className={styles.toolbarLabel}>
+ <T>Run with:</T>
+ </span>
<Select
aria-label="Environment"
value={chosen && envs?.includes(chosen) ? chosen : ""}
diff --git a/src/features/index.ts b/src/features/index.ts
index 9112bbd57..c04196aad 100644
--- a/src/features/index.ts
+++ b/src/features/index.ts
@@ -20,7 +20,7 @@ import { activate as build } from "./build";
import { activate as templates, activateSettingsPages as templatesPages } from "./templates";
import { activate as todo, activateSettingsPages as todoPages } from "./todo";
import { activate as settings, activateSettingsWindow } from "./settings";
-import { activate as app } from "./app";
+import { activate as app, activateLocale as appLocale } from "./app";
import { activate as perf } from "./perf";
import { activate as plugins, activateSettingsPages as pluginsPages } from "./plugins";
import { activate as tools, activateSettingsPages as toolsPages } from "./tools";
@@ -86,6 +86,7 @@ export { SettingsWindow, settingsWindowParent } from "./settings";
*/
export function activateSettingsWindowFeatures(parent: string): () => void {
const pages: Array<[string, Activate]> = [
+ ["locale", appLocale],
["settings", () => activateSettingsWindow(parent)],
["templates", templatesPages],
["todo", todoPages],
diff --git a/src/features/perf/MemoryStatus.tsx b/src/features/perf/MemoryStatus.tsx
index 0dc296416..1cb1b5721 100644
--- a/src/features/perf/MemoryStatus.tsx
+++ b/src/features/perf/MemoryStatus.tsx
@@ -6,7 +6,7 @@
*/
import { useEffect, useRef } from "react";
import clsx from "clsx";
-import { BarButton, Button, Popup } from "@/ui";
+import { BarButton, Button, Popup, T } from "@/ui";
import { executeAction } from "@/platform/actions";
import { isTauri, type AppMetrics } from "@/platform/ipc";
import { formatBytes, formatCount, formatMs, formatSize, formatUptime } from "./format";
@@ -109,7 +109,9 @@ export function MemoryDetails({ metrics: m }: { metrics: AppMetrics }) {
))}
<div className={styles.section}>
<div className={styles.groupRow}>
- <span className={styles.groupTitle}>Total</span>
+ <span className={styles.groupTitle}>
+ <T>Total</T>
+ </span>
<span className={styles.value}>{formatSize(summary.total)}</span>
</div>
<Row label="Physical memory" value={formatSize(m.totalMemoryBytes)} />
@@ -137,7 +139,7 @@ export function MemoryDetails({ metrics: m }: { metrics: AppMetrics }) {
{error && <div className={styles.error}>{error}</div>}
<div className={styles.actions}>
<Button size="small" icon="trash" onClick={() => void executeAction("file.invalidateCaches")}>
- Clear caches
+ <T>Clear caches</T>
</Button>
</div>
</div>
diff --git a/src/features/perf/PerfOverlay.tsx b/src/features/perf/PerfOverlay.tsx
index 0486a49b4..7f537d87c 100644
--- a/src/features/perf/PerfOverlay.tsx
+++ b/src/features/perf/PerfOverlay.tsx
@@ -1,6 +1,6 @@
/** Dev diagnostics: keystroke → paint latency, IPC round trips, long tasks. */
import { useEffect, useRef, useState } from "react";
-import { IconButton } from "@/ui";
+import { IconButton, T } from "@/ui";
import { isTauri } from "@/platform/ipc";
import { formatMs } from "./format";
import { FRAME_BUDGET_MS, keystrokeLatencies, supportsEntryType, type EventEntryLike } from "./events";
@@ -72,7 +72,9 @@ function PerfPanel({ onClose }: { onClose: () => void }) {
return (
<section className={styles.overlay} aria-label="Performance overlay (dev diagnostics)">
<div className={styles.overlayHeader}>
- <span className={styles.overlayTitle}>Performance (dev diagnostics)</span>
+ <span className={styles.overlayTitle}>
+ <T>Performance (dev diagnostics)</T>
+ </span>
<IconButton icon="close" size="small" title="Close performance overlay" onClick={onClose} />
</div>
<Block
@@ -101,7 +103,9 @@ function Block({ title, summary, budget, note }: { title: string; summary?: Summ
<span className={styles.value}>{s ? `${s.count} samples` : "–"}</span>
</div>
<div className={styles.row}>
- <span className={styles.label}>last · p50 · p95 · max</span>
+ <span className={styles.label}>
+ <T>last · p50 · p95 · max</T>
+ </span>
<span className={styles.value}>{s ? [s.last, s.p50, s.p95, s.max].map(formatMs).join(" · ") : "–"}</span>
</div>
<div className={styles.row}>
diff --git a/src/features/plugins/PluginsPage.tsx b/src/features/plugins/PluginsPage.tsx
index c97291020..901e7485d 100644
--- a/src/features/plugins/PluginsPage.tsx
+++ b/src/features/plugins/PluginsPage.tsx
@@ -22,6 +22,7 @@ import {
Tabs,
showContextMenu,
type MenuItem,
+ T,
} from "@/ui";
import { pluginActionId } from "./bridge";
import {
@@ -125,7 +126,7 @@ function InstalledRow({ plugin, selected, onSelect }: { plugin: PluginInfo; sele
{plugin.source === "dev" && <span className={styles.devTag}>dev</span>}
{plugin.status === "failed" && (
<Badge dot tone="danger">
- Failed
+ <T>Failed</T>
</Badge>
)}
</span>
@@ -220,7 +221,9 @@ function DetailTabs({ notes, overview }: { notes: string | null; overview: React
) : notes ? (
<pre className={styles.notes}>{notes.trim()}</pre>
) : (
- <p className={styles.muted}>This version has no release notes.</p>
+ <p className={styles.muted}>
+ <T>This version has no release notes.</T>
+ </p>
)}
</>
);
@@ -244,17 +247,25 @@ function InstalledDetails({ plugin }: { plugin: PluginInfo }) {
{plugin.description && <p className={styles.description}>{plugin.description}</p>}
<dl className={styles.facts}>
- <dt>Id</dt>
+ <dt>
+ <T>Id</T>
+ </dt>
<dd className={styles.mono}>{plugin.id}</dd>
- <dt>Location</dt>
+ <dt>
+ <T>Location</T>
+ </dt>
<dd className={styles.mono} title={plugin.path}>
{plugin.path}
</dd>
- <dt>Code</dt>
+ <dt>
+ <T>Code</T>
+ </dt>
<dd>{plugin.hasCode ? "WebAssembly component (sandboxed)" : "None — contributions only"}</dd>
{plugin.homepage && (
<>
- <dt>Homepage</dt>
+ <dt>
+ <T>Homepage</T>
+ </dt>
<dd className={styles.mono}>{plugin.homepage}</dd>
</>
)}
@@ -263,7 +274,9 @@ function InstalledDetails({ plugin }: { plugin: PluginInfo }) {
{plugin.hasCode && (
<Section title="Permissions">
{plugin.permissions.length === 0 ? (
- <div className={styles.muted}>No special permissions.</div>
+ <div className={styles.muted}>
+ <T>No special permissions.</T>
+ </div>
) : (
<ul className={styles.items}>
{plugin.permissions.map((p) => (
@@ -297,7 +310,7 @@ function InstalledDetails({ plugin }: { plugin: PluginInfo }) {
onClick={() => void runPluginCommand(plugin.id, c.id)}
aria-label={`Run ${c.title}`}
>
- Run
+ <T>Run</T>
</Button>
</li>
);
@@ -317,7 +330,7 @@ function InstalledDetails({ plugin }: { plugin: PluginInfo }) {
<span className={styles.muted}>{t.kind === "dark" ? "Dark" : "Light"}</span>
{isActive ? (
<Button size="small" variant="secondary" onClick={() => void selectPluginTheme(null, null)}>
- Use Default Theme
+ <T>Use Default Theme</T>
</Button>
) : (
<Button
@@ -327,7 +340,7 @@ function InstalledDetails({ plugin }: { plugin: PluginInfo }) {
onClick={() => void selectPluginTheme(plugin.id, t.id)}
aria-label={`Apply theme ${t.name}`}
>
- Apply
+ <T>Apply</T>
</Button>
)}
</li>
@@ -362,7 +375,11 @@ function InstalledDetails({ plugin }: { plugin: PluginInfo }) {
<div className={styles.titleLine}>
<span className={styles.version}>{plugin.version}</span>
<Badge tone={status.tone}>{status.label}</Badge>
- {plugin.source === "dev" && <Badge tone="warning">Dev plugin</Badge>}
+ {plugin.source === "dev" && (
+ <Badge tone="warning">
+ <T>Dev plugin</T>
+ </Badge>
+ )}
</div>
</div>
<div className={styles.headerActions}>
@@ -392,15 +409,15 @@ function InstalledDetails({ plugin }: { plugin: PluginInfo }) {
onClick={() => void uninstallPlugin(plugin.id)}
aria-label={`Confirm uninstall ${plugin.name}`}
>
- Uninstall
+ <T>Uninstall</T>
</Button>
<Button size="small" variant="ghost" onClick={() => setConfirmUninstall(false)}>
- Cancel
+ <T>Cancel</T>
</Button>
</>
) : (
<Button size="small" disabled={busy} onClick={() => setConfirmUninstall(true)}>
- Uninstall…
+ <T>Uninstall…</T>
</Button>
))}
</div>
@@ -425,17 +442,25 @@ function CatalogDetails({ entry }: { entry: CatalogPlugin }) {
)}
{entry.description && <p className={styles.description}>{entry.description}</p>}
<dl className={styles.facts}>
- <dt>Id</dt>
+ <dt>
+ <T>Id</T>
+ </dt>
<dd className={styles.mono}>{entry.id}</dd>
- <dt>Source</dt>
+ <dt>
+ <T>Source</T>
+ </dt>
<dd className={styles.mono} title={entry.path}>
{entry.path}
</dd>
- <dt>Code</dt>
+ <dt>
+ <T>Code</T>
+ </dt>
<dd>{entry.hasCode ? "WebAssembly component (sandboxed)" : "None — contributions only"}</dd>
{contributes.length > 0 && (
<>
- <dt>Contributes</dt>
+ <dt>
+ <T>Contributes</T>
+ </dt>
<dd>{contributes.join(", ")}</dd>
</>
)}
@@ -631,15 +656,17 @@ export function PluginsPage() {
<InstalledDetails key={selected.id} plugin={selected} />
) : (
<EmptyState className={styles.detailsEmpty} title={loaded ? "No plugin selected" : "Loading…"}>
- Plugins are folders with a <code>plugin.toml</code>. Use the gear menu to install one from disk, or put
- dev plugins in <code>.openidea/plugins/</code> inside your project.
+ <T>Plugins are folders with a</T> <code>plugin.toml</code>
+ <T>. Use the gear menu to install one from disk, or put dev plugins in</T> <code>.openidea/plugins/</code>{" "}
+ <T>inside your project.</T>
</EmptyState>
)
) : selectedEntry ? (
<CatalogDetails key={selectedEntry.id} entry={selectedEntry} />
) : (
<EmptyState className={styles.detailsEmpty} title={NO_REPOSITORY}>
- Install a plugin folder with <code>plugin.toml</code> via the gear menu › Install Plugin from Disk….
+ <T>Install a plugin folder with</T> <code>plugin.toml</code>{" "}
+ <T>via the gear menu › Install Plugin from Disk….</T>
</EmptyState>
)}
</div>
diff --git a/src/features/profiler/ProfilerView.tsx b/src/features/profiler/ProfilerView.tsx
index 8d1de967c..84dd39905 100644
--- a/src/features/profiler/ProfilerView.tsx
+++ b/src/features/profiler/ProfilerView.tsx
@@ -6,7 +6,7 @@
import { useLayoutEffect, useMemo, useRef, useState } from "react";
import clsx from "clsx";
import type { Profile } from "@/platform/ipc";
-import { EmptyState, IconButton, Input, Tabs, Tree } from "@/ui";
+import { EmptyState, IconButton, Input, Tabs, Tree, T } from "@/ui";
import { editorService } from "@/workbench/contributions";
import { colorSlot, flameLayout, formatWeight, frameLocation, matchingFrames, share } from "./model";
import { activeSnapshot, closeSnapshot, useProfiler, type ProfilerTab } from "./store";
@@ -17,7 +17,10 @@ const ROW = 18;
function openFrame(profile: Profile, frame: number) {
const f = profile.frames[frame];
if (!f?.file) return;
- void editorService().openFile(f.file, f.line !== null ? { selection: { line: f.line, col: 0 }, focus: true } : { focus: true });
+ void editorService().openFile(
+ f.file,
+ f.line !== null ? { selection: { line: f.line, col: 0 }, focus: true } : { focus: true },
+ );
}
export function ProfilerTabs() {
@@ -188,10 +191,12 @@ function MethodList({ profile, query }: { profile: Profile; query: string }) {
{location && <span className={styles.muted}>{location}</span>}
</td>
<td className={styles.num}>
- {formatWeight(m.selfWeight ?? 0, profile.unit)} <span className={styles.muted}>{share(m.selfWeight ?? 0, total)}</span>
+ {formatWeight(m.selfWeight ?? 0, profile.unit)}{" "}
+ <span className={styles.muted}>{share(m.selfWeight ?? 0, total)}</span>
</td>
<td className={styles.num}>
- {formatWeight(m.total ?? 0, profile.unit)} <span className={styles.muted}>{share(m.total ?? 0, total)}</span>
+ {formatWeight(m.total ?? 0, profile.unit)}{" "}
+ <span className={styles.muted}>{share(m.total ?? 0, total)}</span>
</td>
</tr>
);
@@ -209,7 +214,9 @@ export function ProfilerView() {
if (!snapshot) {
return (
<EmptyState title="No profiler snapshots">
- <span>Profile a run configuration to see where it spends its time.</span>
+ <span>
+ <T>Profile a run configuration to see where it spends its time.</T>
+ </span>
</EmptyState>
);
}
diff --git a/src/features/project-tree/ConfirmDialog.tsx b/src/features/project-tree/ConfirmDialog.tsx
index 37992a323..55b7dec9c 100644
--- a/src/features/project-tree/ConfirmDialog.tsx
+++ b/src/features/project-tree/ConfirmDialog.tsx
@@ -1,7 +1,6 @@
import { useEffect, type ReactNode } from "react";
import { create } from "zustand";
import { Dialog } from "@/ui";
-import styles from "./ProjectView.module.css";
interface ConfirmRequest {
title: string;
@@ -37,14 +36,15 @@ export function ConfirmDialogHost() {
<Dialog
open
title={request.title}
+ icon="question"
onClose={() => request.resolve(false)}
- width={420}
+ width={460}
buttons={[
{ label: request.okLabel, role: "default", autoFocus: true, onClick: () => request.resolve(true) },
{ label: "Cancel", role: "cancel" },
]}
>
- <div className={styles.confirmBody}>{request.message}</div>
+ {request.message}
</Dialog>
);
}
diff --git a/src/features/project-tree/FileRefactorDialogs.tsx b/src/features/project-tree/FileRefactorDialogs.tsx
index 28e865bcf..0971a702b 100644
--- a/src/features/project-tree/FileRefactorDialogs.tsx
+++ b/src/features/project-tree/FileRefactorDialogs.tsx
@@ -5,7 +5,7 @@
import { useEffect, useRef, useState } from "react";
import { create } from "zustand";
import type { FileMove } from "@/bindings";
-import { Checkbox, Dialog, Input, Spinner } from "@/ui";
+import { Checkbox, Dialog, Input, Spinner, T } from "@/ui";
import { runFileRefactoring, type FileRefactorOptions } from "./fileRefactor";
import { isSameOrInside, joinPath, nameOf, parentOf, relativeTo, splitExtension, validateName } from "./paths";
import { useProjectTree } from "./store";
@@ -147,7 +147,9 @@ function Busy() {
return (
<div className={styles.busy} role="status">
<Spinner size={14} />
- <span>Looking for references…</span>
+ <span>
+ <T>Looking for references…</T>
+ </span>
</div>
);
}
@@ -273,7 +275,7 @@ function MoveDialog({ request }: { request: Extract<FileRefactorRequest, { kind:
>
<div className={styles.subject}>{subject}</div>
<label className={styles.fieldLabel} htmlFor="file-move-target">
- To directory:
+ <T>To directory:</T>
</label>
<Input
id="file-move-target"
diff --git a/src/features/project-tree/ProjectView.module.css b/src/features/project-tree/ProjectView.module.css
index 66c0d2c29..5390d288c 100644
--- a/src/features/project-tree/ProjectView.module.css
+++ b/src/features/project-tree/ProjectView.module.css
@@ -115,10 +115,3 @@
pointer-events: none;
white-space: nowrap;
}
-
-.confirmBody {
- padding: 14px;
- color: var(--fg);
- line-height: 1.5;
- overflow-wrap: anywhere;
-}
diff --git a/src/features/run/ConfigChooser.tsx b/src/features/run/ConfigChooser.tsx
index 1f609bfd1..5a0b9895a 100644
--- a/src/features/run/ConfigChooser.tsx
+++ b/src/features/run/ConfigChooser.tsx
@@ -2,7 +2,7 @@ import { useMemo, useState, type KeyboardEvent } from "react";
import clsx from "clsx";
import { executeAction } from "@/platform/actions";
import { shortcutLabel } from "@/platform/keymap";
-import { HighlightedText, Icon, IconButton, List, Popup, SearchField, fuzzyMatch, listNavigate } from "@/ui";
+import { HighlightedText, Icon, IconButton, List, Popup, SearchField, fuzzyMatch, listNavigate, T } from "@/ui";
import type { RunConfig } from "@/platform/ipc";
import { commandLine, configIcon, groupConfigs } from "./configs";
import { saveTemporary, selectConfig, startRun, useRun } from "./store";
@@ -44,9 +44,7 @@ export function chooserJustClosed(): boolean {
}
function anchorElement(): Element | { x: number; y: number } {
- return (
- document.querySelector("[data-run-chooser]") ?? { x: Math.round(window.innerWidth / 2) - 150, y: 40 }
- );
+ return document.querySelector("[data-run-chooser]") ?? { x: Math.round(window.innerWidth / 2) - 150, y: 40 };
}
/** Run/Debug configuration chooser popup (⌃⌥R), anchored to the title bar widget. */
@@ -62,7 +60,13 @@ function ConfigChooser() {
const temporary = useRun((s) => s.temporary);
const [query, setQuery] = useState("");
const rows = useMemo(
- () => buildRows(configs, query, configs.find((c) => c.id === selectedId), temporary),
+ () =>
+ buildRows(
+ configs,
+ query,
+ configs.find((c) => c.id === selectedId),
+ temporary,
+ ),
[configs, query, selectedId, temporary],
);
const isSection = (r: Row) => r.type === "section";
@@ -161,7 +165,9 @@ function ConfigChooser() {
return (
<span className={clsx(styles.chooserRow, styles.chooserEdit)}>
<Icon name="edit" size={13} />
- <span>Edit Configurations…</span>
+ <span>
+ <T>Edit Configurations…</T>
+ </span>
<span className={styles.chooserShortcut}>{shortcutLabel("run.editConfigs")}</span>
</span>
);
diff --git a/src/features/run/EditConfigsDialog.tsx b/src/features/run/EditConfigsDialog.tsx
index 62ae5331c..1ffa54202 100644
--- a/src/features/run/EditConfigsDialog.tsx
+++ b/src/features/run/EditConfigsDialog.tsx
@@ -1,7 +1,7 @@
import { useMemo, useState, type ReactNode } from "react";
import clsx from "clsx";
import type { RunConfig } from "@/platform/ipc";
-import { Button, Checkbox, Dialog, Icon, IconButton, Input, Select, type SelectOption } from "@/ui";
+import { Button, Checkbox, Dialog, Icon, IconButton, Input, Select, type SelectOption, T } from "@/ui";
import { notifications } from "@/workbench/contributions";
import {
KIND_OPTIONS,
@@ -183,7 +183,7 @@ function EditConfigsDialog() {
footerStart={
invalid && (
<span className={styles.footerError}>
- <Icon name="error" size={13} /> Fix the highlighted fields
+ <Icon name="error" size={13} /> <T>Fix the highlighted fields</T>
</span>
)
}
@@ -236,7 +236,11 @@ function EditConfigsDialog() {
))}
</div>
))}
- {draft.length === 0 && <div className={styles.testEmpty}>No configurations. Click + to add one.</div>}
+ {draft.length === 0 && (
+ <div className={styles.testEmpty}>
+ <T>No configurations. Click + to add one.</T>
+ </div>
+ )}
</div>
</div>
<div className={styles.editForm}>
@@ -244,7 +248,7 @@ function EditConfigsDialog() {
<>
{current.detected && (
<div className={styles.notice}>
- Detected from the project. Changes are saved as a user configuration that overrides it.
+ <T>Detected from the project. Changes are saved as a user configuration that overrides it.</T>
</div>
)}
<Field label="Name" error={errors.name}>
@@ -256,7 +260,12 @@ function EditConfigsDialog() {
/>
</Field>
<Field label="Kind">
- <Select value={current.kind} options={kindOptions} onChange={(kind) => update({ kind })} aria-label="Kind" />
+ <Select
+ value={current.kind}
+ options={kindOptions}
+ onChange={(kind) => update({ kind })}
+ aria-label="Kind"
+ />
</Field>
<Field label="Command" error={errors.command}>
<Input
@@ -317,13 +326,22 @@ function EditConfigsDialog() {
/>
</div>
))}
- <Button size="small" variant="ghost" icon="plus" onClick={() => setRows([...rows, { key: "", value: "" }])}>
- Add variable
+ <Button
+ size="small"
+ variant="ghost"
+ icon="plus"
+ onClick={() => setRows([...rows, { key: "", value: "" }])}
+ >
+ <T>Add variable</T>
</Button>
</div>
</Field>
<Field label="">
- <Checkbox checked={current.isTest} onChange={(isTest) => update({ isTest })} label="Show results in the test runner" />
+ <Checkbox
+ checked={current.isTest}
+ onChange={(isTest) => update({ isTest })}
+ label="Show results in the test runner"
+ />
</Field>
<Field label="Debug adapter">
<Select
@@ -334,12 +352,16 @@ function EditConfigsDialog() {
/>
</Field>
<div className={styles.editPreview}>
- <span className={styles.chooserMuted}>Command line</span>
+ <span className={styles.chooserMuted}>
+ <T>Command line</T>
+ </span>
<code>{commandLine(current) || "—"}</code>
</div>
</>
) : (
- <div className={styles.testEmpty}>Select a configuration</div>
+ <div className={styles.testEmpty}>
+ <T>Select a configuration</T>
+ </div>
)}
</div>
</div>
@@ -347,17 +369,7 @@ function EditConfigsDialog() {
);
}
-function Field({
- label,
- error,
- top,
- children,
-}: {
- label: string;
- error?: string;
- top?: boolean;
- children: ReactNode;
-}) {
+function Field({ label, error, top, children }: { label: string; error?: string; top?: boolean; children: ReactNode }) {
return (
<div className={clsx(styles.field, top && styles.fieldTop)}>
<span className={styles.fieldLabel}>{label}</span>
diff --git a/src/features/run/RunView.tsx b/src/features/run/RunView.tsx
index 3cb7a641d..26591db42 100644
--- a/src/features/run/RunView.tsx
+++ b/src/features/run/RunView.tsx
@@ -1,6 +1,6 @@
import { useMemo, useState } from "react";
import { useWorkflowSettings } from "@/platform/workflowSettings";
-import { EmptyState, Icon, IconButton, Input, SplitGroup, SplitHandle, SplitPanel, Tabs, type TabItem } from "@/ui";
+import { EmptyState, Icon, IconButton, Input, SplitGroup, SplitHandle, SplitPanel, Tabs, type TabItem, T } from "@/ui";
import { executeAction } from "@/platform/actions";
import { shortcutLabel } from "@/platform/keymap";
import { ConsoleModel } from "./console";
@@ -52,7 +52,9 @@ function StdinBar({ session }: { session: RunSession }) {
mono
className={styles.stdinInput}
aria-label="Standard input"
- placeholder={session.stdinClosed ? "stdin closed" : disabled ? "Process is not running" : "Send to stdin (Enter)"}
+ placeholder={
+ session.stdinClosed ? "stdin closed" : disabled ? "Process is not running" : "Send to stdin (Enter)"
+ }
value={value}
disabled={disabled}
data-autofocus=""
@@ -110,7 +112,7 @@ function SessionPanel({ session }: { session: RunSession }) {
{testModel && (
<div className={styles.notice}>
<button type="button" className={styles.noticeLink} onClick={() => setSelectedTest(null)}>
- Show all output
+ <T>Show all output</T>
</button>
</div>
)}
@@ -169,7 +171,12 @@ function SessionPanel({ session }: { session: RunSession }) {
/>
<IconButton icon="trash" iconSize={14} title="Clear All" onClick={() => clearConsole(session.id)} />
<div className={styles.toolbarSep} />
- <IconButton icon="settings" iconSize={14} title="Edit Configurations…" onClick={() => void executeAction("run.editConfigs", session.config.id)} />
+ <IconButton
+ icon="settings"
+ iconSize={14}
+ title="Edit Configurations…"
+ onClick={() => void executeAction("run.editConfigs", session.config.id)}
+ />
</div>
<div className={styles.sessionBody}>
{rt.tests ? (
@@ -197,7 +204,6 @@ function SessionPanel({ session }: { session: RunSession }) {
);
}
-
function sessionItems(sessions: readonly RunSession[]): TabItem[] {
return sessions.map((s) => ({
id: s.id,
@@ -261,7 +267,7 @@ export function RunView() {
if (!current) {
return (
<EmptyState icon="run" title="Nothing is running">
- Run a configuration with <kbd className={styles.kbd}>⌃R</kbd> or pick one in the toolbar.
+ <T>Run a configuration with</T> <kbd className={styles.kbd}>⌃R</kbd> <T>or pick one in the toolbar.</T>
</EmptyState>
);
}
@@ -269,7 +275,12 @@ export function RunView() {
const id = "session" in current ? current.session.id : current.trace.id;
return (
<div className={styles.root}>
- <div className={styles.panel} role="tabpanel" id={`openidea-run-panel-${id}`} aria-labelledby={`openidea-run-tab-${id}`}>
+ <div
+ className={styles.panel}
+ role="tabpanel"
+ id={`openidea-run-panel-${id}`}
+ aria-labelledby={`openidea-run-tab-${id}`}
+ >
{"session" in current ? (
<SessionPanel key={id} session={current.session} />
) : (
diff --git a/src/features/run/dialogs.tsx b/src/features/run/dialogs.tsx
index e3f8571f6..e4fa33d3f 100644
--- a/src/features/run/dialogs.tsx
+++ b/src/features/run/dialogs.tsx
@@ -44,15 +44,16 @@ function RerunDialog({ name, resolve }: { name: string; resolve: (ok: boolean) =
<Dialog
open
title={`Process '${name}' Is Running`}
+ icon="question"
onClose={() => void done(false)}
- width={440}
+ width={460}
footerStart={<Checkbox checked={dontAsk} onChange={setDontAsk} label="Do not ask again" />}
buttons={[
{ label: "Stop and Rerun", role: "default", autoFocus: true, onClick: () => void done(true) },
{ label: "Cancel", role: "cancel" },
]}
>
- <div className={styles.dialogBody}>Do you want to stop the process '{name}' and run it again?</div>
+ Do you want to stop the process &apos;{name}&apos; and run it again?
</Dialog>
);
}
@@ -75,12 +76,7 @@ function PromptDialog({ title, resolve }: { title: string; resolve: (v: string |
]}
>
<div className={styles.dialogBody}>
- <Input
- autoFocus
- aria-label="Value"
- value={value}
- onChange={(e) => setValue(e.target.value)}
- />
+ <Input autoFocus aria-label="Value" value={value} onChange={(e) => setValue(e.target.value)} />
</div>
</Dialog>
);
diff --git a/src/features/run/stackTrace.tsx b/src/features/run/stackTrace.tsx
index 5575ade89..991326735 100644
--- a/src/features/run/stackTrace.tsx
+++ b/src/features/run/stackTrace.tsx
@@ -9,7 +9,7 @@ import { create } from "zustand";
import { registerActions } from "@/platform/actions";
import { useProject } from "@/platform/project";
import { registerOverlay, toolWindowService } from "@/workbench/contributions";
-import { Dialog } from "@/ui";
+import { Dialog, T } from "@/ui";
import { ConsoleModel } from "./console";
import { ConsoleView } from "./ConsoleView";
import { findOutputLinks } from "./links";
@@ -116,7 +116,7 @@ function StackTraceDialog({ initial }: { initial: string }) {
>
<div className={styles.form}>
<label className={styles.label} htmlFor="stacktrace-text">
- Put a stack trace or a complete thread dump here:
+ <T>Put a stack trace or a complete thread dump here:</T>
</label>
<textarea
id="stacktrace-text"
diff --git a/src/features/scratch/ScratchChooser.tsx b/src/features/scratch/ScratchChooser.tsx
index a042eebaa..58ab7b2bd 100644
--- a/src/features/scratch/ScratchChooser.tsx
+++ b/src/features/scratch/ScratchChooser.tsx
@@ -1,6 +1,6 @@
import { useMemo, useState, type KeyboardEvent } from "react";
import clsx from "clsx";
-import { HighlightedText, Icon, List, Popup, fileIconName, listNavigate } from "@/ui";
+import { HighlightedText, Icon, List, Popup, fileIconName, listNavigate, T } from "@/ui";
import { chooserRows, type LanguageRow, type ScratchLanguage } from "./model";
import { closeChooser, rememberLanguage, useScratch } from "./store";
import { createScratch } from "./scratches";
@@ -60,7 +60,9 @@ function ScratchChooser({ languages }: { languages: readonly ScratchLanguage[] }
>
<div className={styles.body} tabIndex={0} data-autofocus onKeyDown={onKeyDown}>
<div className={styles.header}>
- <span className={styles.title}>New Scratch File</span>
+ <span className={styles.title}>
+ <T>New Scratch File</T>
+ </span>
{filter && <span className={styles.filter}>{filter}</span>}
</div>
<List
@@ -74,7 +76,11 @@ function ScratchChooser({ languages }: { languages: readonly ScratchLanguage[] }
rowHeight={24}
className={styles.list}
aria-label="Languages"
- empty={<div className={styles.empty}>No matching languages</div>}
+ empty={
+ <div className={styles.empty}>
+ <T>No matching languages</T>
+ </div>
+ }
renderItem={(r, state) => (
<div className={clsx(styles.row, state.active && styles.active)} data-language={r.lang.id}>
<Icon name={fileIconName(`scratch.${r.lang.ext}`)} size={16} />
diff --git a/src/features/search/everywhere/SearchEverywhere.tsx b/src/features/search/everywhere/SearchEverywhere.tsx
index 953c71a50..b66eb76a5 100644
--- a/src/features/search/everywhere/SearchEverywhere.tsx
+++ b/src/features/search/everywhere/SearchEverywhere.tsx
@@ -18,6 +18,7 @@ import {
fileIconName,
listNavigate,
type MenuItem,
+ T,
} from "@/ui";
import { useFileDecoration } from "@/workbench/contributions";
import { badgeKind, basename, openLocation, relDir } from "../common/open";
@@ -152,7 +153,11 @@ function SearchEverywhereDialog() {
case "text":
return closeThen(
() =>
- void openLocation(row.path, { line: row.line, col: row.col, endLine: row.line, endCol: row.endCol }, { side }),
+ void openLocation(
+ row.path,
+ { line: row.line, col: row.col, endLine: row.line, endCol: row.endCol },
+ { side },
+ ),
);
case "action":
if (!row.enabled) return;
@@ -193,7 +198,12 @@ function SearchEverywhereDialog() {
{ label: "Copy Path from Project Root", run: () => copy(row.rel) },
...(row.kind === "symbol" ? [{ label: "Copy Name", run: () => copy(row.name) }] : []),
...(row.kind === "file" || row.kind === "text"
- ? [{ label: "Find in Directory…", run: () => closeThen(() => void executeAction("find.inPath", { directory: dirOf(row.path) })) }]
+ ? [
+ {
+ label: "Find in Directory…",
+ run: () => closeThen(() => void executeAction("find.inPath", { directory: dirOf(row.path) })),
+ },
+ ]
: []),
];
setMenu({ anchor, items });
@@ -210,7 +220,8 @@ function SearchEverywhereDialog() {
if (e.key === "Enter") {
e.preventDefault();
if (e.altKey) openIntentions();
- else if (hasPrimaryModifier(e) && tab === "text") closeThen(() => void executeAction("find.inPath", { query: parsed.text }));
+ else if (hasPrimaryModifier(e) && tab === "text")
+ closeThen(() => void executeAction("find.inPath", { query: parsed.text }));
else if (!settled && !sel.moved) pendingEnter.current = { side: e.shiftKey };
else activate(activeRow, e.shiftKey);
return;
@@ -225,7 +236,8 @@ function SearchEverywhereDialog() {
const listHeight = Math.min(MAX_LIST, rows.length * ROW);
const emptyQuery = !parsed.text.trim();
const showEmpty = !rows.length && snap && !snap.loading && (!emptyQuery || tab !== "all");
- const canSplit = !!activeRow && activeRow.kind !== "section" && activeRow.kind !== "more" && activeRow.kind !== "action";
+ const canSplit =
+ !!activeRow && activeRow.kind !== "section" && activeRow.kind !== "more" && activeRow.kind !== "action";
const onTabKey = (e: KeyboardEvent<HTMLDivElement>) => {
if (e.key !== "ArrowRight" && e.key !== "ArrowLeft") return;
e.preventDefault();
@@ -359,7 +371,7 @@ function SearchEverywhereDialog() {
<span className={styles.footerInfo}>{describe(activeRow)}</span>
{canSplit && (
<button type="button" className={styles.footerLink} onClick={() => activate(activeRow, true)}>
- Open In Right Split
+ <T>Open In Right Split</T>
</button>
)}
</footer>
@@ -448,7 +460,10 @@ function ResultRow({
const shortcut = shortcutLabel(row.id);
const toggled = actionToggled(getAction(row.id));
return (
- <span className={clsx(styles.actionRow, !row.enabled && styles.disabled)} aria-disabled={!row.enabled || undefined}>
+ <span
+ className={clsx(styles.actionRow, !row.enabled && styles.disabled)}
+ aria-disabled={!row.enabled || undefined}
+ >
<span className={styles.icon}>{row.icon ? <Icon name={row.icon} size={16} /> : null}</span>
<span className={styles.main}>
<HighlightedText className={styles.name} text={row.title} indices={row.indices} tone={tone} />
@@ -484,7 +499,12 @@ function ResultRow({
<Icon name={fileIconName(basename(row.rel))} size={16} />
</span>
<span className={styles.main}>
- <HighlightedText className={clsx(styles.name, styles.code)} text={row.text} indices={row.indices} tone={tone} />
+ <HighlightedText
+ className={clsx(styles.name, styles.code)}
+ text={row.text}
+ indices={row.indices}
+ tone={tone}
+ />
</span>
<span className={clsx(styles.right, active && styles.rightActive)}>
{basename(row.rel)} {row.line + 1}
diff --git a/src/features/search/find/FindInFiles.module.css b/src/features/search/find/FindInFiles.module.css
index 44294041e..1ee703163 100644
--- a/src/features/search/find/FindInFiles.module.css
+++ b/src/features/search/find/FindInFiles.module.css
@@ -170,8 +170,6 @@
}
.confirm {
margin: 0;
- padding: 14px;
- line-height: 1.5;
}
.confirm code {
font-family: var(--font-mono);
diff --git a/src/features/search/find/FindInFiles.tsx b/src/features/search/find/FindInFiles.tsx
index c3571326b..069bde907 100644
--- a/src/features/search/find/FindInFiles.tsx
+++ b/src/features/search/find/FindInFiles.tsx
@@ -16,6 +16,7 @@ import {
Tabs,
listNavigate,
type MenuItem,
+ T,
} from "@/ui";
import { maybeEditorService, notifications } from "@/workbench/contributions";
import { basename, dirname, openLocation } from "../common/open";
@@ -126,7 +127,8 @@ function FindInFilesDialog() {
}, [s.scopeTab, s.namedScope, recentPaths]);
const scope: SearchScope = useMemo(() => {
- if (s.scopeTab === "directory" && s.directory.trim()) return { kind: "directory", path: resolveDirectory(s.directory, root) };
+ if (s.scopeTab === "directory" && s.directory.trim())
+ return { kind: "directory", path: resolveDirectory(s.directory, root) };
const fileSet = FILE_SET_SCOPES[s.namedScope];
if (s.scopeTab === "scope" && fileSet) return { kind: "fileSet", set: fileSet };
if (s.scopeTab === "scope") {
@@ -191,7 +193,8 @@ function FindInFilesDialog() {
if (!row) return;
close();
setTimeout(
- () => void openLocation(row.path, { line: row.line, col: row.col, endLine: row.line, endCol: row.endCol }, { side }),
+ () =>
+ void openLocation(row.path, { line: row.line, col: row.col, endLine: row.line, endCol: row.endCol }, { side }),
0,
);
};
@@ -231,7 +234,12 @@ function FindInFilesDialog() {
setMarks(next);
return next;
} catch (e) {
- notifications().notify({ group: "search", level: "error", title: "Replace failed", body: String((e as Error)?.message ?? e) });
+ notifications().notify({
+ group: "search",
+ level: "error",
+ title: "Replace failed",
+ body: String((e as Error)?.message ?? e),
+ });
return null;
} finally {
setRunning(null);
@@ -253,7 +261,12 @@ function FindInFilesDialog() {
};
const replaceInFile = async () => {
if (!selected) return;
- const next = await replaceUsages(pendingUsages(rows.filter((r) => r.path === selected.path), marks));
+ const next = await replaceUsages(
+ pendingUsages(
+ rows.filter((r) => r.path === selected.path),
+ marks,
+ ),
+ );
if (next) {
const i = nextPending(rows, active, next);
if (i >= 0) setIndex(i);
@@ -287,10 +300,7 @@ function FindInFilesDialog() {
const inField = target.tagName === "INPUT" && target.closest("[data-find-field]");
if (e.altKey && !e.metaKey && !e.ctrlKey) {
const toggle = { KeyC: "caseSensitive", KeyW: "wholeWord", KeyX: "isRegex" }[e.code] as
- | "caseSensitive"
- | "wholeWord"
- | "isRegex"
- | undefined;
+ "caseSensitive" | "wholeWord" | "isRegex" | undefined;
if (toggle) {
e.preventDefault();
set({ [toggle]: !s[toggle] });
@@ -347,7 +357,13 @@ function FindInFilesDialog() {
onChange={(e) => set({ mask: e.target.value, maskEnabled: true })}
onBlur={() => s.maskEnabled && rememberMask(s.mask)}
/>
- <IconButton icon="chevron-down" title="Recent file masks" size="small" iconSize={11} onClick={() => setMaskMenu(true)} />
+ <IconButton
+ icon="chevron-down"
+ title="Recent file masks"
+ size="small"
+ iconSize={11}
+ onClick={() => setMaskMenu(true)}
+ />
</div>
<IconButton icon="pin" title="Open in Find Window" shortcut="⌘↵" onClick={pin} disabled={!s.pattern} />
</header>
@@ -363,9 +379,30 @@ function FindInFilesDialog() {
invalid={state.status === "invalid"}
className={styles.field}
toggles={[
- { id: "case", icon: "case", title: "Match Case", shortcut: "⌥C", pressed: s.caseSensitive, onToggle: (v) => set({ caseSensitive: v }) },
- { id: "word", icon: "word", title: "Words", shortcut: "⌥W", pressed: s.wholeWord, onToggle: (v) => set({ wholeWord: v }) },
- { id: "regex", icon: "regex", title: "Regex", shortcut: "⌥X", pressed: s.isRegex, onToggle: (v) => set({ isRegex: v }) },
+ {
+ id: "case",
+ icon: "case",
+ title: "Match Case",
+ shortcut: "⌥C",
+ pressed: s.caseSensitive,
+ onToggle: (v) => set({ caseSensitive: v }),
+ },
+ {
+ id: "word",
+ icon: "word",
+ title: "Words",
+ shortcut: "⌥W",
+ pressed: s.wholeWord,
+ onToggle: (v) => set({ wholeWord: v }),
+ },
+ {
+ id: "regex",
+ icon: "regex",
+ title: "Regex",
+ shortcut: "⌥X",
+ pressed: s.isRegex,
+ onToggle: (v) => set({ isRegex: v }),
+ },
]}
/>
</div>
@@ -446,22 +483,32 @@ function FindInFilesDialog() {
renderItem={(r, st) => {
const state = s.replace ? groupState(r, marks) : "pending";
return (
- <>
- <span className={clsx(styles.rowText, state === "done" && styles.rowDone, state === "excluded" && styles.rowExcluded)}>
- <MatchText
- text={r.text}
- ranges={r.ranges}
- active={st.active}
- replacement={s.replace && state !== "done" ? s.replacement : null}
- query={query}
- preserveCase={s.preserveCase}
- />
- </span>
- <span className={clsx(styles.rowFile, st.active && styles.rowFileActive)}>
- {state === "done" && <span className={styles.rowLine}>replaced · </span>}
- {basename(r.relPath)} <span className={styles.rowLine}>{r.line + 1}</span>
- </span>
- </>
+ <>
+ <span
+ className={clsx(
+ styles.rowText,
+ state === "done" && styles.rowDone,
+ state === "excluded" && styles.rowExcluded,
+ )}
+ >
+ <MatchText
+ text={r.text}
+ ranges={r.ranges}
+ active={st.active}
+ replacement={s.replace && state !== "done" ? s.replacement : null}
+ query={query}
+ preserveCase={s.preserveCase}
+ />
+ </span>
+ <span className={clsx(styles.rowFile, st.active && styles.rowFileActive)}>
+ {state === "done" && (
+ <span className={styles.rowLine}>
+ <T>replaced ·</T>{" "}
+ </span>
+ )}
+ {basename(r.relPath)} <span className={styles.rowLine}>{r.line + 1}</span>
+ </span>
+ </>
);
}}
/>
@@ -480,13 +527,23 @@ function FindInFilesDialog() {
</div>
<div className={styles.previewBox}>
{previewMode && s.replace && selected ? (
- <ReplaceDiffPreview lines={diffPreview?.key === selected.key ? diffPreview.lines : null} line={selected.line} />
+ <ReplaceDiffPreview
+ lines={diffPreview?.key === selected.key ? diffPreview.lines : null}
+ line={selected.line}
+ />
) : (
- <CodePreview path={selected?.path ?? null} line={selected?.line ?? 0} highlights={fileHighlights} version={previewVersion} />
+ <CodePreview
+ path={selected?.path ?? null}
+ line={selected?.line ?? 0}
+ highlights={fileHighlights}
+ version={previewVersion}
+ />
)}
</div>
<footer className={styles.footer}>
- <span className={styles.hint}>↵ Open · ⇧↵ Open to the side · ⌘↵ Open in Find Window</span>
+ <span className={styles.hint}>
+ <T>↵ Open · ⇧↵ Open to the side · ⌘↵ Open in Find Window</T>
+ </span>
<span className={styles.spacer} />
{s.replace && progress && (
<span className={styles.hint} aria-live="polite">
@@ -495,41 +552,48 @@ function FindInFilesDialog() {
)}
{s.replace && running && (
<Button size="small" onClick={() => running.cancel()}>
- Stop
+ <T>Stop</T>
</Button>
)}
{s.replace && (
<>
<Checkbox checked={previewMode} onChange={setPreviewMode} label="Preview" />
<Button size="small" variant="secondary" disabled={!selected || busy} onClick={skip}>
- Skip
+ <T>Skip</T>
</Button>
<Button size="small" disabled={!selected || busy} onClick={() => void replaceCurrent()}>
- Replace
+ <T>Replace</T>
</Button>
<Button size="small" disabled={!selected || busy} onClick={() => void replaceInFile()}>
- Replace All in This File
+ <T>Replace All in This File</T>
</Button>
<Button
size="small"
disabled={!rows.length || busy || state.status === "searching"}
onClick={() => setConfirm({ usages: pendingUsages(rows, marks), partial: !!state.summary?.limitHit })}
>
- Replace All
+ <T>Replace All</T>
</Button>
</>
)}
<Button size="small" variant={s.replace ? "secondary" : "primary"} disabled={!s.pattern} onClick={pin}>
- Open in Find Window
+ <T>Open in Find Window</T>
</Button>
</footer>
</div>
- <Menu open={maskMenu} anchor={maskRef} items={maskItems} placement="bottom-end" onClose={() => setMaskMenu(false)} />
+ <Menu
+ open={maskMenu}
+ anchor={maskRef}
+ items={maskItems}
+ placement="bottom-end"
+ onClose={() => setMaskMenu(false)}
+ />
<Dialog
open={!!confirm}
onClose={() => setConfirm(null)}
- width={420}
+ width={460}
title="Replace All"
+ icon="question"
buttons={[
{
label: "Replace",
@@ -547,8 +611,18 @@ function FindInFilesDialog() {
>
<p className={styles.confirm}>
{confirm && confirmText(countUsages(confirm.usages), s.pattern, s.replacement || "")}
- {confirm && marks.excluded.size > 0 && <span> Excluded usages are skipped.</span>}
- {confirm?.partial && <span className={styles.warn}> The search hit its limit; only usages found so far are replaced.</span>}
+ {confirm && marks.excluded.size > 0 && (
+ <span>
+ {" "}
+ <T>Excluded usages are skipped.</T>
+ </span>
+ )}
+ {confirm?.partial && (
+ <span className={styles.warn}>
+ {" "}
+ <T>The search hit its limit; only usages found so far are replaced.</T>
+ </span>
+ )}
</p>
</Dialog>
</Dialog>
diff --git a/src/features/search/find/FindToolWindow.module.css b/src/features/search/find/FindToolWindow.module.css
index a0508841a..fc80a91bc 100644
--- a/src/features/search/find/FindToolWindow.module.css
+++ b/src/features/search/find/FindToolWindow.module.css
@@ -90,5 +90,4 @@
}
.confirm {
margin: 0;
- line-height: 1.5;
}
diff --git a/src/features/search/find/FindToolWindow.tsx b/src/features/search/find/FindToolWindow.tsx
index e089ba0c2..500b3fee0 100644
--- a/src/features/search/find/FindToolWindow.tsx
+++ b/src/features/search/find/FindToolWindow.tsx
@@ -16,6 +16,7 @@ import {
fileIconName,
showContextMenu,
type TreeRowState,
+ T,
} from "@/ui";
import { notifications } from "@/workbench/contributions";
import { basename, openLocation, relDir } from "../common/open";
@@ -83,7 +84,14 @@ export function buildFindTree(files: readonly FileMatches[]): Node[] {
starts: m.ranges.map(([s]) => ({ line: m.line, col: s + m.textOffset })),
};
});
- d.children.push({ kind: "file", key: `f:${f.path}`, path: f.path, name: basename(f.relPath), count: f.matches.length, children });
+ d.children.push({
+ kind: "file",
+ key: `f:${f.path}`,
+ path: f.path,
+ name: basename(f.relPath),
+ count: f.matches.length,
+ children,
+ });
d.count += f.matches.length;
}
return [...dirs.values()].sort((a, b) => a.label.localeCompare(b.label));
@@ -97,7 +105,8 @@ export function nodeGroups(node: Node): UsageGroup[] {
/** Excluded (⌫) / replaced usages per Find tab. */
const useMarks = create<{ byTab: Record<number, ReplaceMarks> }>(() => ({ byTab: {} }));
-const setMarks = (tab: number, marks: ReplaceMarks) => useMarks.setState((s) => ({ byTab: { ...s.byTab, [tab]: marks } }));
+const setMarks = (tab: number, marks: ReplaceMarks) =>
+ useMarks.setState((s) => ({ byTab: { ...s.byTab, [tab]: marks } }));
const useCollapsed = create<{ byTab: Record<number, ReadonlySet<string>> }>(() => ({ byTab: {} }));
const setCollapsed = (tab: number, keys: ReadonlySet<string>) =>
@@ -185,7 +194,12 @@ function FindTabView({ tab }: { tab: FindTab }) {
const replace = async (usages: Usage[]) => {
if (tab.replacement === null || !usages.length || running) return;
const run = startReplace(
- { query: tab.query, replacement: tab.replacement, preserveCase: !!tab.preserveCase, targets: replaceTargets(usages) },
+ {
+ query: tab.query,
+ replacement: tab.replacement,
+ preserveCase: !!tab.preserveCase,
+ targets: replaceTargets(usages),
+ },
setProgress,
);
setRunning(run);
@@ -200,7 +214,12 @@ function FindTabView({ tab }: { tab: FindTab }) {
// Replaced usages disappear from the view, as in IDEA; exclusions are kept.
rerunFindTab(tab.id);
} catch (e) {
- notifications().notify({ group: "search", level: "error", title: "Replace failed", body: String((e as Error)?.message ?? e) });
+ notifications().notify({
+ group: "search",
+ level: "error",
+ title: "Replace failed",
+ body: String((e as Error)?.message ?? e),
+ });
} finally {
setRunning(null);
setProgress(null);
@@ -226,7 +245,12 @@ function FindTabView({ tab }: { tab: FindTab }) {
line: usages[0]?.line,
});
} catch (e) {
- notifications().notify({ group: "search", level: "error", title: "Preview failed", body: String((e as Error)?.message ?? e) });
+ notifications().notify({
+ group: "search",
+ level: "error",
+ title: "Preview failed",
+ body: String((e as Error)?.message ?? e),
+ });
}
};
@@ -257,27 +281,31 @@ function FindTabView({ tab }: { tab: FindTab }) {
</span>
<span className={styles.spacer} />
<Button size="small" variant="ghost" disabled={!selection.size} onClick={exclude} title="Exclude / include (⌫)">
- Exclude
+ <T>Exclude</T>
</Button>
{replaceMode && (
<>
{running && (
<Button size="small" onClick={() => running.cancel()}>
- Stop
+ <T>Stop</T>
</Button>
)}
<Button size="small" variant="ghost" disabled={!selection.size || busy} onClick={() => void preview()}>
- Preview
+ <T>Preview</T>
</Button>
- <Button size="small" disabled={!selectedPending.length || busy} onClick={() => void replace(selectedPending)}>
- Replace Selected
+ <Button
+ size="small"
+ disabled={!selectedPending.length || busy}
+ onClick={() => void replace(selectedPending)}
+ >
+ <T>Replace Selected</T>
</Button>
<Button
size="small"
disabled={busy || !allPending.length || st.status === "searching"}
onClick={() => setConfirm(allPending)}
>
- Replace All
+ <T>Replace All</T>
</Button>
</>
)}
@@ -307,7 +335,13 @@ function FindTabView({ tab }: { tab: FindTab }) {
const groups = [...sel].flatMap((k) => (byKey.get(k) ? nodeGroups(byKey.get(k)!) : []));
const excludedAll = groups.length > 0 && groups.every((g) => groupState(g, marks) === "excluded");
showContextMenu(e, [
- { id: "exclude", label: excludedAll ? "Include" : "Exclude", shortcut: "⌫", disabled: !groups.length, run: exclude },
+ {
+ id: "exclude",
+ label: excludedAll ? "Include" : "Exclude",
+ shortcut: "⌫",
+ disabled: !groups.length,
+ run: exclude,
+ },
...(replaceMode
? [
{
@@ -316,7 +350,12 @@ function FindTabView({ tab }: { tab: FindTab }) {
disabled: busy || !pendingUsages(groups, marks).length,
run: () => void replace(pendingUsages(groups, marks)),
},
- { id: "preview", label: "Preview Replacement", disabled: busy || !groups.length, run: () => void preview() },
+ {
+ id: "preview",
+ label: "Preview Replacement",
+ disabled: busy || !groups.length,
+ run: () => void preview(),
+ },
]
: []),
]);
@@ -332,8 +371,9 @@ function FindTabView({ tab }: { tab: FindTab }) {
<Dialog
open={!!confirm}
onClose={() => setConfirm(null)}
- width={420}
+ width={460}
title="Replace All"
+ icon="question"
buttons={[
{
label: "Replace",
@@ -373,7 +413,9 @@ function FindNodeContent({ node, state, tab }: { node: Node; state: TreeRowState
<span className={styles.node}>
<Icon name={state.expanded ? "folder-open" : "folder"} size={14} className={styles.icon} />
<span className={styles.label}>{node.label}</span>
- <span className={styles.meta}>{node.count} {node.count === 1 ? "match" : "matches"}</span>
+ <span className={styles.meta}>
+ {node.count} {node.count === 1 ? "match" : "matches"}
+ </span>
</span>
);
case "file":
diff --git a/src/features/search/find/parts.tsx b/src/features/search/find/parts.tsx
index 1a3c4f1bb..67ee39295 100644
--- a/src/features/search/find/parts.tsx
+++ b/src/features/search/find/parts.tsx
@@ -5,6 +5,7 @@ import { previewReplacement } from "./session";
import { loadPreviewText } from "./preview";
import type { PreviewLine } from "./replaceFlow";
import styles from "./parts.module.css";
+import { T } from "@/ui";
/** A result line with matches highlighted; in replace mode shows `old → new` inline. */
export function MatchText({
@@ -104,7 +105,12 @@ export function CodePreview({
}
}, [current, line]);
- if (!path) return <div className={clsx(styles.preview, styles.previewEmpty)}>Select a result to preview</div>;
+ if (!path)
+ return (
+ <div className={clsx(styles.preview, styles.previewEmpty)}>
+ <T>Select a result to preview</T>
+ </div>
+ );
if (error && !current) return <div className={clsx(styles.preview, styles.previewEmpty)}>{error}</div>;
if (!current) return <div className={styles.preview} />;
@@ -117,7 +123,9 @@ export function CodePreview({
rows.push(
<div key={n} data-line={n} className={clsx(styles.codeLine, n === line && styles.currentLine)}>
<span className={styles.gutter}>{n + 1}</span>
- <span className={styles.code}>{ranges ? <MatchText text={content} ranges={ranges} active={n === line} /> : content || " "}</span>
+ <span className={styles.code}>
+ {ranges ? <MatchText text={content} ranges={ranges} active={n === line} /> : content || " "}
+ </span>
</div>,
);
}
@@ -148,7 +156,11 @@ export function ReplaceDiffPreview({ lines, line }: { lines: readonly PreviewLin
key={from + i}
data-focus={from + i === focus ? "" : undefined}
data-kind={l.kind}
- className={clsx(styles.codeLine, l.kind === "del" && styles.lineDeleted, l.kind === "add" && styles.lineAdded)}
+ className={clsx(
+ styles.codeLine,
+ l.kind === "del" && styles.lineDeleted,
+ l.kind === "add" && styles.lineAdded,
+ )}
>
<span className={styles.gutter}>{l.line + 1}</span>
<span className={styles.sign}>{l.kind === "del" ? "-" : l.kind === "add" ? "+" : " "}</span>
diff --git a/src/features/search/recent/RecentPopups.tsx b/src/features/search/recent/RecentPopups.tsx
index 44781ce8d..d13ccaf20 100644
--- a/src/features/search/recent/RecentPopups.tsx
+++ b/src/features/search/recent/RecentPopups.tsx
@@ -4,7 +4,7 @@ import { editorsFor, getNavigationHistory } from "@/editor/api";
import { call, commands } from "@/platform/ipc";
import { shortcutLabel } from "@/platform/keymap";
import { useProject } from "@/platform/project";
-import { Checkbox, Dialog, HighlightedText, Icon, List, fileIconName, listNavigate } from "@/ui";
+import { Checkbox, Dialog, HighlightedText, Icon, List, fileIconName, listNavigate, T } from "@/ui";
import {
maybeEditorService,
toolWindowService,
@@ -15,7 +15,13 @@ import {
import { basename, openLocation } from "../common/open";
import { fromNavigationHistory, mergeLocations, type RecentLocation } from "../common/locations";
import { useTracking } from "../common/tracking";
-import { filterLocations, filterRecentFiles, initialFileIndex, switcherToolWindows, type RecentFileItem } from "./model";
+import {
+ filterLocations,
+ filterRecentFiles,
+ initialFileIndex,
+ switcherToolWindows,
+ type RecentFileItem,
+} from "./model";
import { cycleSwitcher, hideRecentPopup, showRecentPopup, useRecentPopup } from "./store";
import styles from "./RecentPopups.module.css";
@@ -67,7 +73,9 @@ function RecentFilesDialog() {
[paths, query, root, edited, editedOnly],
);
const tools = useMemo(() => switcherToolWindows(toolWindows.values(), !!root, query), [toolWindows, root, query]);
- const fIndex = files.length ? Math.min(fileIndex ?? initialFileIndex(files, activePath, query), files.length - 1) : -1;
+ const fIndex = files.length
+ ? Math.min(fileIndex ?? initialFileIndex(files, activePath, query), files.length - 1)
+ : -1;
const tIndex = tools.length ? Math.min(toolIndex, tools.length - 1) : -1;
const effectiveColumn = column === "files" && !files.length && tools.length ? "tools" : column;
@@ -119,7 +127,15 @@ function RecentFilesDialog() {
if (e.key === "Tab" || ((e.key === "ArrowLeft" || e.key === "ArrowRight") && !query)) {
e.preventDefault();
e.stopPropagation();
- setColumn(e.key === "ArrowLeft" ? "tools" : e.key === "ArrowRight" ? "files" : effectiveColumn === "files" ? "tools" : "files");
+ setColumn(
+ e.key === "ArrowLeft"
+ ? "tools"
+ : e.key === "ArrowRight"
+ ? "files"
+ : effectiveColumn === "files"
+ ? "tools"
+ : "files",
+ );
return;
}
if (!NAV_KEYS.includes(e.key)) return;
@@ -136,7 +152,7 @@ function RecentFilesDialog() {
const recentShortcut = shortcutLabel("navigate.recentFiles");
const locationsShortcut = shortcutLabel("navigate.recentLocations");
const title = editedOnly ? "Recently Edited Files" : "Recent Files";
- const footerPath = selected?.path ?? (selectedTool ? "" : root ?? "");
+ const footerPath = selected?.path ?? (selectedTool ? "" : (root ?? ""));
return (
<Dialog open onClose={hideRecentPopup} width={720} aria-label="Recent Files" className={styles.dialog}>
<header className={styles.header}>
@@ -165,11 +181,7 @@ function RecentFilesDialog() {
showRecentPopup("files");
inputRef.current?.focus();
}}
- label={
- <>
- Show edited only {recentShortcut && <span className={styles.hint}>{recentShortcut}</span>}
- </>
- }
+ label={<>Show edited only {recentShortcut && <span className={styles.hint}>{recentShortcut}</span>}</>}
/>
</header>
<div className={styles.columns}>
@@ -188,8 +200,14 @@ function RecentFilesDialog() {
aria-label="Tool windows"
renderItem={(t) => <ToolRow tw={t.tw} indices={t.indices} />}
/>
- <button type="button" className={styles.locationsLink} onClick={() => afterClose(() => showRecentPopup("locations"))}>
- <span className={styles.name}>Recent Locations</span>
+ <button
+ type="button"
+ className={styles.locationsLink}
+ onClick={() => afterClose(() => showRecentPopup("locations"))}
+ >
+ <span className={styles.name}>
+ <T>Recent Locations</T>
+ </span>
{locationsShortcut && <span className={styles.shortcut}>{locationsShortcut}</span>}
</button>
</div>
@@ -206,7 +224,9 @@ function RecentFilesDialog() {
focusable={false}
rowHeight={24}
aria-label="Recent files"
- empty={paths && <span>{editedOnly ? "No edited files" : query ? "No matching files" : "No recent files"}</span>}
+ empty={
+ paths && <span>{editedOnly ? "No edited files" : query ? "No matching files" : "No recent files"}</span>
+ }
renderItem={(f) => <RecentFileRow item={f} current={f.path === activePath} />}
/>
</div>
@@ -236,7 +256,10 @@ function RecentFileRow({ item, current }: { item: RecentFileItem; current: boole
return (
<>
<Icon name={fileIconName(item.name)} size={16} className={styles.icon} />
- <span className={clsx(styles.name, current && styles.current)} style={deco.color ? { color: deco.color } : undefined}>
+ <span
+ className={clsx(styles.name, current && styles.current)}
+ style={deco.color ? { color: deco.color } : undefined}
+ >
<HighlightedText text={item.name} indices={item.indices} tone="strong" />
</span>
<span className={styles.dir}>{item.dir}</span>
@@ -292,7 +315,10 @@ function RecentLocationsDialog() {
const source = useMemo(() => {
return withSnippets(mergeLocations(navigationHistory(), recorded), recorded);
}, [recorded]);
- const items = useMemo(() => filterLocations(source, query, { changedOnly, root }), [source, query, changedOnly, root]);
+ const items = useMemo(
+ () => filterLocations(source, query, { changedOnly, root }),
+ [source, query, changedOnly, root],
+ );
const active = items.length ? Math.min(index, items.length - 1) : -1;
const open = (l: RecentLocation | undefined, side = false) => {
@@ -341,7 +367,7 @@ function RecentLocationsDialog() {
}}
label={
<>
- Show changed only <span className={styles.hint}>{shortcutLabel("navigate.recentLocations")}</span>
+ <T>Show changed only</T> <span className={styles.hint}>{shortcutLabel("navigate.recentLocations")}</span>
</>
}
/>
diff --git a/src/features/search/structure/StructureView.tsx b/src/features/search/structure/StructureView.tsx
index 499d9ca72..57b29dec0 100644
--- a/src/features/search/structure/StructureView.tsx
+++ b/src/features/search/structure/StructureView.tsx
@@ -14,10 +14,20 @@ import {
fileIconName,
listNavigate,
type TreeHandle,
+ T,
} from "@/ui";
import { badgeKind, basename, openLocation } from "../common/open";
import { useTracking } from "../common/tracking";
-import { allKeys, bestRow, flattenOutline, keyOutline, sortOutline, symbolPathAt, type FlatOutlineRow, type OutlineNode } from "./outline";
+import {
+ allKeys,
+ bestRow,
+ flattenOutline,
+ keyOutline,
+ sortOutline,
+ symbolPathAt,
+ type FlatOutlineRow,
+ type OutlineNode,
+} from "./outline";
import { useLiveOutline, useOutline, useStructureOptions } from "./store";
import styles from "./StructureView.module.css";
@@ -89,7 +99,12 @@ export function StructureView() {
revealing.current = false;
}, [caretKey, caretPath, collapsed]);
- if (!path) return <EmptyState>No structure to show</EmptyState>;
+ if (!path)
+ return (
+ <EmptyState>
+ <T>No structure to show</T>
+ </EmptyState>
+ );
if (!items) {
return error ? (
<EmptyState title="Structure unavailable">{error}</EmptyState>
@@ -123,7 +138,11 @@ export function StructureView() {
<span className={styles.node}>
<Icon name={fileIconName(n.name)} size={16} className={styles.badge} />
<HighlightedText className={styles.name} text={n.name} indices={s.matches} tone="strong" />
- {!n.children.length && <span className={styles.detail}>no symbols</span>}
+ {!n.children.length && (
+ <span className={styles.detail}>
+ <T>no symbols</T>
+ </span>
+ )}
</span>
) : (
<span className={styles.node}>
@@ -213,7 +232,10 @@ function FileStructureDialog() {
if (query) return Math.max(0, bestRow(rows));
if (!caret || caret.path !== path) return 0;
const key = symbolPathAt(nodes, { line: caret.line, col: caret.col }).pop();
- return Math.max(0, rows.findIndex((r) => r.node.key === key));
+ return Math.max(
+ 0,
+ rows.findIndex((r) => r.node.key === key),
+ );
}, [rows, nodes, query, caret, path]);
const active = rows.length ? Math.min(index ?? initial, rows.length - 1) : -1;
@@ -289,7 +311,12 @@ function FileStructureDialog() {
renderItem={(r, s) => (
<span className={clsx(styles.node, !r.matched && styles.ancestor)} style={{ paddingLeft: r.depth * 14 }}>
<SymbolBadge kind={badgeKind(r.node.item.kind)} className={styles.badge} />
- <HighlightedText className={styles.name} text={r.node.item.name} indices={r.indices} tone={s.active ? "accent" : "strong"} />
+ <HighlightedText
+ className={styles.name}
+ text={r.node.item.name}
+ indices={r.indices}
+ tone={s.active ? "accent" : "strong"}
+ />
{r.node.item.detail && <span className={styles.detail}>{r.node.item.detail}</span>}
</span>
)}
diff --git a/src/features/services/Services.module.css b/src/features/services/Services.module.css
index e2e9439c4..a425f2f7a 100644
--- a/src/features/services/Services.module.css
+++ b/src/features/services/Services.module.css
@@ -152,12 +152,6 @@
color: var(--fg-secondary);
font-size: var(--fs-small);
}
-.message {
- color: var(--fg);
- line-height: 1.5;
- white-space: pre-wrap;
-}
-
/* Dockerfile / Compose gutter run icons */
.gutter {
width: 14px;
diff --git a/src/features/services/ServicesView.tsx b/src/features/services/ServicesView.tsx
index 0a5b95136..8da42458e 100644
--- a/src/features/services/ServicesView.tsx
+++ b/src/features/services/ServicesView.tsx
@@ -17,9 +17,22 @@ import {
Tree,
showContextMenu,
type TreeRowState,
+ T,
} from "@/ui";
import { childrenOf, findNode, nodeDetail, nodeIcon, nodeLabel, rootNodes, isRunning, type ServiceNode } from "./model";
-import { canRemove, canStart, canStop, execShell, nodeMenu, pullPrompt, pruneMenu, remove, restart, start, stop } from "./ops";
+import {
+ canRemove,
+ canStart,
+ canStop,
+ execShell,
+ nodeMenu,
+ pullPrompt,
+ pruneMenu,
+ remove,
+ restart,
+ start,
+ stop,
+} from "./ops";
import { cancelTask, errorMessage, refresh, useServices, watch } from "./store";
import styles from "./Services.module.css";
@@ -28,20 +41,20 @@ function Unavailable({ availability }: { availability: DockerAvailability }) {
if (availability.kind === "notInstalled")
return (
<EmptyState title="Docker is not installed">
- Install Docker Desktop, OrbStack, Colima or the Docker Engine and make sure <code>docker</code> is on PATH.
+ <T>Install Docker Desktop, OrbStack, Colima or the Docker Engine and make sure</T> <code>docker</code>{" "}
+ <T>is on PATH.</T>
</EmptyState>
);
if (availability.kind === "daemonDown")
return (
<EmptyState
title="Docker is not running"
- actions={
- <IconButton icon="refresh" title="Retry" onClick={() => void refresh()} />
- }
+ actions={<IconButton icon="refresh" title="Retry" onClick={() => void refresh()} />}
>
<div>{availability.message}</div>
<div className={styles.hint}>
- Start Docker{availability.context ? ` (context '${availability.context}')` : ""}; this view connects automatically.
+ Start Docker{availability.context ? ` (context '${availability.context}')` : ""}; this view connects
+ automatically.
</div>
</EmptyState>
);
@@ -54,7 +67,9 @@ function Row({ node, state }: { node: ServiceNode; state: TreeRowState }) {
return (
<span className={styles.row}>
<Icon name={nodeIcon(node)} size={16} className={styles.icon} />
- <span className={clsx(styles.label, state.selected && styles.selectedLabel, dim && styles.dim)}>{nodeLabel(node)}</span>
+ <span className={clsx(styles.label, state.selected && styles.selectedLabel, dim && styles.dim)}>
+ {nodeLabel(node)}
+ </span>
{detail && <span className={styles.detail}>{detail}</span>}
</span>
);
@@ -65,14 +80,53 @@ function Toolbar({ node }: { node: ServiceNode | null }) {
const container = node?.kind === "container" ? node.container : null;
return (
<div className={styles.toolbar} role="toolbar" aria-label="Services actions">
- {loading ? <Spinner size={14} /> : <IconButton icon="refresh" size="small" iconSize={16} action="docker.refresh" />}
+ {loading ? (
+ <Spinner size={14} />
+ ) : (
+ <IconButton icon="refresh" size="small" iconSize={16} action="docker.refresh" />
+ )}
<span className={styles.sep} />
- <IconButton icon="run" size="small" iconSize={16} title="Start" disabled={!canStart(node)} onClick={() => void start(node)} />
- <IconButton icon="stop" size="small" iconSize={16} title="Stop" disabled={!canStop(node)} onClick={() => void stop(node)} />
- <IconButton icon="rerun" size="small" iconSize={16} title="Restart" disabled={!node || !(node.kind === "container" || node.kind === "compose")} onClick={() => void restart(node)} />
- <IconButton icon="trash" size="small" iconSize={16} title="Delete" disabled={!canRemove(node)} onClick={() => void remove(node)} />
+ <IconButton
+ icon="run"
+ size="small"
+ iconSize={16}
+ title="Start"
+ disabled={!canStart(node)}
+ onClick={() => void start(node)}
+ />
+ <IconButton
+ icon="stop"
+ size="small"
+ iconSize={16}
+ title="Stop"
+ disabled={!canStop(node)}
+ onClick={() => void stop(node)}
+ />
+ <IconButton
+ icon="rerun"
+ size="small"
+ iconSize={16}
+ title="Restart"
+ disabled={!node || !(node.kind === "container" || node.kind === "compose")}
+ onClick={() => void restart(node)}
+ />
+ <IconButton
+ icon="trash"
+ size="small"
+ iconSize={16}
+ title="Delete"
+ disabled={!canRemove(node)}
+ onClick={() => void remove(node)}
+ />
<span className={styles.sep} />
- <IconButton icon="terminal" size="small" iconSize={16} title="Create Terminal" disabled={!container || !isRunning(container)} onClick={() => execShell(node)} />
+ <IconButton
+ icon="terminal"
+ size="small"
+ iconSize={16}
+ title="Create Terminal"
+ disabled={!container || !isRunning(container)}
+ onClick={() => execShell(node)}
+ />
<IconButton icon="git-pull" size="small" iconSize={16} title="Pull Image…" onClick={() => void pullPrompt()} />
<IconButton
icon="trash"
@@ -232,12 +286,21 @@ function Detail({ node }: { node: ServiceNode | null }) {
{a.context ? ` · context ${a.context}` : ""}
</div>
)}
- <div className={styles.hint}>Select a container, image, volume or network.</div>
+ <div className={styles.hint}>
+ <T>Select a container, image, volume or network.</T>
+ </div>
</EmptyState>
);
}
const object: DockerObject = node.kind;
- const id = node.kind === "container" ? node.container.id : node.kind === "image" ? node.image.id : node.kind === "volume" ? node.volume.name : node.network.id;
+ const id =
+ node.kind === "container"
+ ? node.container.id
+ : node.kind === "image"
+ ? node.image.id
+ : node.kind === "volume"
+ ? node.volume.name
+ : node.network.id;
const showLog = node.kind === "container" && tab === "log";
return (
<div className={styles.detailPane}>
@@ -246,9 +309,16 @@ function Detail({ node }: { node: ServiceNode | null }) {
activeId={showLog ? "log" : "inspect"}
onSelect={(t) => useServices.setState({ detailTab: t as "log" | "inspect" })}
aria-label="Details"
- items={[...(node.kind === "container" ? [{ id: "log", label: "Log" }] : []), { id: "inspect", label: "Inspect" }]}
+ items={[
+ ...(node.kind === "container" ? [{ id: "log", label: "Log" }] : []),
+ { id: "inspect", label: "Inspect" },
+ ]}
/>
- {showLog ? <LogView key={id} id={id} running={isRunning(node.container)} /> : <InspectView key={id} object={object} id={id} />}
+ {showLog ? (
+ <LogView key={id} id={id} running={isRunning(node.container)} />
+ ) : (
+ <InspectView key={id} object={object} id={id} />
+ )}
</div>
);
}
@@ -265,7 +335,15 @@ export function ServicesView() {
const node = useMemo(() => findNode(snapshot, selectedKey), [snapshot, selectedKey]);
if (!snapshot)
- return <div className={styles.loading}>{error ?? <><Spinner size={14} /> Connecting to Docker…</>}</div>;
+ return (
+ <div className={styles.loading}>
+ {error ?? (
+ <>
+ <Spinner size={14} /> <T>Connecting to Docker…</T>
+ </>
+ )}
+ </div>
+ );
const ready = snapshot.availability.kind === "ready";
return (
diff --git a/src/features/services/dialogs.tsx b/src/features/services/dialogs.tsx
index 7bfbc563f..2d4b3f6b5 100644
--- a/src/features/services/dialogs.tsx
+++ b/src/features/services/dialogs.tsx
@@ -45,7 +45,12 @@ export function promptText(title: string, label: string, placeholder: string): P
);
}
-function PromptDialog(props: { title: string; label: string; placeholder: string; onDone: (v: string | null) => void }) {
+function PromptDialog(props: {
+ title: string;
+ label: string;
+ placeholder: string;
+ onDone: (v: string | null) => void;
+}) {
const [value, setValue] = useState("");
const ok = value.trim().length > 0;
return (
@@ -67,14 +72,26 @@ function PromptDialog(props: { title: string; label: string; placeholder: string
}}
>
<label className={styles.fieldLabel}>{props.label}</label>
- <Input data-autofocus mono aria-label={props.label} placeholder={props.placeholder} value={value} onChange={(e) => setValue(e.target.value)} />
+ <Input
+ data-autofocus
+ mono
+ aria-label={props.label}
+ placeholder={props.placeholder}
+ value={value}
+ onChange={(e) => setValue(e.target.value)}
+ />
</form>
</Dialog>
);
}
/** Confirmation with an optional checkbox; resolves `null` when cancelled, else the checkbox state. */
-export function confirm(opts: { title: string; message: ReactNode; ok: string; checkbox?: string }): Promise<{ checked: boolean } | null> {
+export function confirm(opts: {
+ title: string;
+ message: ReactNode;
+ ok: string;
+ checkbox?: string;
+}): Promise<{ checked: boolean } | null> {
return new Promise((resolve) =>
open((close) => {
const done = (r: { checked: boolean } | null) => {
@@ -86,23 +103,28 @@ export function confirm(opts: { title: string; message: ReactNode; ok: string; c
);
}
-function ConfirmDialog(props: { title: string; message: ReactNode; ok: string; checkbox?: string; onDone: (r: { checked: boolean } | null) => void }) {
+function ConfirmDialog(props: {
+ title: string;
+ message: ReactNode;
+ ok: string;
+ checkbox?: string;
+ onDone: (r: { checked: boolean } | null) => void;
+}) {
const [checked, setChecked] = useState(false);
return (
<Dialog
open
title={props.title}
+ icon="question"
onClose={() => props.onDone(null)}
- width={440}
+ width={460}
+ footerStart={props.checkbox && <Checkbox checked={checked} onChange={setChecked} label={props.checkbox} />}
buttons={[
{ label: props.ok, role: "default", autoFocus: true, onClick: () => props.onDone({ checked }) },
{ label: "Cancel", role: "cancel" },
]}
>
- <div className={styles.form}>
- <div className={styles.message}>{props.message}</div>
- {props.checkbox && <Checkbox checked={checked} onChange={setChecked} label={props.checkbox} />}
- </div>
+ {props.message}
</Dialog>
);
}
diff --git a/src/features/settings/components/Form.tsx b/src/features/settings/components/Form.tsx
index dd40b2df8..920ee58c9 100644
--- a/src/features/settings/components/Form.tsx
+++ b/src/features/settings/components/Form.tsx
@@ -5,15 +5,17 @@
*/
import { useId, useRef, useState, type KeyboardEvent, type ReactNode } from "react";
import clsx from "clsx";
-import { Checkbox, IconButton, Input, Select as UiSelect, type SelectOption } from "@/ui";
+import { Checkbox, IconButton, Input, Select as UiSelect, type SelectOption, T } from "@/ui";
+import { tx, useTx } from "@/platform/i18n";
import { highlightIndices } from "../model/pages";
import { HEX_COLOR } from "../model/schema";
import { useLabelMatch, useSearchQuery, useSetting } from "./context";
import styles from "./Form.module.css";
/** Text with search matches marked. */
-export function SearchLabel({ text, className }: { text: string; className?: string }) {
+export function SearchLabel({ text: source, className }: { text: string; className?: string }) {
const q = useSearchQuery();
+ const text = useTx()(source);
const hits = highlightIndices(text, q);
if (!hits) return <span className={className}>{text}</span>;
const parts: ReactNode[] = [];
@@ -41,7 +43,7 @@ export function SearchLabel({ text, className }: { text: string; className?: str
export function Section({ title, children, className }: { title?: string; children: ReactNode; className?: string }) {
return (
- <section className={clsx(styles.section, className)} aria-label={title}>
+ <section className={clsx(styles.section, className)} aria-label={tx(title)}>
{title && (
<div className={styles.sectionTitle}>
<SearchLabel text={title} />
@@ -75,7 +77,7 @@ export function Row({ label, hint, children, htmlFor, stacked, className }: RowP
<SearchLabel text={label} />
</label>
<div className={styles.control}>{children}</div>
- {hint && <div className={styles.hint}>{hint}</div>}
+ {hint && <div className={styles.hint}>{typeof hint === "string" ? <T>{hint}</T> : hint}</div>}
</div>
);
}
@@ -97,7 +99,9 @@ export function Toggle({ label, checked, onChange, hint, disabled }: ToggleProps
data-search-match={matched || undefined}
>
<Checkbox checked={checked} onChange={onChange} disabled={disabled} label={<SearchLabel text={label} />} />
- {hint && <div className={clsx(styles.hint, styles.toggleHint)}>{hint}</div>}
+ {hint && (
+ <div className={clsx(styles.hint, styles.toggleHint)}>{typeof hint === "string" ? <T>{hint}</T> : hint}</div>
+ )}
</div>
);
}
@@ -353,7 +357,11 @@ export function GlobListEditor({ value, onChange, placeholder = "**/pattern", ..
aria-activedescendant={selected !== null ? `${listId}-${selected}` : undefined}
onKeyDown={onListKey}
>
- {rows.length === 0 && <li className={styles.globEmpty}>No patterns</li>}
+ {rows.length === 0 && (
+ <li className={styles.globEmpty}>
+ <T>No patterns</T>
+ </li>
+ )}
{rows.map((glob, i) => (
<li
key={i}
diff --git a/src/features/settings/dialog/SettingsDialog.tsx b/src/features/settings/dialog/SettingsDialog.tsx
index 4bebab24a..28e58d357 100644
--- a/src/features/settings/dialog/SettingsDialog.tsx
+++ b/src/features/settings/dialog/SettingsDialog.tsx
@@ -10,7 +10,18 @@ import { useMemo, useRef, useState } from "react";
import clsx from "clsx";
import { useProject } from "@/platform/project";
import { useSettingsPages, type SettingsPageContribution } from "@/workbench/contributions";
-import { Dialog, DialogButtons, EmptyState, Icon, IconButton, SearchField, Tree, type DialogButton, type TreeHandle } from "@/ui";
+import {
+ Dialog,
+ DialogButtons,
+ EmptyState,
+ Icon,
+ IconButton,
+ SearchField,
+ Tree,
+ type DialogButton,
+ type TreeHandle,
+ T,
+} from "@/ui";
import { PageContext } from "../components/context";
import { SearchLabel } from "../components/Form";
import { breadcrumb, buildPageTree, filterPageTree, flatten, groupKey, type PageNode } from "../model/pages";
@@ -28,6 +39,7 @@ import {
import { builtinSpec, pageLabels } from "../pages/registry";
import { PageErrorBoundary } from "./PageErrorBoundary";
import styles from "./SettingsDialog.module.css";
+import { tx } from "@/platform/i18n";
function firstPage(nodes: readonly PageNode[]): string | null {
const list = flatten(nodes).filter((n) => n.page);
@@ -101,13 +113,15 @@ function PageHost({
{crumbs.map((c, i) => (
<span key={i} className={styles.crumb}>
{i > 0 && <Icon name="chevron-right" size={12} className={styles.crumbSep} />}
- <span>{c}</span>
+ <span>
+ <T>{c}</T>
+ </span>
</span>
))}
</div>
{dirty && (
<button type="button" className={styles.reset} onClick={onReset}>
- Reset
+ <T>Reset</T>
</button>
)}
{projectScope && <ScopeSwitch pageId={pageId} scope={scope} />}
@@ -125,7 +139,7 @@ function PageHost({
{scope === "project" && (
<div className={styles.scopeNote}>
<Icon name="info" size={14} />
- Saved to .openidea/settings.toml in this project; overrides the global value.
+ <T>Saved to .openidea/settings.toml in this project; overrides the global value.</T>
</div>
)}
<div className={styles.pageBody}>
@@ -223,7 +237,7 @@ export function SettingsLayout() {
aria-label="Settings pages"
roots={filtered}
getKey={(n) => n.key}
- getLabel={(n) => n.title}
+ getLabel={(n) => tx(n.title)}
getChildren={(n) => (n.children.length ? n.children : undefined)}
isExpandable={(n) => n.children.length > 0}
defaultExpanded={all.filter((n) => n.children.length).map((n) => n.key)}
@@ -233,7 +247,11 @@ export function SettingsLayout() {
multiSelect={false}
speedSearch={false}
rowHeight={24}
- empty={<div className={styles.noMatch}>No matches</div>}
+ empty={
+ <div className={styles.noMatch}>
+ <T>No matches</T>
+ </div>
+ }
renderNode={(n) => (
<span
className={clsx(
diff --git a/src/features/settings/keymap/Keymap.module.css b/src/features/settings/keymap/Keymap.module.css
index 9b3d7c6b3..3118172f7 100644
--- a/src/features/settings/keymap/Keymap.module.css
+++ b/src/features/settings/keymap/Keymap.module.css
@@ -225,7 +225,3 @@
font-size: var(--fs-small);
padding-left: 128px;
}
-.confirmMessage {
- color: var(--fg);
- line-height: 1.5;
-}
diff --git a/src/features/settings/keymap/KeymapDialogs.tsx b/src/features/settings/keymap/KeymapDialogs.tsx
index 785a4caae..ceb4ad64f 100644
--- a/src/features/settings/keymap/KeymapDialogs.tsx
+++ b/src/features/settings/keymap/KeymapDialogs.tsx
@@ -1,6 +1,6 @@
/** Small modal dialogs of the Keymap page: keymap name (Duplicate / Rename) and confirmations. */
import { useId, useState, type ReactNode } from "react";
-import { Dialog, Input } from "@/ui";
+import { Dialog, Input, type MessageIconKind, T } from "@/ui";
import { validateKeymapName, type CustomKeymaps } from "./model";
import styles from "./Keymap.module.css";
@@ -37,7 +37,7 @@ export function KeymapNameDialog({
<div className={styles.recordBody}>
<div className={styles.recordRow}>
<label className={styles.recordLabel} htmlFor={id}>
- Name:
+ <T>Name:</T>
</label>
<Input
id={id}
@@ -65,6 +65,7 @@ export function ConfirmDialog({
message,
confirm,
extra,
+ icon = "question",
onCancel,
onConfirm,
children,
@@ -72,6 +73,7 @@ export function ConfirmDialog({
title: string;
message: ReactNode;
confirm: string;
+ icon?: MessageIconKind;
/** Optional second choice next to the primary button (IDEA's "Leave"). */
extra?: { label: string; run: () => void };
onCancel: () => void;
@@ -83,17 +85,16 @@ export function ConfirmDialog({
open
onClose={onCancel}
title={title}
- width={420}
+ icon={icon}
+ width={460}
buttons={[
{ label: confirm, role: "default", autoFocus: true, onClick: onConfirm },
...(extra ? [{ label: extra.label, onClick: extra.run }] : []),
{ label: "Cancel", role: "cancel" as const },
]}
>
- <div className={styles.recordBody}>
- <div className={styles.confirmMessage}>{message}</div>
- {children}
- </div>
+ {message}
+ {children}
</Dialog>
);
}
diff --git a/src/features/settings/keymap/KeymapPage.tsx b/src/features/settings/keymap/KeymapPage.tsx
index 9d190e56b..11d2bc3ef 100644
--- a/src/features/settings/keymap/KeymapPage.tsx
+++ b/src/features/settings/keymap/KeymapPage.tsx
@@ -22,6 +22,7 @@ import {
wordMatch,
type MenuItem,
type SelectOption,
+ T,
} from "@/ui";
import { useSetting } from "../components/context";
import { useSettingsDialog } from "../model/staging";
@@ -367,7 +368,11 @@ export function KeymapPage() {
e.preventDefault();
showContextMenu(e, menuFor(n.action));
}}
- empty={<div className={styles.empty}>Nothing to show</div>}
+ empty={
+ <div className={styles.empty}>
+ <T>Nothing to show</T>
+ </div>
+ }
renderNode={(n, state) =>
n.kind === "group" ? (
<span className={styles.catRow}>
diff --git a/src/features/settings/keymap/RecordShortcutDialog.tsx b/src/features/settings/keymap/RecordShortcutDialog.tsx
index e9edb6cc7..b201db4ff 100644
--- a/src/features/settings/keymap/RecordShortcutDialog.tsx
+++ b/src/features/settings/keymap/RecordShortcutDialog.tsx
@@ -4,7 +4,7 @@
* other assignments (Remove / Leave / Cancel).
*/
import { useMemo, useState } from "react";
-import { Checkbox, Dialog, Icon, Kbd } from "@/ui";
+import { Checkbox, Dialog, Icon, Kbd, T } from "@/ui";
import type { Action } from "@/platform/actions";
import { normalizeBinding } from "@/platform/keymap";
import { findConflicts, resolveBindings, type Conflict, type KeymapDraft } from "./model";
@@ -61,7 +61,9 @@ export function RecordShortcutDialog({ action, actions, draft, onCancel, onSubmi
>
<div className={styles.recordBody}>
<div className={styles.recordRow}>
- <span className={styles.recordLabel}>First stroke:</span>
+ <span className={styles.recordLabel}>
+ <T>First stroke:</T>
+ </span>
<StrokeRecorder autoFocus value={first} onChange={setFirst} aria-label="First stroke" />
</div>
<div className={styles.recordRow}>
@@ -75,19 +77,33 @@ export function RecordShortcutDialog({ action, actions, draft, onCancel, onSubmi
/>
</div>
<div className={styles.recordHint}>
- Keys are recorded as pressed, including Tab and Esc. Use the buttons to finish.
+ <T>Keys are recorded as pressed, including Tab and Esc. Use the buttons to finish.</T>
+ </div>
+ <div className={styles.conflictsLabel}>
+ <T>Conflicts:</T>
</div>
- <div className={styles.conflictsLabel}>Conflicts:</div>
<div className={styles.conflicts} aria-live="polite">
- {already && <span className={styles.noConflicts}>The action already has this shortcut</span>}
- {!already && binding && conflicts.length === 0 && <span className={styles.noConflicts}>No conflicts</span>}
- {!binding && <span className={styles.noConflicts}>Press a shortcut</span>}
+ {already && (
+ <span className={styles.noConflicts}>
+ <T>The action already has this shortcut</T>
+ </span>
+ )}
+ {!already && binding && conflicts.length === 0 && (
+ <span className={styles.noConflicts}>
+ <T>No conflicts</T>
+ </span>
+ )}
+ {!binding && (
+ <span className={styles.noConflicts}>
+ <T>Press a shortcut</T>
+ </span>
+ )}
{conflicts.length > 0 && (
<>
<div className={styles.conflictTitle}>
<Icon name="warning" size={14} className={styles.conflictIcon} />
<span>
- <Kbd binding={binding} /> is already assigned to:
+ <Kbd binding={binding} /> <T>is already assigned to:</T>
</span>
</div>
<ConflictList conflicts={conflicts} />
@@ -99,6 +115,7 @@ export function RecordShortcutDialog({ action, actions, draft, onCancel, onSubmi
{asking && (
<ConfirmDialog
title="Warning"
+ icon="warning"
message="The shortcut is already assigned to other actions. Do you want to remove other assignments?"
confirm="Remove"
extra={{ label: "Leave", run: () => submit(false) }}
@@ -122,7 +139,11 @@ function ConflictList({ conflicts }: { conflicts: readonly Conflict[] }) {
({groupPath({ id: c.actionId, category: c.category }).join(" | ")})
</span>
<span className={styles.spacer} />
- {c.kind === "prefix" && <span className={styles.conflictCategory}>chord prefix</span>}
+ {c.kind === "prefix" && (
+ <span className={styles.conflictCategory}>
+ <T>chord prefix</T>
+ </span>
+ )}
<Kbd binding={c.binding} />
</li>
))}
diff --git a/src/features/settings/languages/AddInterpreterDialog.tsx b/src/features/settings/languages/AddInterpreterDialog.tsx
index 83a147584..cfd9914af 100644
--- a/src/features/settings/languages/AddInterpreterDialog.tsx
+++ b/src/features/settings/languages/AddInterpreterDialog.tsx
@@ -4,7 +4,7 @@
*/
import { isCancelled } from "@/platform/ipc";
import { useId, useMemo, useState } from "react";
-import { Dialog, IconButton, Input, Select, Spinner, type SelectOption } from "@/ui";
+import { Dialog, IconButton, Input, Select, Spinner, type SelectOption, T } from "@/ui";
import { choosePath, createVenv, rememberSdk } from "./api";
import { tildify, useDetected } from "./components";
import styles from "./Sdk.module.css";
@@ -83,14 +83,15 @@ export function AddInterpreterDialog({
<ul className={styles.kinds} aria-label="Interpreter type">
<li>
<button type="button" className={`${styles.kind} ${styles.kindOn}`} aria-current="true">
- Virtualenv Environment
+ <T>Virtualenv Environment</T>
</button>
</li>
</ul>
<div className={styles.form}>
<div className={styles.radios} role="radiogroup" aria-label="Environment">
<label className={styles.radio}>
- <input type="radio" name="env" checked={mode === "new"} onChange={() => setMode("new")} /> New environment
+ <input type="radio" name="env" checked={mode === "new"} onChange={() => setMode("new")} />{" "}
+ <T>New environment</T>
</label>
<label className={styles.radio}>
<input type="radio" name="env" checked={mode === "existing"} onChange={() => setMode("existing")} />{" "}
@@ -99,7 +100,9 @@ export function AddInterpreterDialog({
</div>
{mode === "new" ? (
<>
- <label htmlFor={ids.location}>Location:</label>
+ <label htmlFor={ids.location}>
+ <T>Location:</T>
+ </label>
<div className={styles.pathRow}>
<Input
id={ids.location}
@@ -117,7 +120,9 @@ export function AddInterpreterDialog({
}}
/>
</div>
- <label htmlFor={ids.base}>Base interpreter:</label>
+ <label htmlFor={ids.base}>
+ <T>Base interpreter:</T>
+ </label>
<div className={styles.pathRow}>
<Select
className={styles.pathInput}
@@ -143,7 +148,9 @@ export function AddInterpreterDialog({
</>
) : (
<>
- <label htmlFor={ids.existing}>Interpreter:</label>
+ <label htmlFor={ids.existing}>
+ <T>Interpreter:</T>
+ </label>
<div className={styles.pathRow}>
<Select
className={styles.pathInput}
diff --git a/src/features/settings/languages/ProjectStructurePage.tsx b/src/features/settings/languages/ProjectStructurePage.tsx
index d8c6cc993..cb9f47619 100644
--- a/src/features/settings/languages/ProjectStructurePage.tsx
+++ b/src/features/settings/languages/ProjectStructurePage.tsx
@@ -10,7 +10,7 @@
*/
import { useCallback, useEffect, useMemo, useState } from "react";
import clsx from "clsx";
-import { Icon, IconButton, Tree, folderIconName, type FolderKind } from "@/ui";
+import { Icon, IconButton, Tree, folderIconName, type FolderKind, T } from "@/ui";
import { call, commands, isTauri, type FileEntry } from "@/platform/ipc";
import { relativePath, useProject } from "@/platform/project";
import {
@@ -124,7 +124,12 @@ export function ProjectStructurePage() {
};
}, [root]);
- if (!rootNode) return <div className={styles.note}>Open a project to configure its folders.</div>;
+ if (!rootNode)
+ return (
+ <div className={styles.note}>
+ <T>Open a project to configure its folders.</T>
+ </div>
+ );
const role = selected ? rootRole(roots, selected.rel) : null;
const mark = (r: FolderRole) => {
@@ -139,7 +144,9 @@ export function ProjectStructurePage() {
<div className={styles.structure}>
<div className={styles.structureTree}>
<div className={styles.markBar} role="toolbar" aria-label="Mark as">
- <span>Mark as:</span>
+ <span>
+ <T>Mark as:</T>
+ </span>
{ROLES.map((r) => (
<button
key={r.role}
@@ -186,16 +193,18 @@ export function ProjectStructurePage() {
<Icon name={folderIconName(r.kind)} size={14} />
{r.title}
</div>
- {list.length === 0 && <div className={clsx(styles.rootItem, styles.note)}>None</div>}
+ {list.length === 0 && (
+ <div className={clsx(styles.rootItem, styles.note)}>
+ <T>None</T>
+ </div>
+ )}
{list.map((x) => {
const shown = x.path || name || ".";
return (
<div key={x.path} className={styles.rootItem}>
<span className={styles.rootPath} title={x.path || root || undefined}>
{shown}
- {x.detectedFrom && (
- <span className={styles.rootHint}> detected from {x.detectedFrom}</span>
- )}
+ {x.detectedFrom && <span className={styles.rootHint}> detected from {x.detectedFrom}</span>}
</span>
<IconButton
icon="close"
@@ -216,14 +225,16 @@ export function ProjectStructurePage() {
? "1 detected folder is unmarked."
: `${unmarkedDetected.length} detected folders are unmarked.`}{" "}
<button type="button" className={styles.linkButton} onClick={restore}>
- Restore detected roots
+ <T>Restore detected roots</T>
</button>
</div>
)}
<div className={styles.note}>
- Folders are detected from build files (pom.xml, build.gradle, Cargo.toml, go.mod, pyproject.toml,
- package.json); marking or unmarking a folder overrides detection. Excluded folders are skipped by the Project
- view, Find in Files and the index (reopen the project to re-index).
+ <T>
+ {
+ "Folders are detected from build files (pom.xml, build.gradle, Cargo.toml, go.mod, pyproject.toml, package.json); marking or unmarking a folder overrides detection. Excluded folders are skipped by the Project view, Find in Files and the index (reopen the project to re-index)."
+ }
+ </T>
</div>
</div>
</div>
diff --git a/src/features/settings/languages/PythonInterpreterPage.tsx b/src/features/settings/languages/PythonInterpreterPage.tsx
index a2bb7dd44..4fc0b93b4 100644
--- a/src/features/settings/languages/PythonInterpreterPage.tsx
+++ b/src/features/settings/languages/PythonInterpreterPage.tsx
@@ -7,7 +7,7 @@
import { isCancelled } from "@/platform/ipc";
import { useCallback, useEffect, useMemo, useState, type KeyboardEvent, type MouseEvent } from "react";
import clsx from "clsx";
-import { Button, IconButton, Input, Spinner, showContextMenu } from "@/ui";
+import { Button, IconButton, Input, Spinner, showContextMenu, T } from "@/ui";
import { useProject } from "@/platform/project";
import { Section, Toggle } from "../components/Form";
import { effectivePython, listPackages, pip, useSdks, type PythonPackage } from "./api";
@@ -137,7 +137,9 @@ export function PythonInterpreterPage() {
return (
<div className={styles.page}>
<div className={styles.interpreterRow}>
- <span className={styles.interpreterLabel}>Python Interpreter</span>
+ <span className={styles.interpreterLabel}>
+ <T>Python Interpreter</T>
+ </span>
<SdkField
kind="python"
value={interpreter}
@@ -153,7 +155,7 @@ export function PythonInterpreterPage() {
disabled={!root}
title={root ? undefined : "Open a project first"}
>
- Add Interpreter…
+ <T>Add Interpreter…</T>
</Button>
</div>
{python && (
@@ -227,7 +229,7 @@ export function PythonInterpreterPage() {
}}
/>
<Button type="submit" size="small" variant="primary" disabled={!requirement.trim() || !!job}>
- Install Package
+ <T>Install Package</T>
</Button>
</form>
)}
@@ -235,8 +237,12 @@ export function PythonInterpreterPage() {
<table className={styles.table} aria-label="Installed packages">
<thead>
<tr>
- <th scope="col">Package</th>
- <th scope="col">Version</th>
+ <th scope="col">
+ <T>Package</T>
+ </th>
+ <th scope="col">
+ <T>Version</T>
+ </th>
</tr>
</thead>
<tbody>
@@ -256,7 +262,11 @@ export function PythonInterpreterPage() {
))}
</tbody>
</table>
- {!python && <div className={styles.empty}>No interpreter selected. Choose one above or add a new one.</div>}
+ {!python && (
+ <div className={styles.empty}>
+ <T>No interpreter selected. Choose one above or add a new one.</T>
+ </div>
+ )}
{python && error && (
<div className={clsx(styles.empty, styles.error)} role="alert">
{error}
@@ -265,7 +275,11 @@ export function PythonInterpreterPage() {
{python && !error && packages && shown.length === 0 && (
<div className={styles.empty}>{query ? "No packages match" : "No packages installed"}</div>
)}
- {python && !error && !packages && loading && <div className={styles.empty}>Loading packages…</div>}
+ {python && !error && !packages && loading && (
+ <div className={styles.empty}>
+ <T>Loading packages…</T>
+ </div>
+ )}
</div>
</div>
@@ -276,7 +290,7 @@ export function PythonInterpreterPage() {
{job.op === "install" ? "Installing" : job.op === "upgrade" ? "Upgrading" : "Uninstalling"} {job.target}…
</span>
<Button size="small" variant="ghost" onClick={job.cancel}>
- Cancel
+ <T>Cancel</T>
</Button>
</div>
)}
diff --git a/src/features/settings/model/pages.ts b/src/features/settings/model/pages.ts
index dd1571145..1788e9e96 100644
--- a/src/features/settings/model/pages.ts
+++ b/src/features/settings/model/pages.ts
@@ -5,6 +5,7 @@
* otherwise under a folder for its `group`, otherwise at the top level.
*/
import type { SettingsPageContribution } from "@/workbench/contributions";
+import { tx } from "@/platform/i18n";
export interface PageNode {
key: string;
@@ -88,7 +89,8 @@ export function queryTerms(query: string): string[] {
/** Every term occurs in at least one of the texts. */
export function matchesTerms(texts: readonly string[], terms: readonly string[]): boolean {
if (!terms.length) return true;
- const hay = texts.map((t) => t.toLowerCase());
+ // Translated texts are searched alongside the English ones.
+ const hay = texts.flatMap((t) => [t.toLowerCase(), tx(t).toLowerCase()]);
return terms.every((term) => hay.some((h) => h.includes(term)));
}
@@ -108,7 +110,7 @@ export function highlightIndices(text: string, query: string): number[] | null {
/** Whether one option label matches the query (any term, so partial queries still light up rows). */
export function labelMatches(text: string, query: string): boolean {
- return highlightIndices(text, query) !== null;
+ return highlightIndices(text, query) !== null || highlightIndices(tx(text), query) !== null;
}
/** Search texts of a page: title, group, keywords and its registered option labels. */
diff --git a/src/features/settings/pages/behavior.tsx b/src/features/settings/pages/behavior.tsx
index 6c2bf582e..cf40f1876 100644
--- a/src/features/settings/pages/behavior.tsx
+++ b/src/features/settings/pages/behavior.tsx
@@ -10,7 +10,7 @@ import { shortcutLabel } from "@/platform/keymap";
import { isTauri } from "@/platform/ipc";
import { SCHEMES as EDITOR_SCHEMES } from "@/platform/colorScheme";
import { formatTimestamp } from "@/platform/dateFormat";
-import { Checkbox, IconButton, Input, Popup, type SelectOption } from "@/ui";
+import { Checkbox, IconButton, Input, Popup, type SelectOption, T } from "@/ui";
import { NOTIFICATION_GROUPS } from "@/workbench/notificationStore";
import { ColorSwatches, NumberInput, Row, SearchLabel, Select, Toggle } from "../components/Form";
import { useLabelMatch, useSetting } from "../components/context";
@@ -27,6 +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";
export const APPEARANCE_GROUP = "Appearance & Behavior";
@@ -158,13 +159,17 @@ function ZoomRow() {
value: String(z),
label: `${z}%`,
}));
+ const t = useT();
const key = (id: string, fallback: string) => shortcutLabel(id) ?? fallback;
return (
<Row label="Zoom">
<Select value={String(zoom)} options={options} onChange={(v) => setZoom(Number(v))} aria-label="Zoom" />
<span className={styles.note}>
- Change with {key("view.zoomIn", "⌃⌥=")} or {key("view.zoomOut", "⌃⌥-")}. Set to 100% with{" "}
- {key("view.resetZoom", "⌃⌥0")}
+ {t("settings.zoom.hint", {
+ zoomIn: key("view.zoomIn", "⌃⌥="),
+ zoomOut: key("view.zoomOut", "⌃⌥-"),
+ reset: key("view.resetZoom", "⌃⌥0"),
+ })}
</span>
</Row>
);
@@ -438,9 +443,15 @@ function NotificationGroupsTable() {
<table className={styles.table} aria-label="Notification groups">
<thead>
<tr>
- <th>Group</th>
- <th>Popup type</th>
- <th>Show in tool window</th>
+ <th>
+ <T>Group</T>
+ </th>
+ <th>
+ <T>Popup type</T>
+ </th>
+ <th>
+ <T>Show in tool window</T>
+ </th>
</tr>
</thead>
<tbody>
diff --git a/src/features/settings/pages/editor/codeStyle.tsx b/src/features/settings/pages/editor/codeStyle.tsx
index a6c7c2839..ecfddcabd 100644
--- a/src/features/settings/pages/editor/codeStyle.tsx
+++ b/src/features/settings/pages/editor/codeStyle.tsx
@@ -6,7 +6,7 @@
* new-file creation in the backend (`ide-workspace::FileDefaults`).
*/
import { useId, useState } from "react";
-import { Button, Checkbox, Input, type SelectOption } from "@/ui";
+import { Button, Checkbox, Input, type SelectOption, T } from "@/ui";
import { commands, isTauri, type LanguageInfo_Serialize as LanguageInfo } from "@/platform/ipc";
import { ENCODING_CHOICES, type LanguageCodeStyle } from "@/platform/editorSettings";
import { NumberInput, Row } from "../../components/Form";
@@ -140,7 +140,9 @@ function LanguageStyle({ lang }: { lang: LanguageInfo }) {
return (
<div className={styles.page}>
<section aria-label="Tabs and Indents">
- <div className={styles.previewTitle}>Tabs and Indents</div>
+ <div className={styles.previewTitle}>
+ <T>Tabs and Indents</T>
+ </div>
<div className={styles.check}>
<Checkbox checked={eff.useTab} onChange={(v) => set({ useTab: v })} label="Use tab character" />
</div>
@@ -166,7 +168,9 @@ function LanguageStyle({ lang }: { lang: LanguageInfo }) {
</Row>
</section>
<section aria-label="Wrapping">
- <div className={styles.previewTitle}>Wrapping</div>
+ <div className={styles.previewTitle}>
+ <T>Wrapping</T>
+ </div>
<Row label="Hard wrap at" hint="Shown as the right margin guide in the editor.">
<NumberInput
value={eff.hardWrapAt}
@@ -181,7 +185,7 @@ function LanguageStyle({ lang }: { lang: LanguageInfo }) {
</section>
<div className={styles.schemeRow}>
<Button size="small" disabled={!all?.[lang.id]} onClick={reset}>
- Reset to Language Defaults
+ <T>Reset to Language Defaults</T>
</Button>
<span className={styles.inherited}>
Defaults from the {lang.name} language definition: {base.useTab ? "tab" : `${base.tabSize} spaces`}.
diff --git a/src/features/settings/pages/editor/colorScheme.tsx b/src/features/settings/pages/editor/colorScheme.tsx
index eeec04ada..62f677598 100644
--- a/src/features/settings/pages/editor/colorScheme.tsx
+++ b/src/features/settings/pages/editor/colorScheme.tsx
@@ -5,7 +5,7 @@
* `editor.colorOverrides[scheme][attribute]`; `editor/core` injects them.
*/
import { useMemo, useState, type CSSProperties } from "react";
-import { Button, Checkbox, Input, Tree, type SelectOption } from "@/ui";
+import { Button, Checkbox, Input, Tree, type SelectOption, T } from "@/ui";
import type { TextAttributesOverride } from "@/platform/editorSettings";
import {
ATTRIBUTES,
@@ -192,7 +192,9 @@ function AttributeEditor({
)}
</div>
)}
- <div className={styles.inherited}>Unchecked values are inherited from the scheme.</div>
+ <div className={styles.inherited}>
+ <T>Unchecked values are inherited from the scheme.</T>
+ </div>
</div>
);
}
@@ -279,7 +281,7 @@ function ColorSchemePage() {
disabled={!mine}
onClick={() => setOverrides(Object.fromEntries(Object.entries(overrides ?? {}).filter(([k]) => k !== id)))}
>
- Restore Defaults
+ <T>Restore Defaults</T>
</Button>
</div>
{scheme === "theme-default" && <div className={styles.note}>Follows the IDE theme: currently {schemeName}.</div>}
diff --git a/src/features/settings/pages/editor/font.tsx b/src/features/settings/pages/editor/font.tsx
index 125a49641..a940f17b0 100644
--- a/src/features/settings/pages/editor/font.tsx
+++ b/src/features/settings/pages/editor/font.tsx
@@ -1,6 +1,6 @@
/** Editor › Font: family (installed fonts, monospaced filter), size, line height, ligatures, fallback, editable preview. */
import { useMemo, useState } from "react";
-import { Checkbox, type SelectOption } from "@/ui";
+import { Checkbox, type SelectOption, T } from "@/ui";
import { NumberInput, Row, SearchLabel, Select } from "../../components/Form";
import { useLabelMatch, useSetting } from "../../components/context";
import { LIMITS } from "../../model/schema";
@@ -152,7 +152,9 @@ function Preview() {
const fam = `"${family.replace(/"/g, "")}"${fallback ? `, "${fallback.replace(/"/g, "")}"` : ""}, var(--font-mono)`;
return (
<>
- <div className={styles.previewTitle}>Preview</div>
+ <div className={styles.previewTitle}>
+ <T>Preview</T>
+ </div>
<textarea
className={styles.previewArea}
aria-label="Font preview"
diff --git a/src/features/settings/pages/execution.tsx b/src/features/settings/pages/execution.tsx
index 63aeee834..f8d7b336b 100644
--- a/src/features/settings/pages/execution.tsx
+++ b/src/features/settings/pages/execution.tsx
@@ -10,6 +10,7 @@ import { useSetting } from "../components/context";
import type { PageSpec } from "./spec";
import { Indented, ToggleNumber } from "./workflowControls";
import styles from "./Workflow.module.css";
+import { T } from "@/ui";
export const BUILD_GROUP = "Build, Execution, Deployment";
@@ -77,7 +78,11 @@ function TooltipDelayRow() {
step={100}
aria-label="Value tooltip delay (ms)"
/>
- {!enabled && <span className={styles.note}>Value tooltips are off</span>}
+ {!enabled && (
+ <span className={styles.note}>
+ <T>Value tooltips are off</T>
+ </span>
+ )}
</Row>
</Indented>
);
diff --git a/src/features/settings/pages/tools.tsx b/src/features/settings/pages/tools.tsx
index 9407830f6..4d83c95d3 100644
--- a/src/features/settings/pages/tools.tsx
+++ b/src/features/settings/pages/tools.tsx
@@ -12,7 +12,7 @@ import {
WORKFLOW_LIMITS,
type ExternalToolValid,
} from "@/platform/workflowSettings";
-import { Button, Checkbox, IconButton, Input, Menu, type SelectOption } from "@/ui";
+import { Button, Checkbox, IconButton, Input, Menu, type SelectOption, T } from "@/ui";
import { NumberInput, Row, SearchLabel, Section, Select } from "../components/Form";
import { useLabelMatch, useSetting } from "../components/context";
import type { PageSpec } from "./spec";
@@ -163,7 +163,10 @@ function TerminalFont() {
<div className={clsx(styles.inlineRow, matched && styles.matched)}>
<Checkbox checked={useEditor} onChange={setUseEditor} label={<SearchLabel text="Use editor font" />} />
<span className={styles.note}>
- configured in <PageLink page="editor.font">Editor › Font</PageLink>
+ <T>configured in</T>{" "}
+ <PageLink page="editor.font">
+ <T>Editor › Font</T>
+ </PageLink>
</span>
</div>
<Indented>
@@ -228,8 +231,15 @@ function ActionsOnSave() {
function ActionsOnSaveNote() {
return (
<div className={styles.note}>
- Actions run when a file is saved with Save (⌘S) or Save All. Trailing spaces and the final line break are
- configured in <PageLink page="editor.general">Editor › General</PageLink>.
+ <T>
+ {
+ "Actions run when a file is saved with Save (⌘S) or Save All. Trailing spaces and the final line break are configured in"
+ }
+ </T>{" "}
+ <PageLink page="editor.general">
+ <T>Editor › General</T>
+ </PageLink>
+ .
</div>
);
}
@@ -243,7 +253,7 @@ function MacroButton({ onInsert }: { onInsert: (macro: string) => void }) {
return (
<>
<Button ref={ref} size="small" aria-haspopup="menu" aria-expanded={open} onClick={() => setOpen((o) => !o)}>
- Insert Macro…
+ <T>Insert Macro…</T>
</Button>
<Menu
open={open}
@@ -353,7 +363,9 @@ function ExternalToolsEditor() {
</div>
<div className={styles.toolList} role="listbox" aria-label="External tools">
{tools.length === 0 && (
- <div className={clsx(styles.toolRow, styles.empty)}>No external tools. Click + to add one.</div>
+ <div className={clsx(styles.toolRow, styles.empty)}>
+ <T>No external tools. Click + to add one.</T>
+ </div>
)}
{tools.map((t) => (
<div
@@ -421,8 +433,11 @@ function ExternalToolsEditor() {
</Section>
)}
<div className={styles.note}>
- Enabled tools appear in Find Action (⇧⌘A) under “External Tools” and can get shortcuts in Keymap. Output is
- shown in the Run tool window.
+ <T>
+ {
+ "Enabled tools appear in Find Action (⇧⌘A) under “External Tools” and can get shortcuts in Keymap. Output is shown in the Run tool window."
+ }
+ </T>
</div>
</div>
);
diff --git a/src/features/settings/pages/vcs.tsx b/src/features/settings/pages/vcs.tsx
index 9f4d4dc36..bde64e8d3 100644
--- a/src/features/settings/pages/vcs.tsx
+++ b/src/features/settings/pages/vcs.tsx
@@ -7,7 +7,7 @@ import { useEffect, useId, useState } from "react";
import { call, commands, isTauri } from "@/platform/ipc";
import { useProject } from "@/platform/project";
import { WORKFLOW_LIMITS, type IssueLinkValid } from "@/platform/workflowSettings";
-import { Button, Icon, Input, type SelectOption } from "@/ui";
+import { Button, Icon, Input, type SelectOption, T } from "@/ui";
import { Row, SettingSelect } from "../components/Form";
import { useSetting } from "../components/context";
import type { PageSpec } from "./spec";
@@ -38,15 +38,19 @@ function MappingsTable() {
<table className={styles.table} aria-label="Directory mappings">
<thead>
<tr>
- <th>Directory</th>
- <th style={{ width: 120 }}>VCS</th>
+ <th>
+ <T>Directory</T>
+ </th>
+ <th style={{ width: 120 }}>
+ <T>VCS</T>
+ </th>
</tr>
</thead>
<tbody>
{!project ? (
<tr>
<td colSpan={2} className={styles.empty}>
- No project is open
+ <T>No project is open</T>
</td>
</tr>
) : (
@@ -113,7 +117,7 @@ function GitExecutableRow() {
}}
/>
<Button size="small" disabled={testing || !isTauri()} onClick={() => void test()}>
- Test
+ <T>Test</T>
</Button>
</Row>
);
@@ -244,16 +248,16 @@ function IssuePresets() {
size="small"
onClick={() => add({ pattern: "[A-Z][A-Z0-9]+-\\d+", link: "https://jira.example.com/browse/$0" })}
>
- Add JIRA Pattern
+ <T>Add JIRA Pattern</T>
</Button>
<Button
size="small"
onClick={() => add({ pattern: "[A-Z][A-Z0-9]+-\\d+", link: "https://youtrack.example.com/issue/$0" })}
>
- Add YouTrack Pattern
+ <T>Add YouTrack Pattern</T>
</Button>
<Button size="small" onClick={() => add({ pattern: "#(\\d+)", link: "https://github.com/owner/repo/issues/$1" })}>
- Add GitHub Pattern
+ <T>Add GitHub Pattern</T>
</Button>
</Row>
);
diff --git a/src/features/templates/settings/FileTemplatesPage.tsx b/src/features/templates/settings/FileTemplatesPage.tsx
index 7f8869232..55d0f52ad 100644
--- a/src/features/templates/settings/FileTemplatesPage.tsx
+++ b/src/features/templates/settings/FileTemplatesPage.tsx
@@ -1,7 +1,7 @@
/** Settings › Editor › File Templates. */
import { useState } from "react";
import clsx from "clsx";
-import { Button, Checkbox, Icon, IconButton, Input, Select } from "@/ui";
+import { Button, Checkbox, Icon, IconButton, Input, Select, T } from "@/ui";
import type { FileTemplate, NameStyle } from "../files/model";
import {
isBuiltinFileTemplate,
@@ -85,7 +85,9 @@ export function FileTemplatesPage() {
{selected ? (
<FileTemplateEditor key={selected.id} template={selected} />
) : (
- <div className={styles.empty}>Select a template to edit it</div>
+ <div className={styles.empty}>
+ <T>Select a template to edit it</T>
+ </div>
)}
</div>
</div>
@@ -103,7 +105,9 @@ function FileTemplateEditor({ template: t }: { template: FileTemplate }) {
return (
<>
<div className={styles.row}>
- <span className={styles.label}>Name</span>
+ <span className={styles.label}>
+ <T>Name</T>
+ </span>
<Input
className={styles.grow}
value={t.name}
@@ -112,7 +116,9 @@ function FileTemplateEditor({ template: t }: { template: FileTemplate }) {
/>
</div>
<div className={styles.row}>
- <span className={styles.label}>Extension</span>
+ <span className={styles.label}>
+ <T>Extension</T>
+ </span>
<Input
mono
value={t.extension}
@@ -120,7 +126,9 @@ function FileTemplateEditor({ template: t }: { template: FileTemplate }) {
aria-label="Extension"
placeholder="none"
/>
- <span className={styles.label}>File name</span>
+ <span className={styles.label}>
+ <T>File name</T>
+ </span>
<Select
value={t.nameStyle}
options={NAME_STYLES}
@@ -129,7 +137,9 @@ function FileTemplateEditor({ template: t }: { template: FileTemplate }) {
/>
</div>
<div className={styles.row}>
- <span className={styles.label}>Kinds</span>
+ <span className={styles.label}>
+ <T>Kinds</T>
+ </span>
<div className={clsx(styles.tabs, styles.grow)} role="tablist" aria-label="Kinds">
{t.kinds.map((k, i) => (
<button
@@ -167,7 +177,9 @@ function FileTemplateEditor({ template: t }: { template: FileTemplate }) {
/>
</div>
<div className={styles.row}>
- <span className={styles.label}>Kind label</span>
+ <span className={styles.label}>
+ <T>Kind label</T>
+ </span>
<Input
className={styles.grow}
value={kind.label}
@@ -190,7 +202,7 @@ function FileTemplateEditor({ template: t }: { template: FileTemplate }) {
{isBuiltinFileTemplate(t.id) && isModifiedFileTemplate(t.id) && (
<div className={styles.buttons}>
<Button size="small" onClick={() => resetFileTemplate(t.id)}>
- Restore Default
+ <T>Restore Default</T>
</Button>
</div>
)}
diff --git a/src/features/templates/settings/LiveTemplatesPage.tsx b/src/features/templates/settings/LiveTemplatesPage.tsx
index aa6735eaa..0ee676cc0 100644
--- a/src/features/templates/settings/LiveTemplatesPage.tsx
+++ b/src/features/templates/settings/LiveTemplatesPage.tsx
@@ -1,7 +1,7 @@
/** Settings › Editor › Live Templates. */
import { useMemo, useState } from "react";
import clsx from "clsx";
-import { Button, Checkbox, IconButton, Input } from "@/ui";
+import { Button, Checkbox, IconButton, Input, T } from "@/ui";
import { bodyVariables, type LiveTemplate, type TemplateVariable } from "../live/model";
import {
isModifiedBuiltin,
@@ -122,7 +122,9 @@ export function LiveTemplatesPage() {
{selected ? (
<TemplateEditor key={selected.id} template={selected} />
) : (
- <div className={styles.empty}>Select a template to edit it</div>
+ <div className={styles.empty}>
+ <T>Select a template to edit it</T>
+ </div>
)}
</div>
</div>
@@ -140,7 +142,9 @@ function TemplateEditor({ template: t }: { template: LiveTemplate }) {
return (
<>
<div className={styles.row}>
- <span className={styles.label}>Abbreviation</span>
+ <span className={styles.label}>
+ <T>Abbreviation</T>
+ </span>
<Input
className={styles.grow}
mono
@@ -150,7 +154,9 @@ function TemplateEditor({ template: t }: { template: LiveTemplate }) {
/>
</div>
<div className={styles.row}>
- <span className={styles.label}>Description</span>
+ <span className={styles.label}>
+ <T>Description</T>
+ </span>
<Input
className={styles.grow}
value={t.description}
@@ -159,7 +165,9 @@ function TemplateEditor({ template: t }: { template: LiveTemplate }) {
/>
</div>
<div className={styles.row}>
- <span className={styles.label}>Group</span>
+ <span className={styles.label}>
+ <T>Group</T>
+ </span>
<Input
className={styles.grow}
value={t.group}
@@ -188,7 +196,9 @@ function TemplateEditor({ template: t }: { template: LiveTemplate }) {
surrounded text, <code>$$</code> a dollar sign. Leading tabs are indent units.
</div>
<div className={styles.row}>
- <span className={styles.label}>Contexts</span>
+ <span className={styles.label}>
+ <T>Contexts</T>
+ </span>
<Input
className={styles.grow}
mono
@@ -209,10 +219,18 @@ function TemplateEditor({ template: t }: { template: LiveTemplate }) {
<table className={styles.table}>
<thead>
<tr>
- <th>Variable</th>
- <th>Expression</th>
- <th>Default value</th>
- <th>Skip if defined</th>
+ <th>
+ <T>Variable</T>
+ </th>
+ <th>
+ <T>Expression</T>
+ </th>
+ <th>
+ <T>Default value</T>
+ </th>
+ <th>
+ <T>Skip if defined</T>
+ </th>
</tr>
</thead>
<tbody>
@@ -258,7 +276,7 @@ function TemplateEditor({ template: t }: { template: LiveTemplate }) {
{BUILTIN_IDS.has(t.id) && isModifiedBuiltin(t.id) && (
<div className={styles.buttons}>
<Button size="small" onClick={() => resetTemplate(t.id)}>
- Restore Default
+ <T>Restore Default</T>
</Button>
</div>
)}
diff --git a/src/features/templates/settings/PostfixPage.tsx b/src/features/templates/settings/PostfixPage.tsx
index c84c01eee..c8f097f33 100644
--- a/src/features/templates/settings/PostfixPage.tsx
+++ b/src/features/templates/settings/PostfixPage.tsx
@@ -1,7 +1,7 @@
/** Settings › Editor › Postfix Completion. */
import { useMemo, useState } from "react";
import clsx from "clsx";
-import { Checkbox } from "@/ui";
+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";
@@ -34,8 +34,9 @@ export function PostfixPage() {
/>
</div>
<div className={styles.hint}>
- Type an expression followed by <code>.key</code>, e.g. <code>user.name.nn</code> or <code>items.for</code>, then
- press Tab.
+ <T>Type an expression followed by</T> <code>.key</code>, e.g. <code>user.name.nn</code> or{" "}
+ <code>items.for</code>
+ <T>, then press Tab.</T>
</div>
<div className={styles.tabs} role="tablist" aria-label="Languages">
{POSTFIX_GROUPS.map((g) => (
diff --git a/src/features/todo/TodoSettingsPage.tsx b/src/features/todo/TodoSettingsPage.tsx
index a5196304a..beb6e0f95 100644
--- a/src/features/todo/TodoSettingsPage.tsx
+++ b/src/features/todo/TodoSettingsPage.tsx
@@ -1,5 +1,5 @@
/** Settings › Editor › TODO: patterns, colours, matching options. */
-import { Button, Checkbox, IconButton, Input, Select } from "@/ui";
+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";
@@ -34,7 +34,9 @@ export function TodoSettingsPage() {
/>
</div>
<div className={styles.header}>
- <span>Patterns</span>
+ <span>
+ <T>Patterns</T>
+ </span>
<IconButton
icon="plus"
size="small"
@@ -80,7 +82,7 @@ export function TodoSettingsPage() {
</div>
<div>
<Button size="small" onClick={() => setPatterns(DEFAULT_PATTERNS)}>
- Restore Defaults
+ <T>Restore Defaults</T>
</Button>
</div>
</div>
diff --git a/src/features/todo/TodoView.tsx b/src/features/todo/TodoView.tsx
index 86d866ec9..56df38772 100644
--- a/src/features/todo/TodoView.tsx
+++ b/src/features/todo/TodoView.tsx
@@ -16,6 +16,7 @@ import {
fileIconName,
type MenuItem,
type TreeRowState,
+ T,
} from "@/ui";
import { activePatterns, countItems, groupTodos, mergeLive, type TodoGroup, type TodoItem } from "./model";
import { scanProject, updateTodoSettings, useTodoSettings, useTodos } from "./store";
@@ -158,7 +159,7 @@ export function TodoTabs() {
id: "file",
label: current ? (
<>
- Current File <span className={styles.tabFile}>{basename(current)}</span>
+ <T>Current File</T> <span className={styles.tabFile}>{basename(current)}</span>
</>
) : (
"Current File"
@@ -225,7 +226,7 @@ export function TodoView() {
</EmptyState>
) : scanning || (!scannedOnce && tab === "project") ? (
<div className={styles.loading}>
- <Spinner size={14} /> Scanning for TODO items…
+ <Spinner size={14} /> <T>Scanning for TODO items…</T>
</div>
) : (
<EmptyState icon="todo" title={tab === "file" ? "No TODO items in this file" : "No TODO items found"} />
@@ -234,7 +235,9 @@ export function TodoView() {
return (
<div className={styles.view}>
{tab === "project" && limitHit && (
- <div className={styles.banner}>Too many matches; showing the first 10 000.</div>
+ <div className={styles.banner}>
+ <T>Too many matches; showing the first 10 000.</T>
+ </div>
)}
<div className={styles.body}>
<Tree<Node>
diff --git a/src/features/tools/LanguageServersPage.tsx b/src/features/tools/LanguageServersPage.tsx
index d1bc29bf2..fb7f77330 100644
--- a/src/features/tools/LanguageServersPage.tsx
+++ b/src/features/tools/LanguageServersPage.tsx
@@ -2,7 +2,7 @@
import { Fragment, useEffect, useMemo, useState } from "react";
import clsx from "clsx";
import type { ToolInfo } from "@/bindings";
-import { Badge, Button, IconButton, ProgressBar, SearchField, Spinner } from "@/ui";
+import { Badge, Button, IconButton, ProgressBar, SearchField, Spinner, T } from "@/ui";
import {
cancelInstall,
installTool,
@@ -41,7 +41,7 @@ function JobRow({ name, job }: { name: string; job: InstallJob }) {
{job.message ?? "Starting…"}
</span>
<Button size="small" variant="ghost" onClick={() => cancelInstall(name)}>
- Cancel
+ <T>Cancel</T>
</Button>
</div>
</div>
@@ -83,7 +83,7 @@ function Actions({
onClick={() => void uninstallTool(tool.name)}
aria-label={`Uninstall ${label}`}
>
- Uninstall
+ <T>Uninstall</T>
</Button>
)}
{hasLog && (
@@ -160,16 +160,22 @@ export function LanguageServersPage() {
<table className={styles.table} aria-label="Language servers and debug adapters">
<thead>
<tr>
- <th scope="col">Tool</th>
- <th scope="col">Languages</th>
+ <th scope="col">
+ <T>Tool</T>
+ </th>
+ <th scope="col">
+ <T>Languages</T>
+ </th>
<th scope="col" className={styles.fitHead}>
- Status
+ <T>Status</T>
</th>
<th scope="col" className={styles.fitHead}>
- Version
+ <T>Version</T>
</th>
<th scope="col" className={styles.actionsHead}>
- <span className={styles.visuallyHidden}>Actions</span>
+ <span className={styles.visuallyHidden}>
+ <T>Actions</T>
+ </span>
</th>
</tr>
</thead>
@@ -185,8 +191,16 @@ export function LanguageServersPage() {
<td>
<div className={styles.toolName}>
<span className={styles.display}>{t.displayName}</span>
- {t.kind === "debugger" && <span className={styles.kindTag}>Debugger</span>}
- {t.kind === "plugin" && <span className={styles.kindTag}>Plugin</span>}
+ {t.kind === "debugger" && (
+ <span className={styles.kindTag}>
+ <T>Debugger</T>
+ </span>
+ )}
+ {t.kind === "plugin" && (
+ <span className={styles.kindTag}>
+ <T>Plugin</T>
+ </span>
+ )}
</div>
{(t.path ?? (t.command !== t.displayName ? t.command : null)) && (
<div className={styles.sub} title={t.path ?? undefined}>
@@ -236,8 +250,16 @@ export function LanguageServersPage() {
})}
</tbody>
</table>
- {loaded && shown.length === 0 && <div className={styles.empty}>No tools match.</div>}
- {!loaded && !error && <div className={styles.empty}>Checking installed tools…</div>}
+ {loaded && shown.length === 0 && (
+ <div className={styles.empty}>
+ <T>No tools match.</T>
+ </div>
+ )}
+ {!loaded && !error && (
+ <div className={styles.empty}>
+ <T>Checking installed tools…</T>
+ </div>
+ )}
</div>
</div>
);
diff --git a/src/features/vcs/CommitView.tsx b/src/features/vcs/CommitView.tsx
index 3f9192838..8742ac83f 100644
--- a/src/features/vcs/CommitView.tsx
+++ b/src/features/vcs/CommitView.tsx
@@ -20,6 +20,7 @@ import {
showContextMenu,
type MenuItem,
type TreeHandle,
+ T,
} from "@/ui";
import { editorService } from "@/workbench/contributions";
import {
@@ -67,9 +68,19 @@ export function CommitTabs() {
items={[
{ id: "changes", label: "Changes" },
...(shelfCount || tab === "shelf"
- ? [{ id: "shelf", label: "Shelf", trailing: shelfCount ? <span className={styles.count}>{shelfCount}</span> : undefined }]
+ ? [
+ {
+ id: "shelf",
+ label: "Shelf",
+ trailing: shelfCount ? <span className={styles.count}>{shelfCount}</span> : undefined,
+ },
+ ]
: []),
- { id: "stashes", label: "Stashes", trailing: stashCount ? <span className={styles.count}>{stashCount}</span> : undefined },
+ {
+ id: "stashes",
+ label: "Stashes",
+ trailing: stashCount ? <span className={styles.count}>{stashCount}</span> : undefined,
+ },
]}
/>
);
@@ -81,7 +92,7 @@ export function CommitToolWindow() {
if (!available)
return (
<EmptyState icon="commit" title="Version control is not configured">
- Open a Git repository to commit changes.
+ <T>Open a Git repository to commit changes.</T>
</EmptyState>
);
return (
@@ -141,7 +152,9 @@ function nodeMenu(nodes: ChangeNode[]): MenuItem[] {
if (conflicted.length) items.push({ kind: "action", action: "vcs.resolveConflicts", label: "Resolve Conflicts…" });
items.push(
{ kind: "action", action: "vcs.rollback", arg: paths, label: "Rollback…" },
- ...(untracked.length ? [{ kind: "action" as const, action: "vcs.addToVcs", arg: untracked.map((f) => f.path) }] : []),
+ ...(untracked.length
+ ? [{ kind: "action" as const, action: "vcs.addToVcs", arg: untracked.map((f) => f.path) }]
+ : []),
{
label: "Stage",
icon: "plus",
@@ -349,7 +362,11 @@ function ChangesPanel() {
showContextMenu(e, nodeMenu(nodes.length ? nodes : [node]));
}}
aria-label="Changes"
- empty={<span className={styles.empty}>No local changes</span>}
+ empty={
+ <span className={styles.empty}>
+ <T>No local changes</T>
+ </span>
+ }
renderNode={(n, st) => {
const agg = aggregateCheck(n.files, checks);
const label = (
@@ -396,7 +413,10 @@ function ChangesPanel() {
: {};
return (
<span
- className={clsx(styles.nodeRow, n.type === "group" && dropTarget === n.changelist && styles.dropTarget)}
+ className={clsx(
+ styles.nodeRow,
+ n.type === "group" && dropTarget === n.changelist && styles.dropTarget,
+ )}
{...dnd}
>
<CheckMark
@@ -442,12 +462,20 @@ function ChangesPanel() {
/** Commit message inspections (Settings › Version Control › Commit). */
export function messageProblems(
message: string,
- c: { blankLineAfterSubject: boolean; limitSubject: boolean; subjectLimit: number; limitBody: boolean; bodyLimit: number },
+ c: {
+ blankLineAfterSubject: boolean;
+ limitSubject: boolean;
+ subjectLimit: number;
+ limitBody: boolean;
+ bodyLimit: number;
+ },
): string[] {
const lines = message.split("\n");
const out: string[] = [];
- if (c.limitSubject && (lines[0]?.length ?? 0) > c.subjectLimit) out.push(`Subject line is longer than ${c.subjectLimit} characters`);
- if (c.blankLineAfterSubject && lines.length > 1 && lines[1]!.trim() !== "") out.push("Missing blank line between subject and body");
+ if (c.limitSubject && (lines[0]?.length ?? 0) > c.subjectLimit)
+ out.push(`Subject line is longer than ${c.subjectLimit} characters`);
+ if (c.blankLineAfterSubject && lines.length > 1 && lines[1]!.trim() !== "")
+ out.push("Missing blank line between subject and body");
if (c.limitBody) {
const long = lines.slice(1).findIndex((l) => l.length > c.bodyLimit);
if (long >= 0) out.push(`Body line ${long + 2} is longer than ${c.bodyLimit} characters`);
@@ -572,7 +600,8 @@ function CommitMessage({ included }: { included: number }) {
spellCheck
onChange={(e) => {
const el = e.target;
- const wrapped = cfg.limitBody && cfg.wrapAtMargin ? wrapAtMargin(el.value, el.selectionStart, cfg.bodyLimit) : null;
+ const wrapped =
+ cfg.limitBody && cfg.wrapAtMargin ? wrapAtMargin(el.value, el.selectionStart, cfg.bodyLimit) : null;
useCommit.setState({ message: wrapped?.text ?? el.value });
if (wrapped) requestAnimationFrame(() => el.setSelectionRange(wrapped.caret, wrapped.caret));
}}
diff --git a/src/features/vcs/CompareBranches.tsx b/src/features/vcs/CompareBranches.tsx
index 1dd5c85bd..9db91f8b3 100644
--- a/src/features/vcs/CompareBranches.tsx
+++ b/src/features/vcs/CompareBranches.tsx
@@ -3,7 +3,7 @@ import { useEffect, useState } from "react";
import type { Commit } from "@/bindings";
import { executeAction } from "@/platform/actions";
import { call, commands } from "@/platform/ipc";
-import { Dialog, List, Spinner, Tabs } from "@/ui";
+import { Dialog, List, Spinner, Tabs, T } from "@/ui";
import { openDialog } from "./dialogs";
import { formatTime } from "./model";
import { useVcs } from "./store";
@@ -13,7 +13,17 @@ const LIMIT = 2000;
/** Commits reachable from `to` but not from `from` (git's `from..to`), computed by git, unbounded by any window. */
const commitsBetween = (from: string, to: string) =>
- call(commands.vcsLog({ branch: null, path: null, author: null, text: null, range: `${from}..${to}`, skip: 0, limit: LIMIT }));
+ call(
+ commands.vcsLog({
+ branch: null,
+ path: null,
+ author: null,
+ text: null,
+ range: `${from}..${to}`,
+ skip: 0,
+ limit: LIMIT,
+ }),
+ );
export function showCompareBranches(branch: string) {
const current = useVcs.getState().branch?.head ?? "HEAD";
@@ -50,8 +60,16 @@ function CompareDialog({ branch, current, onClose }: { branch: string; current:
onSelect={setTab}
aria-label="Direction"
items={[
- { id: "incoming", label: `In ${branch}, not in ${current}`, trailing: data ? String(data.incoming.length) : undefined },
- { id: "outgoing", label: `In ${current}, not in ${branch}`, trailing: data ? String(data.outgoing.length) : undefined },
+ {
+ id: "incoming",
+ label: `In ${branch}, not in ${current}`,
+ trailing: data ? String(data.incoming.length) : undefined,
+ },
+ {
+ id: "outgoing",
+ label: `In ${current}, not in ${branch}`,
+ trailing: data ? String(data.outgoing.length) : undefined,
+ },
]}
/>
<div style={{ height: 320, display: "flex", flexDirection: "column" }}>
@@ -70,7 +88,11 @@ function CompareDialog({ branch, current, onClose }: { branch: string; current:
rowHeight={22}
aria-label="Commits"
className={styles.grow}
- empty={<span>No commits</span>}
+ empty={
+ <span>
+ <T>No commits</T>
+ </span>
+ }
onActivate={(c) => {
onClose();
void executeAction("vcs.showCommit", c.id);
diff --git a/src/features/vcs/GitLog.tsx b/src/features/vcs/GitLog.tsx
index 3082ee15f..d2f1e2ad4 100644
--- a/src/features/vcs/GitLog.tsx
+++ b/src/features/vcs/GitLog.tsx
@@ -29,6 +29,7 @@ import {
fileIconName,
showContextMenu,
type MenuItem,
+ T,
} from "@/ui";
import { commitFileDiffData, openDiff } from "./diffInput";
import { laneColor, type GraphRow } from "./graph";
@@ -50,13 +51,7 @@ import { clearConsole, useVcsConsole } from "./ops";
import { loadBranches, useVcs } from "./store";
import { checkoutBranch, loadFavoriteBranches, newBranch, useFavoriteBranches } from "./branchOps";
import { branchMenu } from "./branchMenu";
-import {
- branchFolderKeys,
- branchGroupKeys,
- buildBranchTree,
- filterBranchTree,
- type BranchTreeNode,
-} from "./branches";
+import { branchFolderKeys, branchGroupKeys, buildBranchTree, filterBranchTree, type BranchTreeNode } from "./branches";
import { promptText } from "./dialogs";
import { buildFileTree, dirKeys, type FileTreeNode } from "./fileTree";
import styles from "./GitLog.module.css";
@@ -93,11 +88,16 @@ export function GitToolWindow() {
if (!available)
return (
<EmptyState title="Version control is not configured">
- The project is not a Git repository.
+ <T>The project is not a Git repository.</T>
</EmptyState>
);
return (
- <div className={styles.root} role="tabpanel" id={`openidea-git-panel-${tab}`} aria-labelledby={`openidea-git-tab-${tab}`}>
+ <div
+ className={styles.root}
+ role="tabpanel"
+ id={`openidea-git-panel-${tab}`}
+ aria-labelledby={`openidea-git-tab-${tab}`}
+ >
{tab === "log" ? <LogView /> : <ConsoleView />}
</div>
);
@@ -228,7 +228,13 @@ function BranchesPanel() {
e.preventDefault();
showContextMenu(e, items);
}}
- empty={query.trim() ? <span className={styles.muted}>No matching branches</span> : undefined}
+ empty={
+ query.trim() ? (
+ <span className={styles.muted}>
+ <T>No matching branches</T>
+ </span>
+ ) : undefined
+ }
aria-label="Branches"
className={styles.branchTree}
/>
@@ -305,7 +311,11 @@ function FilterBar() {
const openBranch = (e: ReactMouseEvent<HTMLElement>) =>
menuBelow(e, [
- { label: "HEAD (Current Branch)", checked: filters.branch === "HEAD", run: () => setLogFilters({ branch: "HEAD" }) },
+ {
+ label: "HEAD (Current Branch)",
+ checked: filters.branch === "HEAD",
+ run: () => setLogFilters({ branch: "HEAD" }),
+ },
{ kind: "separator" },
...branches
.filter((b) => !b.name.endsWith("/HEAD"))
@@ -356,7 +366,6 @@ function FilterBar() {
},
]);
-
return (
<div className={styles.filters} role="toolbar" aria-label="Log filters">
<SearchField
@@ -394,7 +403,12 @@ function FilterBar() {
onOpen={openUser}
onClear={() => setLogFilters({ author: "" })}
/>
- <FilterButton label="Date" value={filters.since?.label ?? null} onOpen={openDate} onClear={() => setLogFilters({ since: null })} />
+ <FilterButton
+ label="Date"
+ value={filters.since?.label ?? null}
+ onOpen={openDate}
+ onClear={() => setLogFilters({ since: null })}
+ />
<FilterButton
label="Paths"
value={filters.path ? (root ? relTo(root, filters.path) : filters.path) || "." : null}
@@ -563,7 +577,10 @@ function CommitList() {
if (!c)
return (
<div key="loading" className={styles.row} style={{ transform: `translateY(${v.start}px)` }}>
- <Spinner size={12} /> <span className={styles.muted}>Loading…</span>
+ <Spinner size={12} />{" "}
+ <span className={styles.muted}>
+ <T>Loading…</T>
+ </span>
</div>
);
return (
@@ -671,7 +688,8 @@ export function RefLabels({ refs }: { refs: string[] }) {
<span className={styles.refs}>
{refs.map((r) => {
const tag = r.startsWith("tag: ");
- const kind = r === "HEAD" ? styles.refHead : tag ? styles.refTag : r.includes("/") ? styles.refRemote : styles.refLocal;
+ const kind =
+ r === "HEAD" ? styles.refHead : tag ? styles.refTag : r.includes("/") ? styles.refRemote : styles.refLocal;
return (
<span key={r} className={clsx(styles.ref, kind)} title={r}>
{tag ? r.slice(5) : r}
@@ -707,7 +725,9 @@ function CommitDetails({ commits }: { commits: Commit[] }) {
if (!commit)
return (
<div className={styles.details}>
- <EmptyState>Select a commit to view changes</EmptyState>
+ <EmptyState>
+ <T>Select a commit to view changes</T>
+ </EmptyState>
</div>
);
@@ -725,8 +745,18 @@ function CommitDetails({ commits }: { commits: Commit[] }) {
{files ? `${files.length} file${files.length === 1 ? "" : "s"}` : ""}
</span>
<span className={styles.grow} />
- <IconButton icon="expand-all" title="Expand All" size="small" onClick={() => setExpanded(new Set(allDirs))} />
- <IconButton icon="collapse-all" title="Collapse All" size="small" onClick={() => setExpanded(new Set())} />
+ <IconButton
+ icon="expand-all"
+ title="Expand All"
+ size="small"
+ onClick={() => setExpanded(new Set(allDirs))}
+ />
+ <IconButton
+ icon="collapse-all"
+ title="Collapse All"
+ size="small"
+ onClick={() => setExpanded(new Set())}
+ />
</div>
{error && <div className={styles.message}>{error}</div>}
{!files && !error && (
@@ -796,7 +826,9 @@ function ChangedFileRow({ node }: { node: FileTreeNode<ChangedFile> }) {
<span className={styles.fileRow}>
<Icon name="folder" size={16} className={styles.fileIcon} />
<span className={styles.fileName}>{node.name}</span>
- <span className={styles.fileDir}>{node.count} file{node.count === 1 ? "" : "s"}</span>
+ <span className={styles.fileDir}>
+ {node.count} file{node.count === 1 ? "" : "s"}
+ </span>
</span>
);
const f = node.file;
@@ -838,7 +870,11 @@ function ConsoleView() {
stick.current = el.scrollTop + el.clientHeight >= el.scrollHeight - 8;
}}
>
- {!lines.length && <div className={styles.muted}>Git commands run by the IDE appear here.</div>}
+ {!lines.length && (
+ <div className={styles.muted}>
+ <T>Git commands run by the IDE appear here.</T>
+ </div>
+ )}
{lines.map((l) => (
<div key={l.id} className={clsx(styles.line, styles[`line-${l.kind}`])}>
{l.kind === "cmd" && (
diff --git a/src/features/vcs/LocalHistory.tsx b/src/features/vcs/LocalHistory.tsx
index 8520d8165..82b7f3dba 100644
--- a/src/features/vcs/LocalHistory.tsx
+++ b/src/features/vcs/LocalHistory.tsx
@@ -7,7 +7,7 @@ import { useCallback, useEffect, useState } from "react";
import type { HistoryEntry } from "@/bindings";
import { call, commands } from "@/platform/ipc";
import { relativePath, useProject } from "@/platform/project";
-import { Button, Icon, List, Spinner } from "@/ui";
+import { Button, Icon, List, Spinner, T } from "@/ui";
import { notifications, type EditorInput } from "@/workbench/contributions";
import { DiffEditor } from "./DiffEditor";
import { confirmDialog } from "./dialogs";
@@ -78,7 +78,10 @@ export function LocalHistoryEditor({ input }: { input: EditorInput }) {
async () => {
for (const e of targets) await call(commands.historyRestore(e.path, e.id));
},
- { success: targets.length === 1 ? `${baseName(targets[0]!.path)} reverted` : `${targets.length} files reverted`, refresh: true },
+ {
+ success: targets.length === 1 ? `${baseName(targets[0]!.path)} reverted` : `${targets.length} files reverted`,
+ refresh: true,
+ },
);
load();
};
@@ -86,12 +89,19 @@ export function LocalHistoryEditor({ input }: { input: EditorInput }) {
const revert = () => {
if (!current || !view) return;
if (!isLabel(current)) {
- void restore([current], `${baseName(current.path)} to the revision from ${formatTime(current.timestampMs)} (${current.label})`);
+ void restore(
+ [current],
+ `${baseName(current.path)} to the revision from ${formatTime(current.timestampMs)} (${current.label})`,
+ );
return;
}
const targets = view.folder ? [...(atLabel?.values() ?? [])] : fileAtLabel ? [fileAtLabel] : [];
if (!targets.length) {
- notifications().notify({ level: "info", title: "Nothing recorded before this label", key: "localHistory.revert" });
+ notifications().notify({
+ level: "info",
+ title: "Nothing recorded before this label",
+ key: "localHistory.revert",
+ });
return;
}
void restore(
@@ -113,14 +123,21 @@ export function LocalHistoryEditor({ input }: { input: EditorInput }) {
);
let detail;
- if (!current) detail = <div className={styles.message}>Select a revision</div>;
+ if (!current)
+ detail = (
+ <div className={styles.message}>
+ <T>Select a revision</T>
+ </div>
+ );
else if (!isLabel(current)) detail = diffFor(current, !!view?.deleted.has(current.path));
else if (fileAtLabel) detail = diffFor(fileAtLabel, !!view?.deleted.has(path));
else
detail = (
<div className={styles.message}>
Label '{current.label}'
- {view?.folder && atLabel?.size ? ` · ${atLabel.size} ${atLabel.size === 1 ? "file" : "files"} recorded before it` : ""}
+ {view?.folder && atLabel?.size
+ ? ` · ${atLabel.size} ${atLabel.size === 1 ? "file" : "files"} recorded before it`
+ : ""}
</div>
);
@@ -130,7 +147,9 @@ export function LocalHistoryEditor({ input }: { input: EditorInput }) {
<div className={styles.root}>
<div className={styles.sidebar}>
<div className={styles.header}>
- <span className={styles.title}>Local History</span>
+ <span className={styles.title}>
+ <T>Local History</T>
+ </span>
<Button size="small" disabled={!current} onClick={revert}>
{revertLabel}
</Button>
@@ -151,7 +170,9 @@ export function LocalHistoryEditor({ input }: { input: EditorInput }) {
rowHeight={view.folder ? 52 : 38}
aria-label="Revisions"
className={styles.list}
- empty={<span className={styles.message}>No local history for this {view.folder ? "folder" : "path"} yet</span>}
+ empty={
+ <span className={styles.message}>No local history for this {view.folder ? "folder" : "path"} yet</span>
+ }
renderItem={(e) =>
isLabel(e) ? (
<span className={styles.entry}>
diff --git a/src/features/vcs/MergeEditor.tsx b/src/features/vcs/MergeEditor.tsx
index 2524717e9..1f307db52 100644
--- a/src/features/vcs/MergeEditor.tsx
+++ b/src/features/vcs/MergeEditor.tsx
@@ -7,7 +7,7 @@ import { history, historyKeymap } from "@codemirror/commands";
import { keymap } from "@codemirror/view";
import { unifiedMergeView } from "@codemirror/merge";
import { call, commands } from "@/platform/ipc";
-import { Button, IconButton, Spinner } from "@/ui";
+import { Button, IconButton, Spinner, T } from "@/ui";
import { editorService, type EditorInput } from "@/workbench/contributions";
import { languageFor, viewerBase } from "./cm";
import { confirmDialog } from "./dialogs";
@@ -101,7 +101,10 @@ const conflictField = StateField.define<{ blocks: ConflictBlock[]; deco: Decorat
const resultTheme = EditorView.baseTheme({
".cm-conflict-ours": { backgroundColor: "color-mix(in srgb, var(--accent) 12%, transparent)" },
".cm-conflict-theirs": { backgroundColor: "color-mix(in srgb, var(--vcs-added) 12%, transparent)" },
- ".cm-conflict-marker": { backgroundColor: "color-mix(in srgb, var(--vcs-conflict) 14%, transparent)", color: "var(--fg-subtle)" },
+ ".cm-conflict-marker": {
+ backgroundColor: "color-mix(in srgb, var(--vcs-conflict) 14%, transparent)",
+ color: "var(--fg-subtle)",
+ },
".cm-conflict-actions": {
display: "flex",
alignItems: "center",
@@ -207,7 +210,10 @@ export function MergeEditor({ input }: { input: EditorInput }) {
dir === 1
? (blocks.find((b) => b.from > head) ?? blocks[0]!)
: ([...blocks].reverse().find((b) => b.to < head) ?? blocks[blocks.length - 1]!);
- v.dispatch({ selection: { anchor: target.from }, effects: EditorView.scrollIntoView(target.from, { y: "center" }) });
+ v.dispatch({
+ selection: { anchor: target.from },
+ effects: EditorView.scrollIntoView(target.from, { y: "center" }),
+ });
v.focus();
};
@@ -250,14 +256,18 @@ export function MergeEditor({ input }: { input: EditorInput }) {
return (
<div className={styles.message}>
{error}
- <Button onClick={() => void load()}>Retry</Button>
+ <Button onClick={() => void load()}>
+ <T>Retry</T>
+ </Button>
</div>
);
if (resolved)
return (
<div className={styles.message}>
{baseName(path)} has been resolved and staged.
- <Button onClick={() => void editorService().openFile(path, { focus: true })}>Open File</Button>
+ <Button onClick={() => void editorService().openFile(path, { focus: true })}>
+ <T>Open File</T>
+ </Button>
</div>
);
@@ -268,23 +278,29 @@ export function MergeEditor({ input }: { input: EditorInput }) {
<IconButton icon="arrow-down" title="Next Conflict" size="small" onClick={() => goto(1)} />
<span className={styles.sep} />
<Button size="small" onClick={() => acceptAll("ours")}>
- Accept All Yours
+ <T>Accept All Yours</T>
</Button>
<Button size="small" onClick={() => acceptAll("theirs")}>
- Accept All Theirs
+ <T>Accept All Theirs</T>
</Button>
<IconButton icon="refresh" title="Reload from Disk" size="small" onClick={() => void load()} />
<span className={clsx(styles.status, !left && styles.statusDone)}>
{left ? `${left} conflict${left === 1 ? "" : "s"} left` : "All conflicts resolved"}
</span>
<Button size="small" variant="primary" onClick={() => void apply()}>
- Apply
+ <T>Apply</T>
</Button>
</div>
<div className={styles.labels}>
- <span>Yours (current branch)</span>
- <span>Result</span>
- <span>Theirs (incoming)</span>
+ <span>
+ <T>Yours (current branch)</T>
+ </span>
+ <span>
+ <T>Result</T>
+ </span>
+ <span>
+ <T>Theirs (incoming)</T>
+ </span>
</div>
{!state || lang === null ? (
<div className={styles.message}>
diff --git a/src/features/vcs/changelistsUi.tsx b/src/features/vcs/changelistsUi.tsx
index 5253a3545..b9277f486 100644
--- a/src/features/vcs/changelistsUi.tsx
+++ b/src/features/vcs/changelistsUi.tsx
@@ -1,6 +1,6 @@
/** Change list dialogs: New / Edit Changelist, Move to Another Changelist, delete. */
import { useState } from "react";
-import { Checkbox, Dialog, Input, Select } from "@/ui";
+import { Checkbox, Dialog, Input, Select, T } from "@/ui";
import { notifications } from "@/workbench/contributions";
import {
activeList,
@@ -40,7 +40,7 @@ function ChangelistForm({
return (
<div className={styles.form}>
<label className={styles.fieldLabel} htmlFor="openidea-cl-name">
- Name:
+ <T>Name:</T>
</label>
<Input
id="openidea-cl-name"
@@ -51,7 +51,7 @@ function ChangelistForm({
/>
{value.name && error && <div className={styles.error}>{error}</div>}
<label className={styles.fieldLabel} htmlFor="openidea-cl-comment">
- Comment:
+ <T>Comment:</T>
</label>
<textarea
id="openidea-cl-comment"
@@ -238,7 +238,9 @@ function MoveDialog({ paths, onClose }: { paths: readonly string[]; onClose: ()
disabled={!others.length}
onChange={() => setMode("existing")}
/>
- <span className={styles.radioText}>Existing changelist:</span>
+ <span className={styles.radioText}>
+ <T>Existing changelist:</T>
+ </span>
</label>
<Select
value={target}
@@ -249,7 +251,9 @@ function MoveDialog({ paths, onClose }: { paths: readonly string[]; onClose: ()
/>
<label className={styles.radioRow}>
<input type="radio" name="target" checked={mode === "new"} onChange={() => setMode("new")} />
- <span className={styles.radioText}>New changelist:</span>
+ <span className={styles.radioText}>
+ <T>New changelist:</T>
+ </span>
</label>
</div>
{mode === "new" && <ChangelistForm value={value} onChange={setValue} error={error} />}
diff --git a/src/features/vcs/clone.tsx b/src/features/vcs/clone.tsx
index c52053af4..bbbec06f8 100644
--- a/src/features/vcs/clone.tsx
+++ b/src/features/vcs/clone.tsx
@@ -3,7 +3,7 @@ import { useEffect, useRef, useState } from "react";
import { Channel } from "@tauri-apps/api/core";
import { call, commands, isCancelled, isTauri, nextRequestId } from "@/platform/ipc";
import { openProject } from "@/platform/project";
-import { Button, Dialog, Input, ProgressBar } from "@/ui";
+import { Button, Dialog, Input, ProgressBar, T } from "@/ui";
import { notifications } from "@/workbench/contributions";
import { openDialog } from "./dialogs";
import { progressFraction } from "./model";
@@ -14,8 +14,15 @@ const PARENT_KEY = "openidea.vcs.cloneParent";
/** Folder name git would pick for `url` (`https://h/o/repo.git` → `repo`, `git@h:o/r` → `r`). */
export function cloneDirName(url: string): string {
let u = url.trim().replace(/[?#].*$/, "");
- u = u.replace(/[/\\]+$/, "").replace(/\.git$/i, "").replace(/[/\\]+$/, "");
- const name = u.split(/[/\\:]/).filter(Boolean).pop() ?? "";
+ u = u
+ .replace(/[/\\]+$/, "")
+ .replace(/\.git$/i, "")
+ .replace(/[/\\]+$/, "");
+ const name =
+ u
+ .split(/[/\\:]/)
+ .filter(Boolean)
+ .pop() ?? "";
return name.replace(/[^\w.-]+/g, "-").replace(/^[.-]+/, "");
}
@@ -32,7 +39,8 @@ export function validateClone(url: string, dir: string): string | null {
if (/\s/.test(u)) return "The URL must not contain spaces";
if (u.startsWith("-")) return "Invalid repository URL";
if (!dir.trim()) return "Choose a directory";
- if (!dir.trim().startsWith("/") && !/^[a-zA-Z]:[\\/]/.test(dir.trim())) return "The directory must be an absolute path";
+ if (!dir.trim().startsWith("/") && !/^[a-zA-Z]:[\\/]/.test(dir.trim()))
+ return "The directory must be an absolute path";
return null;
}
@@ -97,7 +105,12 @@ function CloneDialog({ onClose, initialUrl }: { onClose: () => void; initialUrl:
const browse = async () => {
const { open } = await import("@tauri-apps/plugin-dialog");
- const picked = await open({ directory: true, multiple: false, title: "Directory to Clone Into", defaultPath: parent || undefined });
+ const picked = await open({
+ directory: true,
+ multiple: false,
+ title: "Directory to Clone Into",
+ defaultPath: parent || undefined,
+ });
const path = Array.isArray(picked) ? picked[0] : picked;
if (!path) return;
setParent(path);
@@ -164,7 +177,7 @@ function CloneDialog({ onClose, initialUrl }: { onClose: () => void; initialUrl:
}}
>
<label className={styles.fieldLabel} htmlFor="vcs-clone-url">
- URL:
+ <T>URL:</T>
</label>
<Input
id="vcs-clone-url"
@@ -176,7 +189,7 @@ function CloneDialog({ onClose, initialUrl }: { onClose: () => void; initialUrl:
onChange={(e) => setUrl(e.target.value)}
/>
<label className={styles.fieldLabel} htmlFor="vcs-clone-dir">
- Directory:
+ <T>Directory:</T>
</label>
<div className={styles.cloneDirRow}>
<Input
@@ -188,7 +201,7 @@ function CloneDialog({ onClose, initialUrl }: { onClose: () => void; initialUrl:
onChange={(e) => setCustomDir(e.target.value)}
/>
<Button disabled={busy} onClick={() => void browse()}>
- Browse…
+ <T>Browse…</T>
</Button>
</div>
{busy && (
diff --git a/src/features/vcs/commitChecks.tsx b/src/features/vcs/commitChecks.tsx
index bbc852edf..242010d23 100644
--- a/src/features/vcs/commitChecks.tsx
+++ b/src/features/vcs/commitChecks.tsx
@@ -134,13 +134,23 @@ async function modifyFile(path: string, mods: Modifications) {
logConsole("info", `${label} skipped for ${baseName(path)}: ${e instanceof Error ? e.message : String(e)}`);
}
};
- if (mods.optimizeImports) await step("Optimize imports", async () => applyKind(info.id, (await call(commands.docSnapshot(info.id))).text, "source.organizeImports"));
- if (mods.cleanup) await step("Cleanup", async () => applyKind(info.id, (await call(commands.docSnapshot(info.id))).text, "source.fixAll"));
+ if (mods.optimizeImports)
+ await step("Optimize imports", async () =>
+ applyKind(info.id, (await call(commands.docSnapshot(info.id))).text, "source.organizeImports"),
+ );
+ if (mods.cleanup)
+ await step("Cleanup", async () =>
+ applyKind(info.id, (await call(commands.docSnapshot(info.id))).text, "source.fixAll"),
+ );
if (mods.reformat)
await step("Reformat code", async () => {
- const editor = useProject.getState().settings?.editor as { tabSize?: number; insertSpaces?: boolean } | undefined;
+ const editor = useProject.getState().settings?.editor as
+ { tabSize?: number; insertSpaces?: boolean } | undefined;
const edits = await call(
- commands.lspFormat(info.id, null, { tabSize: editor?.tabSize ?? 4, insertSpaces: editor?.insertSpaces ?? true }),
+ commands.lspFormat(info.id, null, {
+ tabSize: editor?.tabSize ?? 4,
+ insertSpaces: editor?.insertSpaces ?? true,
+ }),
);
if (edits.length) await call(commands.applyWorkspaceEdit({ files: [{ kind: "edit", path, edits }] }));
});
@@ -166,15 +176,24 @@ function choiceDialog(title: string, body: ReactNode, reviewLabel?: string): Pro
<Dialog
open
title={title}
+ icon="warning"
onClose={() => done("cancel")}
width={520}
buttons={[
- ...(reviewLabel ? [{ label: reviewLabel, onClick: () => done("review") }] : []),
- { label: "Commit Anyway", role: "default", autoFocus: true, onClick: () => done("commit") },
+ // IDEA's check-in handlers default to Review when there is something to review.
+ ...(reviewLabel
+ ? [{ label: reviewLabel, role: "default" as const, autoFocus: true, onClick: () => done("review") }]
+ : []),
+ {
+ label: "Commit Anyway",
+ role: reviewLabel ? ("extra" as const) : ("default" as const),
+ autoFocus: !reviewLabel,
+ onClick: () => done("commit"),
+ },
{ label: "Cancel", role: "cancel", onClick: () => done("cancel") },
]}
>
- <div className={styles.message}>{body}</div>
+ {body}
</Dialog>
);
});
@@ -216,9 +235,16 @@ export async function runCommitChecks(files: readonly CommitCandidate[], amend:
const existing = files.filter((f) => f.exists).map((f) => f.path);
if (!isTauri() || !existing.length) return true;
- const mods: Modifications = { reformat: commit.reformat, optimizeImports: commit.optimizeImports, cleanup: commit.cleanup };
+ const mods: Modifications = {
+ reformat: commit.reformat,
+ optimizeImports: commit.optimizeImports,
+ cleanup: commit.cleanup,
+ };
if (mods.reformat || mods.optimizeImports || mods.cleanup) {
- logConsole("info", `Before commit: ${[mods.optimizeImports && "optimize imports", mods.cleanup && "cleanup", mods.reformat && "reformat code"].filter(Boolean).join(", ")}`);
+ logConsole(
+ "info",
+ `Before commit: ${[mods.optimizeImports && "optimize imports", mods.cleanup && "cleanup", mods.reformat && "reformat code"].filter(Boolean).join(", ")}`,
+ );
for (const p of existing) await modifyFile(p, mods);
try {
await maybeEditorService()?.saveAll();
@@ -244,7 +270,9 @@ 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 parts = [errors && plural(errors, "error"), warnings && plural(warnings, "warning")]
+ .filter(Boolean)
+ .join(" and ");
const choice = await choiceDialog("Code Analysis", `${parts} found in ${plural(n, "file")}.`, "Review");
if (choice === "review") {
try {
@@ -283,7 +311,9 @@ export async function runCommitChecks(files: readonly CommitCandidate[], amend:
<button
type="button"
className={styles.linkButton}
- onClick={() => void maybeEditorService()?.openFile(h.path, { selection: { line: h.line, col: 0 }, focus: true })}
+ onClick={() =>
+ void maybeEditorService()?.openFile(h.path, { selection: { line: h.line, col: 0 }, focus: true })
+ }
>
{relTo(root, h.path)}:{h.line + 1}
</button>{" "}
diff --git a/src/features/vcs/common.module.css b/src/features/vcs/common.module.css
index 2c73d6089..638c378c9 100644
--- a/src/features/vcs/common.module.css
+++ b/src/features/vcs/common.module.css
@@ -12,12 +12,6 @@
color: var(--danger);
font-size: var(--fs-small);
}
-.message {
- padding: 14px;
- color: var(--fg);
- line-height: 1.5;
- white-space: pre-wrap;
-}
.hint {
color: var(--fg-subtle);
font-size: var(--fs-small);
diff --git a/src/features/vcs/confirmations.tsx b/src/features/vcs/confirmations.tsx
index c82e0bbed..3dd960838 100644
--- a/src/features/vcs/confirmations.tsx
+++ b/src/features/vcs/confirmations.tsx
@@ -13,7 +13,6 @@ import { openDialog } from "./dialogs";
import { effectiveKind, relTo, stripSlash } from "./model";
import { runOp } from "./ops";
import { refreshNow, useVcs } from "./store";
-import styles from "./common.module.css";
const inside = (root: string, p: string) => p === root || p.startsWith(root.endsWith("/") ? root : root + "/");
@@ -35,7 +34,9 @@ function matching(paths: readonly string[], kind: "untracked" | "deleted"): stri
function ask(op: FileOperation["kind"], files: string[]): Promise<{ ok: boolean; remember: boolean }> {
const root = useVcs.getState().root ?? "";
return new Promise((resolve) => {
- const close = openDialog(() => <ConfirmDialog op={op} files={files} root={root} onDone={(r) => (close(), resolve(r))} />);
+ const close = openDialog(() => (
+ <ConfirmDialog op={op} files={files} root={root} onDone={(r) => (close(), resolve(r))} />
+ ));
});
}
@@ -58,23 +59,31 @@ function ConfirmDialog({
<Dialog
open
title={add ? "Add File to Git" : "Remove File from Git"}
+ icon="question"
onClose={() => onDone({ ok: false, remember: false })}
width={480}
footerStart={<Checkbox checked={remember} onChange={setRemember} label="Don't ask again" />}
buttons={[
- { label: add ? "Add" : "Remove", role: "default", autoFocus: true, onClick: () => onDone({ ok: true, remember }) },
+ {
+ label: add ? "Add" : "Remove",
+ role: "default",
+ autoFocus: true,
+ onClick: () => onDone({ ok: true, remember }),
+ },
{ label: "Cancel", role: "cancel", onClick: () => onDone({ ok: false, remember }) },
]}
>
- <div className={styles.message}>
- {add ? `Do you want to add the following ${what} to Git?` : `Do you want to remove the following ${what} from Git?`}
+ <>
+ {add
+ ? `Do you want to add the following ${what} to Git?`
+ : `Do you want to remove the following ${what} from Git?`}
{"\n"}
{files
.slice(0, 10)
.map((f) => relTo(root, f))
.join("\n")}
{n > 10 ? "\n…" : ""}
- </div>
+ </>
</Dialog>
);
}
@@ -105,7 +114,9 @@ async function handle(op: FileOperation) {
}
const n = files.length;
await runOp(
- op.kind === "created" ? `Add ${n} file${n === 1 ? "" : "s"} to Git` : `Remove ${n} file${n === 1 ? "" : "s"} from Git`,
+ op.kind === "created"
+ ? `Add ${n} file${n === 1 ? "" : "s"} to Git`
+ : `Remove ${n} file${n === 1 ? "" : "s"} from Git`,
() => call(commands.vcsStage(files)),
);
}
diff --git a/src/features/vcs/conflictsUi.tsx b/src/features/vcs/conflictsUi.tsx
index dea47d384..689f2502b 100644
--- a/src/features/vcs/conflictsUi.tsx
+++ b/src/features/vcs/conflictsUi.tsx
@@ -3,7 +3,7 @@ import { useState } from "react";
import type { FileStatus } from "@/bindings";
import { activeEditor } from "@/editor/api";
import { call, commands } from "@/platform/ipc";
-import { Dialog, Icon, List, fileIconName } from "@/ui";
+import { Dialog, Icon, List, fileIconName, T } from "@/ui";
import { editorService, notifications } from "@/workbench/contributions";
import { blockAt, parseConflicts, resolutionText, type Resolution } from "./conflicts";
import { openDialog } from "./dialogs";
@@ -98,7 +98,9 @@ function ConflictsDialog({ onClose }: { onClose: () => void }) {
]}
>
<div className={styles.section}>
- {files.length ? `${files.length} file${files.length === 1 ? "" : "s"} with conflicts` : "All conflicts resolved"}
+ {files.length
+ ? `${files.length} file${files.length === 1 ? "" : "s"} with conflicts`
+ : "All conflicts resolved"}
</div>
<div style={{ height: 240, display: "flex", flexDirection: "column", padding: "0 14px 14px" }}>
<List
@@ -109,7 +111,11 @@ function ConflictsDialog({ onClose }: { onClose: () => void }) {
rowHeight={22}
aria-label="Conflicted files"
className={styles.boxList}
- empty={<span>No conflicts</span>}
+ empty={
+ <span>
+ <T>No conflicts</T>
+ </span>
+ }
onActivate={(f, _i, e) => {
if (e.type === "click" && (e as unknown as MouseEvent).detail < 2) return;
onClose();
diff --git a/src/features/vcs/dialogs.tsx b/src/features/vcs/dialogs.tsx
index d62debefb..b763702c6 100644
--- a/src/features/vcs/dialogs.tsx
+++ b/src/features/vcs/dialogs.tsx
@@ -131,14 +131,15 @@ export function confirmDialog(opts: ConfirmOptions): Promise<boolean> {
<Dialog
open
title={opts.title}
+ icon={opts.danger ? "warning" : "question"}
onClose={() => done(false)}
- width={440}
+ width={460}
buttons={[
{ label: opts.okLabel ?? "OK", role: "default", autoFocus: true, onClick: () => done(true) },
{ label: "Cancel", role: "cancel" },
]}
>
- <div className={styles.message}>{opts.message}</div>
+ {opts.message}
</Dialog>
);
});
diff --git a/src/features/vcs/operations.tsx b/src/features/vcs/operations.tsx
index 87a954635..db340c71f 100644
--- a/src/features/vcs/operations.tsx
+++ b/src/features/vcs/operations.tsx
@@ -7,7 +7,7 @@ import { useEffect, useState } from "react";
import type { ChangedFile, Commit, ResetMode } from "@/bindings";
import { executeAction } from "@/platform/actions";
import { call, commands } from "@/platform/ipc";
-import { Checkbox, Dialog, Icon, Input, List, Spinner, fileIconName } from "@/ui";
+import { Checkbox, Dialog, Icon, Input, List, Spinner, fileIconName, T } from "@/ui";
import { notifications } from "@/workbench/contributions";
import { openDiff } from "./diffInput";
import { openDialog, promptText } from "./dialogs";
@@ -36,7 +36,13 @@ export function inProgress(op: string | null | undefined = useVcs.getState().bra
/** "Rebasing main", "Merging", "Cherry-picking"… for the branch widget and banner. */
export function operationTitle(op: InProgress, head: string | null): string {
- const verb = { rebase: "Rebasing", merge: "Merging", "cherry-pick": "Cherry-picking", revert: "Reverting", am: "Applying patches" }[op];
+ const verb = {
+ rebase: "Rebasing",
+ merge: "Merging",
+ "cherry-pick": "Cherry-picking",
+ revert: "Reverting",
+ am: "Applying patches",
+ }[op];
return head ? `${verb} ${head}` : verb;
}
@@ -64,7 +70,9 @@ 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
+ ? `No ${OP_NOUN[expected].toLowerCase()} in progress`
+ : "No merge, rebase, cherry-pick or revert in progress",
});
}
@@ -82,7 +90,11 @@ export async function controlOperation(control: "continue" | "skip" | "abort", e
return;
}
const noun = OP_NOUN[op];
- const progress = { continue: `Continuing ${noun.toLowerCase()}`, skip: "Skipping commit", abort: `Aborting ${noun.toLowerCase()}` }[control];
+ const progress = {
+ continue: `Continuing ${noun.toLowerCase()}`,
+ skip: "Skipping commit",
+ abort: `Aborting ${noun.toLowerCase()}`,
+ }[control];
const success = {
continue: `${noun} continued`,
skip: "Commit skipped",
@@ -113,11 +125,15 @@ export function OperationBanner() {
<Icon name={conflicts ? "warning" : "branch"} size={14} />
<span className={styles.bannerText}>
{operationTitle(op, branch?.head ?? null)}
- {conflicts ? ` · ${conflicts} conflict${conflicts === 1 ? "" : "s"}` : op === "merge" ? " · commit to conclude" : ""}
+ {conflicts
+ ? ` · ${conflicts} conflict${conflicts === 1 ? "" : "s"}`
+ : op === "merge"
+ ? " · commit to conclude"
+ : ""}
</span>
{conflicts > 0 && (
<button type="button" className={styles.linkButton} onClick={() => void executeAction("vcs.resolveConflicts")}>
- Resolve…
+ <T>Resolve…</T>
</button>
)}
{operationControls(op).map((c) => (
@@ -144,7 +160,10 @@ const short = (id: string) => id.slice(0, 8);
* Commits newest first in the log's topological order (author dates lie after
* rebases and cherry-picks); commits not loaded in the log fall back to their date.
*/
-export function newestFirst(commits: readonly Commit[], log: readonly Commit[] = useGitLog.getState().commits): Commit[] {
+export function newestFirst(
+ commits: readonly Commit[],
+ log: readonly Commit[] = useGitLog.getState().commits,
+): Commit[] {
const pos = new Map(log.map((c, i) => [c.id, i]));
return [...commits].sort((a, b) => {
const pa = pos.get(a.id);
@@ -158,17 +177,24 @@ export async function cherryPick(commits: Commit[]) {
if (!commits.length) return;
// Oldest first, as IDEA applies them.
const ordered = newestFirst(commits).reverse();
- const label = ordered.length === 1 ? `${short(ordered[0]!.id)} “${ordered[0]!.summary}”` : `${ordered.length} commits`;
+ const label =
+ ordered.length === 1 ? `${short(ordered[0]!.id)} “${ordered[0]!.summary}”` : `${ordered.length} commits`;
await runGitOperation(
{ op: "cherryPick", commits: ordered.map((c) => c.id) },
- { progress: "Cherry-picking", success: `Cherry-picked ${label}`, failure: "Cherry-pick failed", onError: conflictsInstead },
+ {
+ progress: "Cherry-picking",
+ success: `Cherry-picked ${label}`,
+ failure: "Cherry-pick failed",
+ onError: conflictsInstead,
+ },
);
}
export async function revertCommits(commits: Commit[]) {
if (!commits.length) return;
const ordered = newestFirst(commits);
- const label = ordered.length === 1 ? `${short(ordered[0]!.id)} “${ordered[0]!.summary}”` : `${ordered.length} commits`;
+ const label =
+ ordered.length === 1 ? `${short(ordered[0]!.id)} “${ordered[0]!.summary}”` : `${ordered.length} commits`;
await runGitOperation(
{ op: "revert", commits: ordered.map((c) => c.id) },
{ progress: "Reverting", success: `Reverted ${label}`, failure: "Revert failed", onError: conflictsInstead },
@@ -205,7 +231,11 @@ function ResetDialog({ commit, onClose }: { commit?: Commit; onClose: () => void
onClose();
await runGitOperation(
{ op: "reset", commit: rev, mode },
- { progress: "Resetting", success: `Reset ${head} to ${commit ? short(commit.id) : rev} (${mode})`, failure: "Reset failed" },
+ {
+ progress: "Resetting",
+ success: `Reset ${head} to ${commit ? short(commit.id) : rev} (${mode})`,
+ failure: "Reset failed",
+ },
);
};
return (
@@ -222,8 +252,11 @@ function ResetDialog({ commit, onClose }: { commit?: Commit; onClose: () => void
<div className={styles.form} role="radiogroup" aria-label="Reset type">
{commit ? (
<div className={styles.hint}>
- This will reset the current branch head to the selected commit, and update the working tree and the index
- according to the selected mode:
+ <T>
+ {
+ "This will reset the current branch head to the selected commit, and update the working tree and the index according to the selected mode:"
+ }
+ </T>
<div className={styles.mono} style={{ marginTop: 4 }}>
{short(commit.id)} {commit.summary}
</div>
@@ -231,9 +264,15 @@ function ResetDialog({ commit, onClose }: { commit?: Commit; onClose: () => void
) : (
<>
<label className={styles.fieldLabel} htmlFor="openidea-reset-to">
- To commit:
+ <T>To commit:</T>
</label>
- <Input id="openidea-reset-to" data-autofocus mono value={target} onChange={(e) => setTarget(e.target.value)} />
+ <Input
+ id="openidea-reset-to"
+ data-autofocus
+ mono
+ value={target}
+ onChange={(e) => setTarget(e.target.value)}
+ />
</>
)}
{RESET_MODES.map((m) => (
@@ -317,17 +356,24 @@ function TagDialog({ onClose }: { onClose: () => void }) {
>
<div className={styles.form}>
<label className={styles.fieldLabel} htmlFor="openidea-tag-name">
- Tag name:
+ <T>Tag name:</T>
</label>
- <Input id="openidea-tag-name" data-autofocus mono value={name} invalid={!!name && !!error} onChange={(e) => setName(e.target.value)} />
+ <Input
+ id="openidea-tag-name"
+ data-autofocus
+ mono
+ value={name}
+ invalid={!!name && !!error}
+ onChange={(e) => setName(e.target.value)}
+ />
{name && error && <div className={styles.error}>{error}</div>}
<Checkbox checked={force} onChange={setForce} label="Force" />
<label className={styles.fieldLabel} htmlFor="openidea-tag-commit">
- Commit:
+ <T>Commit:</T>
</label>
<Input id="openidea-tag-commit" mono value={commit} onChange={(e) => setCommit(e.target.value)} />
<label className={styles.fieldLabel} htmlFor="openidea-tag-message">
- Message:
+ <T>Message:</T>
</label>
<textarea
id="openidea-tag-message"
@@ -401,7 +447,11 @@ function CompareWithLocalDialog({ rev, label, onClose }: { rev: string; label: s
rowHeight={22}
aria-label="Changed files"
className={styles.boxList}
- empty={<span>No differences</span>}
+ empty={
+ <span>
+ <T>No differences</T>
+ </span>
+ }
onActivate={(f, _i, e) => {
if (e.type === "click" && (e as unknown as MouseEvent).detail < 2) return;
open(f);
@@ -409,7 +459,10 @@ function CompareWithLocalDialog({ rev, label, onClose }: { rev: string; label: s
renderItem={(f) => (
<span className={styles.fileRow} style={{ flex: 1, padding: 0 }}>
<Icon name={fileIconName(baseName(f.path))} size={14} />
- <span className={styles.fileName} style={{ color: KIND_COLOR[f.kind === "untracked" ? "added" : f.kind] }}>
+ <span
+ className={styles.fileName}
+ style={{ color: KIND_COLOR[f.kind === "untracked" ? "added" : f.kind] }}
+ >
{baseName(f.path)}
</span>
<span className={styles.fileDir}>{dirName(f.path)}</span>
@@ -421,4 +474,3 @@ function CompareWithLocalDialog({ rev, label, onClose }: { rev: string; label: s
</Dialog>
);
}
-
diff --git a/src/features/vcs/patches.tsx b/src/features/vcs/patches.tsx
index ca7fb35e8..0c58ead65 100644
--- a/src/features/vcs/patches.tsx
+++ b/src/features/vcs/patches.tsx
@@ -2,7 +2,7 @@
import { useEffect, useState } from "react";
import type { Commit, FileStatus, PatchFile, PatchSource } from "@/bindings";
import { call, commands } from "@/platform/ipc";
-import { Button, Checkbox, Dialog, Icon, Input, List, Spinner, fileIconName } from "@/ui";
+import { Button, Checkbox, Dialog, Icon, Input, List, Spinner, fileIconName, T } from "@/ui";
import { notifications } from "@/workbench/contributions";
import { openDialog } from "./dialogs";
import { KIND_COLOR, baseName, dirName, stripSlash } from "./model";
@@ -22,7 +22,10 @@ export function suggestedPatchName(origin: PatchOrigin, listName: string): strin
? origin.commits[0]!.summary
: `${origin.commits.length} commits`
: listName;
- const clean = base.replace(/[^\p{L}\p{N}._-]+/gu, "_").replace(/^_+|_+$/g, "").slice(0, 60);
+ const clean = base
+ .replace(/[^\p{L}\p{N}._-]+/gu, "_")
+ .replace(/^_+|_+$/g, "")
+ .slice(0, 60);
return `${clean || "changes"}.patch`;
}
@@ -65,7 +68,11 @@ function CreatePatchDialog({ origin, onClose }: { origin: PatchOrigin; onClose:
await saveAll();
const source: PatchSource =
origin.kind === "changes"
- ? { from: "changes", paths: origin.files.filter((f) => selected.has(f.path)).map((f) => stripSlash(f.path)), reverse }
+ ? {
+ from: "changes",
+ paths: origin.files.filter((f) => selected.has(f.path)).map((f) => stripSlash(f.path)),
+ reverse,
+ }
: {
from: "commits",
commits: [...origin.commits].sort((a, b) => (a.timeMs ?? 0) - (b.timeMs ?? 0)).map((c) => c.id),
@@ -94,7 +101,9 @@ function CreatePatchDialog({ origin, onClose }: { origin: PatchOrigin; onClose:
>
{origin.kind === "changes" ? (
<>
- <div className={styles.section}>Changes to include:</div>
+ <div className={styles.section}>
+ <T>Changes to include:</T>
+ </div>
<FileChecklist files={origin.files} selected={selected} onChange={setSelected} label="Files to include" />
</>
) : (
@@ -107,7 +116,9 @@ function CreatePatchDialog({ origin, onClose }: { origin: PatchOrigin; onClose:
<div className={styles.form} role="radiogroup" aria-label="Patch destination">
<label className={styles.radioRow}>
<input type="radio" name="dest" checked={toFile} onChange={() => setToFile(true)} />
- <span className={styles.radioText}>Save to file:</span>
+ <span className={styles.radioText}>
+ <T>Save to file:</T>
+ </span>
</label>
<div className={styles.cloneDirRow}>
<Input
@@ -118,16 +129,15 @@ function CreatePatchDialog({ origin, onClose }: { origin: PatchOrigin; onClose:
value={file}
onChange={(e) => setFile(e.target.value)}
/>
- <Button
- disabled={!toFile}
- onClick={() => void browseSave(file).then((p) => p && setFile(p))}
- >
- Browse…
+ <Button disabled={!toFile} onClick={() => void browseSave(file).then((p) => p && setFile(p))}>
+ <T>Browse…</T>
</Button>
</div>
<label className={styles.radioRow}>
<input type="radio" name="dest" checked={!toFile} onChange={() => setToFile(false)} />
- <span className={styles.radioText}>Copy to clipboard</span>
+ <span className={styles.radioText}>
+ <T>Copy to clipboard</T>
+ </span>
</label>
<Checkbox checked={reverse} onChange={setReverse} label="Reverse patch" />
</div>
@@ -195,7 +205,9 @@ function ApplyPatchDialog({ patch, source, onClose }: { patch: string; source: s
const run = async () => {
onClose();
await saveAll();
- const outcome = await runOp(`Apply patch (${source})`, () => call(commands.vcsApplyPatch(patch)), { refresh: false });
+ const outcome = await runOp(`Apply patch (${source})`, () => call(commands.vcsApplyPatch(patch)), {
+ refresh: false,
+ });
if (outcome) await reportApply(outcome, "Patch applied");
};
return (
@@ -216,7 +228,9 @@ function ApplyPatchDialog({ patch, source, onClose }: { patch: string; source: s
{ label: "Cancel", role: "cancel" },
]}
>
- <div className={styles.section}>{files ? `${files.length} file${files.length === 1 ? "" : "s"} in the patch` : ""}</div>
+ <div className={styles.section}>
+ {files ? `${files.length} file${files.length === 1 ? "" : "s"} in the patch` : ""}
+ </div>
<div style={{ height: 280, display: "flex", flexDirection: "column", padding: "0 14px 14px" }}>
{error ? (
<div className={styles.error}>{error}</div>
@@ -231,7 +245,11 @@ function ApplyPatchDialog({ patch, source, onClose }: { patch: string; source: s
rowHeight={22}
aria-label="Patch files"
className={styles.boxList}
- empty={<span>No changes</span>}
+ empty={
+ <span>
+ <T>No changes</T>
+ </span>
+ }
renderItem={(f) => (
<span
className={styles.fileRow}
@@ -241,7 +259,10 @@ function ApplyPatchDialog({ patch, source, onClose }: { patch: string; source: s
<Icon name={fileIconName(baseName(f.path))} size={14} />
<span
className={styles.fileName}
- style={{ color: KIND_COLOR[f.kind === "untracked" ? "added" : f.kind === "conflicted" ? "conflicted" : f.kind] }}
+ style={{
+ color:
+ KIND_COLOR[f.kind === "untracked" ? "added" : f.kind === "conflicted" ? "conflicted" : f.kind],
+ }}
>
{baseName(f.path)}
</span>
diff --git a/src/features/vcs/rebase.tsx b/src/features/vcs/rebase.tsx
index edb2342dd..f80de5c89 100644
--- a/src/features/vcs/rebase.tsx
+++ b/src/features/vcs/rebase.tsx
@@ -5,7 +5,7 @@
import { useState } from "react";
import type { Commit, RebaseAction, RebaseEntry } from "@/bindings";
import { call, commands } from "@/platform/ipc";
-import { Dialog, IconButton, Select } from "@/ui";
+import { Dialog, IconButton, Select, T } from "@/ui";
import { notifications, toolWindowService } from "@/workbench/contributions";
import { useCommit } from "./commitStore";
import { confirmDialog, openDialog } from "./dialogs";
@@ -126,7 +126,11 @@ export async function editCommitMessage(commit: Commit) {
if (!range) return;
const message = await promptMessage(`Edit Commit Message (${short(commit.id)})`, commit.message);
if (message === null || message.trim() === commit.message.trim()) return;
- await runRebase(range.base, singleCommitPlan(range, commit.id, "reword", message), `Commit message of ${short(commit.id)} changed`);
+ await runRebase(
+ range.base,
+ singleCommitPlan(range, commit.id, "reword", message),
+ `Commit message of ${short(commit.id)} changed`,
+ );
}
/** Drop Commit(s): removes commits from the current branch. */
@@ -145,14 +149,19 @@ export async function dropCommits(commits: Commit[]) {
danger: true,
});
if (!ok) return;
- const plan = range.commits.map((c) => ({ commit: c.id, action: ids.has(c.id) ? ("drop" as const) : ("pick" as const), message: null }));
+ const plan = range.commits.map((c) => ({
+ commit: c.id,
+ action: ids.has(c.id) ? ("drop" as const) : ("pick" as const),
+ message: null,
+ }));
await runRebase(range.base, plan, `Dropped ${commits.length} commits`);
}
async function dropCommit(commit: Commit) {
const range = await rangeFrom(commit, "drop commit");
if (!range) return;
- if (range.commits.length === 1 && !range.base) return warn("Cannot drop commit", "It is the only commit of the branch");
+ if (range.commits.length === 1 && !range.base)
+ return warn("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.`,
@@ -290,7 +299,9 @@ function InteractiveRebaseDialog({ range, onClose }: { range: RebaseRange; onClo
{ label: "Cancel", role: "cancel" },
]}
>
- <div className={styles.section}>Commits are applied from top to bottom.</div>
+ <div className={styles.section}>
+ <T>Commits are applied from top to bottom.</T>
+ </div>
<div className={styles.rebaseList} role="list" aria-label="Commits to rebase">
{rows.map((r, i) => (
<div key={r.commit.id} className={styles.rebaseRow} role="listitem">
diff --git a/src/features/vcs/remoteUi.tsx b/src/features/vcs/remoteUi.tsx
index e7003884c..2efda3781 100644
--- a/src/features/vcs/remoteUi.tsx
+++ b/src/features/vcs/remoteUi.tsx
@@ -4,7 +4,7 @@ import type { Commit, PushTags, RemoteOp } from "@/bindings";
import { call, commands } from "@/platform/ipc";
import { workflowSettings } from "@/platform/workflowSettings";
import { notifications } from "@/workbench/contributions";
-import { Checkbox, Dialog, List, Select, Spinner } from "@/ui";
+import { Checkbox, Dialog, List, Select, Spinner, T } from "@/ui";
import { openDialog } from "./dialogs";
import { formatTime } from "./model";
import { lastRemoteFailure, runRemote, saveAll } from "./ops";
@@ -41,22 +41,30 @@ function UpdateDialog({ onClose }: { onClose: () => void }) {
? `Update ${branch.head ?? "HEAD"} from ${branch.upstream}${branch.behind ? ` (${branch.behind} incoming)` : ""}`
: "The current branch has no tracked branch; git pull may fail."}
</div>
- <div className={styles.fieldLabel}>Update type:</div>
+ <div className={styles.fieldLabel}>
+ <T>Update type:</T>
+ </div>
<label className={styles.radioRow}>
<input type="radio" name="update" checked={!rebase} onChange={() => setRebase(false)} />
<span className={styles.radioText}>
- Merge incoming changes into the current branch
- <span className={styles.hint}>git pull --no-rebase --ff</span>
+ <T>Merge incoming changes into the current branch</T>
+ <span className={styles.hint}>
+ <T>git pull --no-rebase --ff</T>
+ </span>
</span>
</label>
<label className={styles.radioRow}>
<input type="radio" name="update" checked={rebase} onChange={() => setRebase(true)} />
<span className={styles.radioText}>
- Rebase the current branch on top of incoming changes
- <span className={styles.hint}>git pull --rebase</span>
+ <T>Rebase the current branch on top of incoming changes</T>
+ <span className={styles.hint}>
+ <T>git pull --rebase</T>
+ </span>
</span>
</label>
- <div className={styles.hint}>Uncommitted changes are stashed before the update and restored afterwards.</div>
+ <div className={styles.hint}>
+ <T>Uncommitted changes are stashed before the update and restored afterwards.</T>
+ </div>
</div>
</Dialog>
);
@@ -92,7 +100,9 @@ function PushDialog({ target: pushTarget, onClose }: { target: PushTarget; onClo
const head = pushTarget.branch ?? current;
// Another branch, or a partial push: `git push <remote> <src>:<dst>` instead of the plain push.
const explicit = head !== current || !!pushTarget.revision;
- const upstream = explicit ? (branches.find((b) => !b.remote && b.name === head)?.upstream ?? null) : (branch?.upstream ?? null);
+ const upstream = explicit
+ ? (branches.find((b) => !b.remote && b.name === head)?.upstream ?? null)
+ : (branch?.upstream ?? null);
const revision = pushTarget.revision?.id ?? null;
const [setUpstream, setSetUpstream] = useState(!upstream);
const [pushTags, setPushTags] = useState(false);
@@ -232,7 +242,14 @@ export function isProtectedBranch(branch: string, patterns = workflowSettings().
return patterns
.split(/[;,\s]+/)
.filter(Boolean)
- .some((p) => new RegExp(`^${p.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".")}$`).test(branch));
+ .some((p) =>
+ new RegExp(
+ `^${p
+ .replace(/[.+^${}()|[\]\\]/g, "\\$&")
+ .replace(/\*/g, ".*")
+ .replace(/\?/g, ".")}$`,
+ ).test(branch),
+ );
}
/** Rejected because the remote has commits we don't (non-fast-forward). */
@@ -252,7 +269,8 @@ export async function pushWithAutoUpdate(op: Extract<RemoteOp, { op: "push" }>,
const git = workflowSettings().vcs.git;
const updateAndPush = async () => {
await saveAll();
- if (!(await runRemote({ op: "pull", rebase: git.updateMethod === "rebase" }, "updating after rejected push"))) return false;
+ if (!(await runRemote({ op: "pull", rebase: git.updateMethod === "rebase" }, "updating after rejected push")))
+ return false;
return runRemote(op, detail);
};
if (git.autoUpdateOnPushRejected) return updateAndPush();
diff --git a/src/features/vcs/shelf.tsx b/src/features/vcs/shelf.tsx
index d961fbbc9..5cbc25770 100644
--- a/src/features/vcs/shelf.tsx
+++ b/src/features/vcs/shelf.tsx
@@ -8,7 +8,7 @@ import { create } from "zustand";
import type { ApplyOutcome, FileStatus, ShelvedChangeList } from "@/bindings";
import { executeAction } from "@/platform/actions";
import { call, commands } from "@/platform/ipc";
-import { Checkbox, Dialog, Icon, IconButton, Input, Select, Tree, fileIconName, showContextMenu } from "@/ui";
+import { Checkbox, Dialog, Icon, IconButton, Input, Select, Tree, fileIconName, showContextMenu, T } from "@/ui";
import { notifications, toolWindowService } from "@/workbench/contributions";
import { groupOf } from "./changes";
import { activeList, listOf, moveFiles, relOf, updateChangelists, useChangelists } from "./changelists";
@@ -110,7 +110,15 @@ export function FileChecklist({
);
}
-function ShelveDialog({ files, initialName, onClose }: { files: FileStatus[]; initialName: string; onClose: () => void }) {
+function ShelveDialog({
+ files,
+ initialName,
+ onClose,
+}: {
+ files: FileStatus[];
+ initialName: string;
+ onClose: () => void;
+}) {
const [selected, setSelected] = useState(() => new Set(files.map((f) => f.path)));
const [name, setName] = useState(initialName);
const run = async () => {
@@ -146,13 +154,13 @@ function ShelveDialog({ files, initialName, onClose }: { files: FileStatus[]; in
]}
>
<div className={styles.section}>
- {selected.size} of {files.length} file{files.length === 1 ? "" : "s"} will be shelved and reverted in the working
- tree.
+ {selected.size} of {files.length} file{files.length === 1 ? "" : "s"} will be shelved and reverted in the
+ working tree.
</div>
<FileChecklist files={files} selected={selected} onChange={setSelected} label="Files to shelve" />
<div className={styles.form}>
<label className={styles.fieldLabel} htmlFor="openidea-shelf-name">
- Name:
+ <T>Name:</T>
</label>
<Input id="openidea-shelf-name" data-autofocus value={name} onChange={(e) => setName(e.target.value)} />
</div>
@@ -215,12 +223,17 @@ function UnshelveDialog({ entry, onClose }: { entry: ShelvedChangeList; onClose:
{entry.name} · {entry.files.length} file{entry.files.length === 1 ? "" : "s"}
</div>
<div className={styles.form}>
- <label className={styles.fieldLabel}>Changelist:</label>
+ <label className={styles.fieldLabel}>
+ <T>Changelist:</T>
+ </label>
<Select
value={target}
aria-label="Target changelist"
onChange={setTarget}
- options={lists.lists.map((l) => ({ value: l.id, label: l.id === lists.active ? `${l.name} (active)` : l.name }))}
+ options={lists.lists.map((l) => ({
+ value: l.id,
+ label: l.id === lists.active ? `${l.name} (active)` : l.name,
+ }))}
/>
<Checkbox checked={remove} onChange={setRemove} label="Remove successfully applied files from the shelf" />
</div>
@@ -243,7 +256,12 @@ export async function deleteShelf(entry: ShelvedChangeList) {
}
export async function renameShelf(entry: ShelvedChangeList) {
- const r = await promptText({ title: "Rename Shelved Changes", label: "Name:", initial: entry.name, okLabel: "Rename" });
+ const r = await promptText({
+ title: "Rename Shelved Changes",
+ label: "Name:",
+ initial: entry.name,
+ okLabel: "Rename",
+ });
if (!r || r.value === entry.name) return;
await runOp("Rename shelved changes", () => call(commands.vcsShelfRename(entry.id, r.value)), { refresh: false });
void loadShelves().catch(() => undefined);
diff --git a/src/features/viewers/HexViewer.tsx b/src/features/viewers/HexViewer.tsx
index be1bcb1cc..98e5f8762 100644
--- a/src/features/viewers/HexViewer.tsx
+++ b/src/features/viewers/HexViewer.tsx
@@ -7,7 +7,7 @@ import { useCallback, useEffect, useLayoutEffect, useRef, useState, type Keyboar
import clsx from "clsx";
import { call, commands } from "@/platform/ipc";
import { editorService, type EditorInput } from "@/workbench/contributions";
-import { Icon } from "@/ui";
+import { Icon, T } from "@/ui";
import { formatSize, type BinaryInputData } from "./fileKinds";
import {
BYTES_PER_ROW,
@@ -185,7 +185,7 @@ export function HexViewer({ input }: { input: EditorInput }) {
className={styles.textButton}
onClick={() => void editorService().openFile(path, { asText: true })}
>
- Open as Text
+ <T>Open as Text</T>
</button>
)}
</div>
@@ -202,7 +202,9 @@ export function HexViewer({ input }: { input: EditorInput }) {
</span>
))}
</span>
- <span className={styles.hexAscii}>Decoded text</span>
+ <span className={styles.hexAscii}>
+ <T>Decoded text</T>
+ </span>
</div>
<div
ref={scrollRef}
diff --git a/src/features/viewers/ImageViewer.tsx b/src/features/viewers/ImageViewer.tsx
index 0b76826d7..a8a36bc12 100644
--- a/src/features/viewers/ImageViewer.tsx
+++ b/src/features/viewers/ImageViewer.tsx
@@ -9,7 +9,7 @@ import { create } from "zustand";
import { call, commands } from "@/platform/ipc";
import { setContext } from "@/platform/context";
import { editorService, type EditorInput } from "@/workbench/contributions";
-import { IconButton } from "@/ui";
+import { IconButton, T } from "@/ui";
import { formatSize, isSvgPath } from "./fileKinds";
import { fitZoom, initialZoom, stepZoom, zoomLabel } from "./imageZoom";
import { useForwardFocus } from "./forwardFocus";
@@ -171,7 +171,7 @@ export function ImageViewer({ input }: { input: EditorInput }) {
className={styles.textButton}
onClick={() => void editorService().openFile(path, { asText: true })}
>
- Open as Text
+ <T>Open as Text</T>
</button>
)}
</div>
diff --git a/src/features/welcome/CustomizePage.tsx b/src/features/welcome/CustomizePage.tsx
index 3cc85d71e..1417302bb 100644
--- a/src/features/welcome/CustomizePage.tsx
+++ b/src/features/welcome/CustomizePage.tsx
@@ -8,7 +8,7 @@ import { executeAction } from "@/platform/actions";
import { call, commands, isTauri } from "@/platform/ipc";
import { defaultPreset, PRESET_TITLES } from "@/platform/keymap";
import { useProject } from "@/platform/project";
-import { Checkbox, Select, type SelectOption } from "@/ui";
+import { Checkbox, Select, type SelectOption, T } from "@/ui";
import { notifications } from "@/workbench/contributions";
import { ACCENT_PRESETS, DEFAULT_ACCENT } from "@/workbench/theme";
import { reopenEnabled, setReopenPreference, useSession } from "./session";
@@ -181,7 +181,7 @@ export function CustomizePage() {
onChange={(k) => update("keymap", k, () => setGlobalSetting("keymap", k))}
/>
<button type="button" className={styles.link} onClick={() => void executeAction("settings.keymap")}>
- Configure…
+ <T>Configure…</T>
</button>
</Field>
</Section>
@@ -200,7 +200,7 @@ export function CustomizePage() {
</Section>
<button type="button" className={styles.link} onClick={() => void executeAction("file.settings")}>
- All settings…
+ <T>All settings…</T>
</button>
</div>
);
diff --git a/src/features/welcome/ProjectPopup.module.css b/src/features/welcome/ProjectPopup.module.css
new file mode 100644
index 000000000..f9d828f22
--- /dev/null
+++ b/src/features/welcome/ProjectPopup.module.css
@@ -0,0 +1,111 @@
+/* ProjectWidget popup: 24px action rows, two-line project rows, grey section headers. */
+.popup {
+ padding: 6px 0;
+ min-width: 320px;
+ max-width: min(640px, calc(100vw - 24px));
+}
+.inner {
+ display: flex;
+ flex-direction: column;
+ outline: none;
+}
+.inner:focus-visible {
+ outline: none;
+}
+.search {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ height: var(--h-list-row);
+ margin: 0 6px 4px;
+ padding: 0 8px;
+ border-radius: var(--radius-selection, 5px);
+ background: var(--bg-field, var(--bg-button));
+ box-shadow: inset 0 0 0 1px var(--focus-ring);
+ color: var(--fg-strong);
+ --icon-color: var(--fg-muted);
+}
+.group {
+ display: contents;
+}
+.row {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ min-height: var(--h-list-row);
+ margin: 0 6px;
+ padding: 0 8px;
+ border-radius: var(--radius-selection, 5px);
+ color: var(--fg-strong);
+ white-space: nowrap;
+ cursor: default;
+}
+.projectRow {
+ gap: 10px;
+ padding: 6px 8px;
+}
+.active {
+ background: var(--bg-tree-selected);
+}
+.actionIcon {
+ flex: none;
+ color: var(--fg-muted);
+}
+.label {
+ flex: 1;
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+.separator {
+ height: 1px;
+ margin: 5px 12px;
+ background: var(--border);
+}
+.header {
+ padding: 4px 16px 2px;
+ color: var(--fg-muted);
+ font-size: var(--fs-small);
+ font-weight: 600;
+}
+.badge {
+ align-self: flex-start;
+ margin-top: 1px;
+}
+.text {
+ flex: 1;
+ min-width: 0;
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+}
+.top {
+ display: flex;
+ align-items: baseline;
+ gap: 10px;
+ min-width: 0;
+}
+.name {
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+.branch {
+ display: inline-flex;
+ align-items: center;
+ gap: 3px;
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ font-size: var(--fs-small);
+ color: var(--fg-subtle);
+}
+.path {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ color: var(--fg-subtle);
+ font-size: var(--fs-small);
+}
+.empty {
+ padding: 6px 16px;
+ color: var(--fg-faint);
+}
diff --git a/src/features/welcome/ProjectPopup.tsx b/src/features/welcome/ProjectPopup.tsx
new file mode 100644
index 000000000..fee71cc96
--- /dev/null
+++ b/src/features/welcome/ProjectPopup.tsx
@@ -0,0 +1,209 @@
+import { useEffect, useMemo, useRef, useState, type KeyboardEvent, type ReactNode } from "react";
+import clsx from "clsx";
+import { executeAction, useActions } from "@/platform/actions";
+import { call, commands, isTauri, type OpenProject, type RecentProject } from "@/platform/ipc";
+import { HighlightedText, Icon, Popup, showContextMenu, type IconName, T } from "@/ui";
+import type { ProjectPopupProps } from "@/workbench/contributions";
+import { ProjectBadge, recentMenu } from "./RecentList";
+import { filterRecent, loadRecent, openRecent, removeRecent, useRecent, type RecentMatch } from "./recent";
+import styles from "./ProjectPopup.module.css";
+
+type Entry =
+ { kind: "action"; id: string; label: string; icon: IconName } | { kind: "project"; open: boolean; m: RecentMatch };
+
+const ACTIONS: { id: string; label: string; icon: IconName }[] = [
+ { id: "file.openProject", label: "Open…", icon: "folder" },
+ { id: "vcs.clone", label: "Clone Repository…", icon: "branch" },
+];
+
+function useOpenProjects(): OpenProject[] {
+ const [open, setOpen] = useState<OpenProject[]>([]);
+ useEffect(() => {
+ if (!isTauri()) return;
+ let live = true;
+ void call(commands.windowOpenProjects())
+ .then((list) => live && setOpen(list))
+ .catch(() => undefined);
+ return () => {
+ live = false;
+ };
+ }, []);
+ return open;
+}
+
+/** The title bar project widget's popup, after IDEA's ProjectWidget: actions, open projects, recent projects; type to filter. */
+export function ProjectPopup({ anchor, onClose }: ProjectPopupProps) {
+ const actions = useActions((s) => s.actions);
+ const recent = useRecent((s) => s.projects);
+ const home = useRecent((s) => s.home);
+ const openProjects = useOpenProjects();
+ const [query, setQuery] = useState("");
+ const [active, setActive] = useState(0);
+ const listRef = useRef<HTMLDivElement>(null);
+ useEffect(() => void loadRecent(), []);
+
+ const entries = useMemo<Entry[]>(() => {
+ const openPaths = new Set(openProjects.map((p) => p.root));
+ const asRecent = (p: OpenProject): RecentProject =>
+ recent.find((r) => r.path === p.root) ?? { path: p.root, name: p.name, openedAtMs: null, branch: null };
+ const open = filterRecent(openProjects.map(asRecent), query, home).map((m) => ({
+ kind: "project" as const,
+ open: true,
+ m,
+ }));
+ const rest = filterRecent(
+ recent.filter((r) => !openPaths.has(r.path)),
+ query,
+ home,
+ ).map((m) => ({ kind: "project" as const, open: false, m }));
+ const acts = query ? [] : ACTIONS.filter((a) => actions.has(a.id)).map((a) => ({ kind: "action" as const, ...a }));
+ return [...acts, ...open, ...rest];
+ }, [actions, recent, home, openProjects, query]);
+ const current = Math.min(active, entries.length - 1);
+
+ useEffect(() => {
+ listRef.current?.querySelector(`[data-index="${current}"]`)?.scrollIntoView({ block: "nearest" });
+ }, [current]);
+
+ const activate = (e: Entry | undefined) => {
+ if (!e) return;
+ onClose();
+ if (e.kind === "action") void executeAction(e.id);
+ else if (e.open) void call(commands.windowOpenProject(e.m.project.path, false)).catch(() => undefined);
+ else void openRecent(e.m.project);
+ };
+
+ const onKeyDown = (e: KeyboardEvent) => {
+ const n = entries.length;
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") {
+ e.preventDefault();
+ if (n) setActive((current + (e.key === "ArrowDown" ? 1 : n - 1)) % n);
+ } else if (e.key === "Home" || e.key === "End") {
+ e.preventDefault();
+ setActive(e.key === "Home" ? 0 : n - 1);
+ } else if (e.key === "Enter") {
+ e.preventDefault();
+ activate(entries[current]);
+ } else if (e.key === "Escape" && query) {
+ e.preventDefault();
+ e.stopPropagation();
+ setQuery("");
+ setActive(0);
+ } else if (e.key === "Backspace" && query) {
+ e.preventDefault();
+ setQuery((q) => (e.metaKey ? "" : q.slice(0, -1)));
+ setActive(0);
+ } else if (e.key === "Delete" || (e.key === "Backspace" && e.metaKey)) {
+ const entry = entries[current];
+ if (entry?.kind === "project" && !entry.open) {
+ e.preventDefault();
+ void removeRecent(entry.m.project.path);
+ }
+ } else if (e.key.length === 1 && !e.metaKey && !e.ctrlKey && (query || e.key !== " ")) {
+ e.preventDefault();
+ const ch = e.key;
+ setQuery((q) => q + ch);
+ setActive(0);
+ }
+ };
+
+ const firstOpen = entries.findIndex((e) => e.kind === "project" && e.open);
+ const firstRecent = entries.findIndex((e) => e.kind === "project" && !e.open);
+
+ return (
+ <Popup open anchor={anchor} onClose={onClose} role="dialog" aria-label="Projects" className={styles.popup}>
+ <div
+ ref={listRef}
+ tabIndex={-1}
+ data-autofocus
+ onKeyDown={onKeyDown}
+ className={styles.inner}
+ role="listbox"
+ aria-label="Projects"
+ >
+ {query && (
+ <div className={styles.search} aria-live="polite">
+ <Icon name="search" size={14} />
+ <span>{query}</span>
+ </div>
+ )}
+ {entries.map((e, i) => (
+ <div key={e.kind === "action" ? e.id : `${e.open}:${e.m.project.path}`} className={styles.group}>
+ {i === firstOpen && (
+ <Header first={i === 0}>
+ <T>Open Projects</T>
+ </Header>
+ )}
+ {i === firstRecent && (
+ <Header first={i === 0}>
+ <T>Recent Projects</T>
+ </Header>
+ )}
+ <div
+ role="option"
+ aria-selected={i === current}
+ data-index={i}
+ className={clsx(styles.row, e.kind === "project" && styles.projectRow, i === current && styles.active)}
+ onMouseMove={() => i !== current && setActive(i)}
+ onClick={() => activate(e)}
+ onContextMenu={(ev) => {
+ if (e.kind !== "project" || e.open) return;
+ ev.preventDefault();
+ setActive(i);
+ showContextMenu(ev, recentMenu(e.m.project, onClose));
+ }}
+ >
+ {e.kind === "action" ? (
+ <>
+ <Icon name={e.icon} size={16} className={styles.actionIcon} />
+ <span className={styles.label}>{e.label}</span>
+ </>
+ ) : (
+ <ProjectRow m={e.m} active={i === current} />
+ )}
+ </div>
+ </div>
+ ))}
+ {query && !entries.length && (
+ <div className={styles.empty}>
+ <T>No matching projects</T>
+ </div>
+ )}
+ </div>
+ </Popup>
+ );
+}
+
+function Header({ first, children }: { first: boolean; children: ReactNode }) {
+ return (
+ <>
+ {!first && <div className={styles.separator} role="separator" />}
+ <div className={styles.header}>{children}</div>
+ </>
+ );
+}
+
+function ProjectRow({ m, active }: { m: RecentMatch; active: boolean }) {
+ return (
+ <>
+ <ProjectBadge name={m.project.name} className={styles.badge} />
+ <span className={styles.text}>
+ <span className={styles.top}>
+ <HighlightedText
+ className={styles.name}
+ text={m.project.name}
+ indices={m.nameMatch}
+ tone={active ? "accent" : "strong"}
+ />
+ {m.project.branch && (
+ <span className={styles.branch}>
+ <Icon name="branch" size={11} />
+ {m.project.branch}
+ </span>
+ )}
+ </span>
+ <HighlightedText className={styles.path} text={m.displayPath} indices={m.pathMatch} />
+ </span>
+ </>
+ );
+}
diff --git a/src/features/welcome/ProjectsPage.tsx b/src/features/welcome/ProjectsPage.tsx
index 93f87f1f0..0b07be712 100644
--- a/src/features/welcome/ProjectsPage.tsx
+++ b/src/features/welcome/ProjectsPage.tsx
@@ -14,6 +14,7 @@ import {
Spinner,
listNavigate,
showContextMenu,
+ T,
} from "@/ui";
import { ProjectBadge, recentMenu } from "./RecentList";
import { filterRecent, openRecent, removeRecent, useRecent, type RecentMatch } from "./recent";
@@ -30,9 +31,13 @@ function HeaderButtons() {
onClick={() => void executeAction("file.openProject")}
title={openKey ? `Open (${openKey})` : "Open"}
>
- Open
+ <T>Open</T>
</Button>
- {canClone && <Button onClick={() => void executeAction("vcs.clone")}>Clone Repository</Button>}
+ {canClone && (
+ <Button onClick={() => void executeAction("vcs.clone")}>
+ <T>Clone Repository</T>
+ </Button>
+ )}
</div>
);
}
@@ -44,7 +49,9 @@ function Landing() {
const shortcut = shortcutLabel("file.openProject");
return (
<div className={styles.landing}>
- <div className={styles.landingTitle}>Welcome to OpenIDEA</div>
+ <div className={styles.landingTitle}>
+ <T>Welcome to OpenIDEA</T>
+ </div>
<p className={styles.landingText}>
Open a folder from disk{canClone ? " or clone a repository from version control" : ""}.
<br />
@@ -60,20 +67,20 @@ function Landing() {
<span className={styles.landingIcon}>
<Icon name="folder-open" size={20} />
</span>
- Open
+ <T>Open</T>
</button>
{canClone && (
<button type="button" className={styles.landingAction} onClick={() => void executeAction("vcs.clone")}>
<span className={styles.landingIcon}>
<Icon name="branch" size={20} />
</span>
- Clone Repository
+ <T>Clone Repository</T>
</button>
)}
</div>
{shortcut && (
<div className={styles.landingHint}>
- Open a folder <Kbd>{shortcut}</Kbd>
+ <T>Open a folder</T> <Kbd>{shortcut}</Kbd>
</div>
)}
</div>
@@ -245,7 +252,11 @@ export function ProjectsPage() {
onOpen={() => void openRecent(m.project)}
/>
))}
- {items.length === 0 && <div className={styles.noMatches}>No matching projects</div>}
+ {items.length === 0 && (
+ <div className={styles.noMatches}>
+ <T>No matching projects</T>
+ </div>
+ )}
</div>
</div>
);
diff --git a/src/features/welcome/RecentProjectsPopup.tsx b/src/features/welcome/RecentProjectsPopup.tsx
index 7975df271..69bcf3c82 100644
--- a/src/features/welcome/RecentProjectsPopup.tsx
+++ b/src/features/welcome/RecentProjectsPopup.tsx
@@ -1,7 +1,7 @@
import { useEffect } from "react";
import { create } from "zustand";
import { useProject } from "@/platform/project";
-import { Dialog } from "@/ui";
+import { Dialog, T } from "@/ui";
import { RecentList } from "./RecentList";
import { loadRecent } from "./recent";
import styles from "./Welcome.module.css";
@@ -31,7 +31,9 @@ export function RecentProjectsPopup() {
aria-label="Recent Projects"
className={styles.popup}
>
- <div className={styles.popupHeader}>Recent Projects</div>
+ <div className={styles.popupHeader}>
+ <T>Recent Projects</T>
+ </div>
<RecentList compact autoFocus exclude={current} onOpened={close} className={styles.popupList} />
</Dialog>
);
diff --git a/src/features/welcome/WelcomeView.tsx b/src/features/welcome/WelcomeView.tsx
index bcdbbd229..bc9301cb3 100644
--- a/src/features/welcome/WelcomeView.tsx
+++ b/src/features/welcome/WelcomeView.tsx
@@ -5,7 +5,7 @@ import { executeAction } from "@/platform/actions";
import { useT } from "@/platform/i18n";
import { isTauri } from "@/platform/ipc";
import { useProject } from "@/platform/project";
-import { Icon, IconButton, Menu, Spinner, type MenuItem } from "@/ui";
+import { Icon, IconButton, Menu, Spinner, type MenuItem, T } from "@/ui";
import { useSettingsPages } from "@/workbench/contributions";
import { ErrorBoundary, Slot } from "@/workbench/ErrorBoundary";
import logo from "../../../src-tauri/icons/128x128.png";
@@ -141,7 +141,9 @@ export function WelcomeView() {
<div className={styles.brand}>
<img className={styles.logo} src={logo} alt="" draggable={false} />
<span className={styles.brandText}>
- <span className={styles.appName}>OpenIDEA</span>
+ <span className={styles.appName}>
+ <T>OpenIDEA</T>
+ </span>
{version && <span className={styles.version}>{version}</span>}
</span>
</div>
@@ -171,7 +173,7 @@ export function WelcomeView() {
{dropping && (
<div className={styles.dropOverlay} aria-hidden>
<Icon name="folder-open" size={20} />
- Drop a folder to open it as a project
+ <T>Drop a folder to open it as a project</T>
</div>
)}
</section>
diff --git a/src/features/welcome/index.ts b/src/features/welcome/index.ts
index af3943e89..09cfcf53c 100644
--- a/src/features/welcome/index.ts
+++ b/src/features/welcome/index.ts
@@ -1,6 +1,7 @@
/** Welcome screen, recent projects (File › Open Recent) and reopening the last project on startup. */
import { registerActions } from "@/platform/actions";
-import { provideWelcomeView, registerOverlay } from "@/workbench/contributions";
+import { provideProjectPopup, provideWelcomeView, registerOverlay } from "@/workbench/contributions";
+import { ProjectPopup } from "./ProjectPopup";
import { RecentProjectsPopup, showRecentProjectsPopup } from "./RecentProjectsPopup";
import { reopenLastProject, trackSession } from "./session";
import { WelcomeView } from "./WelcomeView";
@@ -9,6 +10,7 @@ export function activate(): () => void {
const disposers = [
trackSession(),
provideWelcomeView(WelcomeView),
+ provideProjectPopup(ProjectPopup),
registerOverlay({ id: "welcome.recentProjects", component: RecentProjectsPopup }),
registerActions([
{
diff --git a/src/platform/actions.ts b/src/platform/actions.ts
index 327714bfd..0f605e8a4 100644
--- a/src/platform/actions.ts
+++ b/src/platform/actions.ts
@@ -9,9 +9,15 @@
* category: "Code", when: "editorFocus", run: () => … });
*
* Default keybindings live in keymaps (`keymap.ts`), not on the action.
+ *
+ * Titles are written in English; `action.<id>`, `action.<id>.description` and
+ * `action.category.<category>` catalog keys, else the source-text catalog
+ * (`tx`), translate them, and the registry re-localises on locale change. The
+ * English title stays searchable.
*/
import { create } from "zustand";
import { evaluateWhen, getContext, type ContextKeys } from "./context";
+import { formatMessage, lookup, tx, useI18n } from "./i18n";
export interface ActionContext {
ctx: ContextKeys;
@@ -53,16 +59,53 @@ interface ActionStore {
export const useActions = create<ActionStore>(() => ({ actions: new Map() }));
+/** Registered actions as written (English), by id; the store holds their localised copies. */
+const sources = new Map<string, Action>();
+
+function translated(key: string): string | undefined {
+ const message = lookup(key);
+ return message === undefined ? undefined : formatMessage(message, {}, useI18n.getState().locale);
+}
+
+/** Catalog key, else the source-text catalog; `undefined` when untranslated. */
+function localized(key: string, text: string | undefined): string | undefined {
+ if (!text) return undefined;
+ const v = translated(key) ?? tx(text);
+ return v === text ? undefined : v;
+}
+
+function localize(action: Action): Action {
+ const title = localized(`action.${action.id}`, action.title);
+ const description = localized(`action.${action.id}.description`, action.description);
+ const category = localized(`action.category.${action.category}`, action.category);
+ if (!title && !description && !category) return action;
+ return {
+ ...action,
+ title: title ?? action.title,
+ description: description ?? action.description,
+ category: category ?? action.category,
+ keywords: title ? [...(action.keywords ?? []), action.title] : action.keywords,
+ };
+}
+
+useI18n.subscribe((s, prev) => {
+ if ((s.messages === prev.messages && s.texts === prev.texts) || !sources.size) return;
+ useActions.setState({ actions: new Map([...sources].map(([id, a]) => [id, localize(a)])) });
+});
+
/** Registers an action; returns a disposer. Re-registering an id replaces it. */
export function registerAction(action: Action): () => void {
- useActions.setState((s) => ({ actions: new Map(s.actions).set(action.id, action) }));
- return () =>
+ sources.set(action.id, action);
+ useActions.setState((s) => ({ actions: new Map(s.actions).set(action.id, localize(action)) }));
+ return () => {
+ if (sources.get(action.id) !== action) return;
+ sources.delete(action.id);
useActions.setState((s) => {
- if (s.actions.get(action.id) !== action) return s;
const actions = new Map(s.actions);
actions.delete(action.id);
return { actions };
});
+ };
}
export function registerActions(actions: Action[]): () => void {
diff --git a/src/platform/i18n.test.ts b/src/platform/i18n.test.ts
index 5d968c735..71356e702 100644
--- a/src/platform/i18n.test.ts
+++ b/src/platform/i18n.test.ts
@@ -8,10 +8,12 @@ import {
resolveLocale,
setLocale,
t,
+ tx,
useI18n,
} from "./i18n";
import en from "./locales/en.json";
import zh from "./locales/zh.json";
+import zhText from "./locales/text/zh.json";
afterEach(() => _resetI18nForTests());
@@ -105,6 +107,15 @@ describe("t / locales", () => {
expect(t("feature.hello")).toBe("Hello");
});
+ it("translates source text through the locale's text catalog", async () => {
+ await setLocale("en");
+ expect(tx("Sync with OS")).toBe("Sync with OS");
+ await setLocale("zh");
+ expect(tx("Sync with OS")).toBe("与操作系统同步");
+ expect(tx("Some text nobody translated")).toBe("Some text nobody translated");
+ expect(tx(undefined)).toBeUndefined();
+ });
+
it("lists keys by prefix", () => {
const keys = keysWithPrefix("menu.");
expect(keys).toContain("menu.file.save");
@@ -115,6 +126,13 @@ describe("t / locales", () => {
describe("catalogs", () => {
const catalogs: Record<string, Record<string, string>> = { en, zh };
+ it("translate source text into non-empty, different text", () => {
+ for (const [source, text] of Object.entries(zhText as Record<string, string>)) {
+ expect(text.trim(), source).not.toBe("");
+ expect(text, source).not.toBe(source);
+ }
+ });
+
it("have the same keys", () => {
expect(Object.keys(zh).sort()).toEqual(Object.keys(en).sort());
});
diff --git a/src/platform/i18n.ts b/src/platform/i18n.ts
index 6478348ac..1205712d7 100644
--- a/src/platform/i18n.ts
+++ b/src/platform/i18n.ts
@@ -9,6 +9,12 @@
* is the fallback for missing keys; other locales load lazily on `setLocale`.
* Features may also ship catalogs of their own with `registerMessages`.
*
+ * Most UI text is written in English at the call site instead of under a key.
+ * `tx("Sync with OS")` / `useTx()` translate such text through the locale's
+ * source-text catalog (`locales/text/<locale>.json`, English → translation);
+ * the UI primitives (labels, buttons, menus, dialogs, tooltips) apply it to the
+ * strings they are given, and unknown text stays in English.
+ *
* Message syntax (ICU-lite):
* - `{name}` parameter (numbers are locale-formatted);
* - `{n, plural, =0 {none} one {# file} other {# files}}` — `=N` exact
@@ -18,7 +24,7 @@
* - `{n, number}`.
* Branches nest. Unknown parameters are left as written.
*/
-import { useCallback } from "react";
+import { useCallback, useMemo } from "react";
import { create } from "zustand";
import en from "./locales/en.json";
@@ -33,18 +39,22 @@ export type Locale = (typeof SUPPORTED_LOCALES)[number];
const LOCALE_NAMES: Record<Locale, string> = { en: "English", zh: "中文" };
const loaders = import.meta.glob<Catalog>(["./locales/*.json", "!./locales/en.json"], { import: "default" });
+const textLoaders = import.meta.glob<Catalog>("./locales/text/*.json", { import: "default" });
/** Bundled + loaded catalogs and feature-registered messages, per locale. */
const catalogs = new Map<string, Catalog>([[DEFAULT_LOCALE, en as Catalog]]);
const extra = new Map<string, Catalog>();
+const textCatalogs = new Map<string, Catalog>([[DEFAULT_LOCALE, {}]]);
interface I18nState {
locale: string;
/** Effective messages for `locale` (without the English fallback). */
messages: Catalog;
+ /** Source-text catalog of `locale`: English text → translation. */
+ texts: Catalog;
}
-export const useI18n = create<I18nState>(() => ({ locale: DEFAULT_LOCALE, messages: en as Catalog }));
+export const useI18n = create<I18nState>(() => ({ locale: DEFAULT_LOCALE, messages: en as Catalog, texts: {} }));
/** Maps settings values / BCP 47 tags to a supported locale (`zh-CN` → `zh`, `system` → browser). */
export function resolveLocale(input: string | null | undefined): Locale {
@@ -80,6 +90,15 @@ async function loadCatalog(locale: string): Promise<Catalog> {
return catalog;
}
+async function loadTexts(locale: string): Promise<Catalog> {
+ const cached = textCatalogs.get(locale);
+ if (cached) return cached;
+ const load = textLoaders[`./locales/text/${locale}.json`];
+ const catalog = load ? await load() : {};
+ textCatalogs.set(locale, catalog);
+ return catalog;
+}
+
let switchToken = 0;
/** Switches the UI locale (loading its catalog on first use). Unsupported tags fall back to English. */
@@ -87,12 +106,12 @@ export async function setLocale(input: string | null | undefined): Promise<Local
const locale = resolveLocale(input);
const token = ++switchToken;
try {
- await loadCatalog(locale);
+ await Promise.all([loadCatalog(locale), loadTexts(locale)]);
} catch (e) {
console.warn(`cannot load locale ${locale}`, e);
}
if (token === switchToken) {
- useI18n.setState({ locale, messages: merged(locale) });
+ useI18n.setState({ locale, messages: merged(locale), texts: textCatalogs.get(locale) ?? {} });
if (typeof document !== "undefined") document.documentElement.lang = locale;
}
return locale;
@@ -116,7 +135,7 @@ export function registerMessages(locale: string, messages: Catalog): () => void
}
/** The raw message for `key` in the active locale, falling back to English; `undefined` if unknown. */
-export function lookup(key: string, state: I18nState = useI18n.getState()): string | undefined {
+export function lookup(key: string, state: Pick<I18nState, "messages"> = useI18n.getState()): string | undefined {
return state.messages[key] ?? fallback()[key];
}
@@ -126,7 +145,7 @@ export function t(key: string, params?: MessageParams): string {
return translateWith(s, key, params);
}
-function translateWith(s: I18nState, key: string, params?: MessageParams): string {
+function translateWith(s: Pick<I18nState, "locale" | "messages">, key: string, params?: MessageParams): string {
const message = lookup(key, s);
if (message === undefined) return key;
return formatMessage(message, params, s.locale);
@@ -139,6 +158,26 @@ 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. */
+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);
+}
+
+/** `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(text: string): string;
+ function bound(text: string | undefined): string | undefined;
+ function bound(text: string | undefined) {
+ return text && (texts[text] ?? text);
+ }
+ return bound;
+ }, [texts]);
+}
+
/** All keys with `prefix`, across the active catalog and the English fallback. */
export function keysWithPrefix(prefix: string): string[] {
const keys = new Set<string>();
@@ -287,5 +326,5 @@ export function _resetI18nForTests() {
extra.clear();
fallbackCache = null;
switchToken++;
- useI18n.setState({ locale: DEFAULT_LOCALE, messages: en as Catalog });
+ useI18n.setState({ locale: DEFAULT_LOCALE, messages: en as Catalog, texts: {} });
}
diff --git a/src/platform/locales/en.json b/src/platform/locales/en.json
index 571e11fd0..3ca20f166 100644
--- a/src/platform/locales/en.json
+++ b/src/platform/locales/en.json
@@ -34,10 +34,10 @@
"app.category.help": "Help",
"app.category.view": "View",
"app.category.window": "Window",
- "app.exit.body": "Are you sure you want to exit?",
+ "app.exit.body": "Are you sure you want to exit OpenIDEA?",
"app.exit.confirm": "Exit",
"app.exit.dontAsk": "Don't ask again",
- "app.exit.title": "Exit OpenIDEA?",
+ "app.exit.title": "Confirm Exit",
"app.keymap.count": "{count, plural, one {# shortcut} other {# shortcuts}}",
"app.keymap.empty": "No matching shortcuts",
"app.keymap.filter": "Filter by action or shortcut",
@@ -62,10 +62,10 @@
"app.window.openFailed": "Cannot open {name}",
"app.window.pickTitle": "Open in New Window",
"app.window.askTitle": "Open Project",
- "app.window.askBody": "Open the project \"{name}\" in a new window or in this window?",
+ "app.window.askBody": "Projects can either be opened in a new window or replace the project in the current window.\nHow would you like to open \"{name}\"?",
"app.window.askThis": "This Window",
"app.window.askNew": "New Window",
- "app.window.askRemember": "Remember, don't ask again",
+ "app.window.askRemember": "Don't ask again",
"common.cancel": "Cancel",
"common.close": "Close",
"common.copied": "Copied",
@@ -312,5 +312,6 @@
"menu.github.pullRequests": "View Pull Requests",
"menu.github.createPullRequest": "Create Pull Request…",
"menu.github.checkoutPullRequest": "Checkout Pull Request…",
- "menu.github.openInBrowser": "Open on GitHub"
+ "menu.github.openInBrowser": "Open on GitHub",
+ "settings.zoom.hint": "Change with {zoomIn} or {zoomOut}. Set to 100% with {reset}"
}
diff --git a/src/platform/locales/text/zh.json b/src/platform/locales/text/zh.json
new file mode 100644
index 000000000..198f695af
--- /dev/null
+++ b/src/platform/locales/text/zh.json
@@ -0,0 +1,2285 @@
+{
+ "' and its usages to:": "' 及其用法移动到:",
+ "' to:": "' 为:",
+ "(does not exist)": "(不存在)",
+ ") and choose “Open in Find Window”.": ") 并选择“在查找窗口中打开”。",
+ ") contain CRLF line separators and core.autocrlf is not set, so they would be committed with CRLF. Convert them with the line separator widget in the status bar, or set": ") 包含 CRLF 行分隔符且未设置 core.autocrlf,因此将以 CRLF 提交。请使用状态栏中的行分隔符组件进行转换,或设置",
+ ", e.g.": ",例如",
+ ", then press Tab.": ",然后按 Tab。",
+ "? Its query console file stays on disk.": "?其查询控制台文件会保留在磁盘上。",
+ "? This cannot be undone.": "?此操作无法撤消。",
+ "A charset in .editorconfig takes precedence. Change one file's encoding from the status bar.": ".editorconfig 中的 charset 优先。可以从状态栏更改单个文件的编码。",
+ "A command line, e.g. /bin/zsh --login. Leave empty to use the login shell.": "命令行,例如 /bin/zsh --login。留空则使用登录 Shell。",
+ "A line breakpoint that is removed after it is hit": "命中后即移除的行断点",
+ "Abbreviation": "缩写",
+ "Abort Cherry-Pick": "中止拣选",
+ "Abort Merge": "中止合并",
+ "Abort Rebase": "中止变基",
+ "Abort Revert": "中止还原",
+ "Absolute Path": "绝对路径",
+ "Absolute path of the current file": "当前文件的绝对路径",
+ "Accent color": "强调色",
+ "Accent colour": "强调色",
+ "Accept All Theirs": "全部接受他们的",
+ "Accept All Yours": "全部接受您的",
+ "Accept Both (Conflict at Caret)": "全部接受(光标处的冲突)",
+ "Accept Theirs": "接受他们的",
+ "Accept Theirs (Conflict at Caret)": "接受他们的(光标处的冲突)",
+ "Accept Yours": "接受您的",
+ "Accept Yours (Conflict at Caret)": "接受您的(光标处的冲突)",
+ "Accessibility": "辅助功能",
+ "Action id (bind it in Keymap)": "操作 ID(可在“按键映射”中绑定)",
+ "Actions": "操作",
+ "Actions on Save": "保存时操作",
+ "Actions run when a file is saved with Save (⌘S) or Save All. Trailing spaces and the final line break are configured in": "使用“保存”(⌘S) 或“全部保存”保存文件时运行的操作。尾随空格和末尾换行符的配置位置:",
+ "Activate on Save": "保存时激活",
+ "Activate virtualenv": "激活 virtualenv",
+ "Add": "添加",
+ "Add Column": "添加列",
+ "Add Conditional Breakpoint…": "添加条件断点…",
+ "Add Field Watchpoint": "添加字段监视点",
+ "Add File to Git": "将文件添加到 Git",
+ "Add GitHub Pattern": "添加 GitHub 模式",
+ "Add Interpreter…": "添加解释器…",
+ "Add JIRA Pattern": "添加 JIRA 模式",
+ "Add Keyboard Shortcut": "添加键盘快捷键",
+ "Add Kind": "添加类型",
+ "Add Logpoint…": "添加日志点…",
+ "Add Method Breakpoint": "添加方法断点",
+ "Add New Configuration": "添加新配置",
+ "Add Pattern": "添加模式",
+ "Add Python Interpreter": "添加 Python 解释器",
+ "Add Row": "添加行",
+ "Add Template": "添加模板",
+ "Add YouTrack Pattern": "添加 YouTrack 模式",
+ "Add a comment (Markdown)": "添加评论 (Markdown)",
+ "Add one in the Database tool window.": "在“数据库”工具窗口中添加一个。",
+ "Add pattern": "添加模式",
+ "Add silently": "静默添加",
+ "Add to Favorites": "添加到收藏夹",
+ "Add to VCS": "添加到 VCS",
+ "Add to Watches": "添加到监视",
+ "Add unambiguous imports on the fly": "动态添加明确的导入",
+ "Add variable": "添加变量",
+ "Added to the environment of new terminal sessions.": "添加到新终端会话的环境中。",
+ "Additional arguments": "附加实参",
+ "Adjust colors for red-green vision deficiency": "针对红绿色觉缺陷调整颜色",
+ "After Replace": "替换后",
+ "After Stop, the process gets this long to exit after the interrupt before it is killed.": "停止后,进程在收到中断信号后有这么长时间退出,超时将被强制终止。",
+ "All": "全部",
+ "All Places": "所有位置",
+ "All breakpoints": "所有断点",
+ "All conflicts resolved": "所有冲突均已解决",
+ "All letters": "所有字母",
+ "All lines": "所有行",
+ "All settings…": "所有设置…",
+ "Allow placing breakpoints in any file": "允许在任意文件中设置断点",
+ "Also expand in comments and strings": "也在注释和字符串中展开",
+ "Always": "始终",
+ "Always show full path in window header": "始终在窗口标题中显示完整路径",
+ "Amend": "修改",
+ "Analysing…": "正在分析…",
+ "Analyze": "分析",
+ "Analyze Stack Trace": "分析堆栈跟踪",
+ "Analyze Stack Trace or Thread Dump…": "分析堆栈跟踪或线程转储…",
+ "Analyze code": "分析代码",
+ "Annotate with Git Blame": "使用 Git Blame 注解",
+ "Annotation": "注解",
+ "Anonymize literals": "匿名化字面量",
+ "Anonymize variables, fields, methods and types": "匿名化变量、字段、方法和类型",
+ "Another Docker operation is still running": "另一个 Docker 操作仍在运行",
+ "Another Git operation is in progress": "另一个 Git 操作正在进行",
+ "Another GitHub operation is still running": "另一个 GitHub 操作仍在运行",
+ "Another remote operation is in progress": "另一个远程操作正在进行",
+ "Antialiasing": "抗锯齿",
+ "Appearance": "外观",
+ "Appearance & Behavior": "外观与行为",
+ "Appearance…": "外观…",
+ "Application Settings": "应用程序设置",
+ "Applies cleanly": "可以干净地应用",
+ "Applies fix-all code actions.": "应用全部修复代码操作。",
+ "Applies the import quick fix of an unresolved reference when the language server offers exactly one.": "当语言服务器只提供一个快速修复时,自动应用未解析引用的导入修复。",
+ "Applies the language server's fix-all action (source.fixAll).": "应用语言服务器的全部修复操作 (source.fixAll)。",
+ "Applies to editor tabs and tool window buttons": "适用于编辑器标签页和工具窗口按钮",
+ "Apply": "应用",
+ "Apply Patch from Clipboard…": "从剪贴板应用补丁…",
+ "Apply Patch…": "应用补丁…",
+ "Apply Stash": "应用储藏",
+ "Approve…": "批准…",
+ "Arguments": "实参",
+ "Arrow function": "箭头函数",
+ "As typed": "按输入",
+ "Ask": "询问",
+ "Asks for a value when the tool runs": "工具运行时询问一个值",
+ "Assignees:": "负责人:",
+ "Async function": "异步函数",
+ "Async test case": "异步测试用例",
+ "Attach Debugger": "附加调试器",
+ "Attach the debugger to a running Java, Node.js, Python, Go or native process": "将调试器附加到正在运行的 Java、Node.js、Python、Go 或原生进程",
+ "Attach to Process": "附加到进程",
+ "Attach to Process…": "附加到进程…",
+ "Attach to process": "附加到进程",
+ "Attach to subprocess automatically while debugging": "调试时自动附加到子进程",
+ "Attaching needs the desktop app": "附加需要桌面应用",
+ "Audible bell": "响铃",
+ "Authentication:": "身份验证:",
+ "Auto": "自动",
+ "Auto Import": "自动导入",
+ "Auto-detected": "自动检测",
+ "Auto-update if push of the current branch was rejected": "当前分支推送被拒绝时自动更新",
+ "Autosave": "自动保存",
+ "Autoscroll from Source": "从源代码自动滚动",
+ "Available": "可用",
+ "Available plugins": "可用插件",
+ "Back": "后退",
+ "Backend malloc in use": "后端 malloc 使用量",
+ "Backend set-up": "后端初始化",
+ "Background": "背景",
+ "Background Tasks": "后台任务",
+ "Background tasks": "后台任务",
+ "Balloon": "气球",
+ "Base branch": "基础分支",
+ "Base interpreter": "基础解释器",
+ "Base interpreter:": "基础解释器:",
+ "Base:": "基础:",
+ "Based on syntax (language server not ready)": "基于语法(语言服务器尚未就绪)",
+ "Behavior": "行为",
+ "Benchmark function": "基准测试函数",
+ "Binary response": "二进制响应",
+ "Blank line between subject and body": "主题和正文之间空一行",
+ "Blinking cursor": "闪烁光标",
+ "Block": "块",
+ "Blue": "蓝色",
+ "Bold": "粗体",
+ "Bookmarks": "书签",
+ "Bottom": "底部",
+ "Branch": "分支",
+ "Branch, %": "分支,%",
+ "Branch, tag or commit hash": "分支、标签或提交哈希",
+ "Branches": "分支",
+ "Branches…": "分支…",
+ "Breadcrumb": "痕迹导航",
+ "Breadcrumbs": "痕迹导航",
+ "Breakpoint properties": "断点属性",
+ "Breakpoints": "断点",
+ "Breakpoints can't be placed in this file": "无法在此文件中设置断点",
+ "Browse": "浏览",
+ "Browse…": "浏览…",
+ "Build": "构建",
+ "Build Artifacts": "构建工件",
+ "Build Module": "构建模块",
+ "Build Project": "构建项目",
+ "Build failed": "构建失败",
+ "Build files changed since the last reload": "自上次重新加载以来构建文件已更改",
+ "Build output": "构建输出",
+ "Build the project to see compiler messages here": "构建项目后,编译器消息将显示在这里",
+ "Build, Execution, Deployment": "构建、执行、部署",
+ "Building": "正在构建",
+ "Bundled": "捆绑",
+ "Caches cleared": "缓存已清除",
+ "Call Hierarchy": "调用层次结构",
+ "Call Tree": "调用树",
+ "Call hierarchy": "调用层次结构",
+ "Call tree": "调用树",
+ "Calls on the current line": "当前行中的调用",
+ "Cancel": "取消",
+ "Cancel Exclusion": "取消排除",
+ "Cancel Running Statement": "取消正在运行的语句",
+ "Cannot add a field watchpoint": "无法添加字段监视点",
+ "Cannot annotate": "无法注解",
+ "Cannot change line separators": "无法更改行分隔符",
+ "Cannot commit": "无法提交",
+ "Cannot convert encoding": "无法转换编码",
+ "Cannot create scratch file": "无法创建临时文件",
+ "Cannot create the HTTP request file": "无法创建 HTTP 请求文件",
+ "Cannot duplicate the data source": "无法复制数据源",
+ "Cannot execute": "无法执行",
+ "Cannot export data": "无法导出数据",
+ "Cannot generate the DDL": "无法生成 DDL",
+ "Cannot open file": "无法打开文件",
+ "Cannot open library class": "无法打开库类",
+ "Cannot open link": "无法打开链接",
+ "Cannot open the query console": "无法打开查询控制台",
+ "Cannot open the response": "无法打开响应",
+ "Cannot put label": "无法添加标签",
+ "Cannot read data sources": "无法读取数据源",
+ "Cannot read the file:": "无法读取文件:",
+ "Cannot read the patch": "无法读取补丁",
+ "Cannot reload Gradle projects": "无法重新加载 Gradle 项目",
+ "Cannot reload Maven projects": "无法重新加载 Maven 项目",
+ "Cannot reload from disk": "无法从磁盘重新加载",
+ "Cannot reload with encoding": "无法使用该编码重新加载",
+ "Cannot remove recent project": "无法移除最近的项目",
+ "Cannot roll back": "无法回滚",
+ "Cannot run the script": "无法运行脚本",
+ "Cannot save run configurations": "无法保存运行配置",
+ "Cannot save setting": "无法保存设置",
+ "Cannot send the request": "无法发送请求",
+ "Cannot show the image:": "无法显示图像:",
+ "Cannot stop process": "无法停止进程",
+ "Cannot undo": "无法撤消",
+ "Caret blinking (ms):": "光标闪烁(毫秒):",
+ "Caret column number (1-based)": "光标所在列号(从 1 开始)",
+ "Caret line number (1-based)": "光标所在行号(从 1 开始)",
+ "Caret should be positioned at the name of the element to be refactored": "光标应位于要重构的元素名称上",
+ "Cascade": "级联",
+ "Case sensitive": "区分大小写",
+ "Change Signature…": "更改签名…",
+ "Change actions": "更改操作",
+ "Change font size with Command+Mouse Wheel": "使用 Command+鼠标滚轮更改字体大小",
+ "Change with": "更改方式:",
+ "Changed files": "已更改的文件",
+ "Changelist:": "更改列表:",
+ "Changes": "更改",
+ "Changes to include:": "要包括的更改:",
+ "Changes were not submitted": "更改未提交",
+ "Check TODO": "检查 TODO",
+ "Check out a branch to create a pull request from": "请先签出一个分支,再从它创建拉取请求",
+ "Checking installed tools…": "正在检查已安装的工具…",
+ "Checking tools": "正在检查工具",
+ "Checkout": "签出",
+ "Checkout Pull Request…": "签出拉取请求…",
+ "Checkout Revision": "签出修订",
+ "Checkout Tag or Revision": "签出标签或修订",
+ "Checkout Tag or Revision…": "签出标签或修订…",
+ "Checkout branch": "签出分支",
+ "Checks out the selected pull request, a number given as argument, or asks for one.": "签出所选拉取请求或参数指定编号的拉取请求,否则询问编号。",
+ "Checks ·": "检查 ·",
+ "Cherry-Pick": "拣选",
+ "Children": "子项",
+ "Choose Content to Paste": "选择要粘贴的内容",
+ "Choose a data source for this console": "为此控制台选择数据源",
+ "Choose configuration to debug": "选择要调试的配置",
+ "Choose the Statement to Unwrap/Remove": "选择要解包/移除的语句",
+ "Choose which call on the current line to step into": "选择要步入当前行中的哪个调用",
+ "Class": "类",
+ "Classes": "类",
+ "Classes changed": "类已更改",
+ "Cleans the build outputs, then builds the project": "清理构建输出,然后构建项目",
+ "Cleanup": "清理",
+ "Clear": "清除",
+ "Clear All": "全部清除",
+ "Clear Buffer": "清除缓冲区",
+ "Clear Caches": "清除缓存",
+ "Clear Console": "清空控制台",
+ "Clear Filtering": "清除过滤",
+ "Clear History": "清除历史记录",
+ "Clear Terminal Buffer": "清除终端缓冲区",
+ "Clear build tool caches (Maven / Gradle sync results)": "清除构建工具缓存(Maven / Gradle 同步结果)",
+ "Clear caches": "清除缓存",
+ "Clear file system cache and Local History": "清除文件系统缓存和本地历史记录",
+ "Clear language server workspaces (Java import data and indexes)": "清除语言服务器工作区(Java 导入数据和索引)",
+ "Clipboard": "剪贴板",
+ "Clone": "克隆",
+ "Clone Repository": "克隆仓库",
+ "Clone Repository…": "克隆仓库…",
+ "Clone progress": "克隆进度",
+ "Cloned, but the project could not be opened": "已克隆,但无法打开项目",
+ "Cloning requires the desktop app": "克隆需要桌面应用",
+ "Close": "关闭",
+ "Close All Tabs": "关闭所有标签页",
+ "Close All but Pinned": "关闭除已固定外的所有标签页",
+ "Close Annotations": "关闭注解",
+ "Close Other Tabs": "关闭其他标签页",
+ "Close Project": "关闭项目",
+ "Close Session": "关闭会话",
+ "Close Tab": "关闭标签页",
+ "Close Tabs to the Left": "关闭左侧标签页",
+ "Close Tabs to the Right": "关闭右侧标签页",
+ "Close Terminal Session": "关闭终端会话",
+ "Close Unmodified Tabs": "关闭未修改的标签页",
+ "Close least recently used files": "关闭最近最少使用的文件",
+ "Close non-modified files first": "优先关闭未修改的文件",
+ "Close performance overlay": "关闭性能浮层",
+ "Close session when it ends": "会话结束时关闭",
+ "Close stdin (send EOF)": "关闭 stdin(发送 EOF)",
+ "Closed": "已关闭",
+ "Closing Policy": "关闭策略",
+ "Code": "代码",
+ "Code Completion": "代码补全",
+ "Code Editing": "代码编辑",
+ "Code Folding": "代码折叠",
+ "Code Style": "代码样式",
+ "Code breadcrumbs": "代码痕迹导航",
+ "Collapse": "折叠",
+ "Collapse All": "全部折叠",
+ "Collapse Unchanged Fragments": "折叠未更改的片段",
+ "Color Scheme": "配色方案",
+ "Color scheme attributes": "配色方案属性",
+ "Color scheme preview": "配色方案预览",
+ "Color theme": "颜色主题",
+ "Column": "列",
+ "Column Selection Mode": "列选择模式",
+ "Columns": "列",
+ "Comma-separated column numbers, e.g. 80, 100.": "逗号分隔的列号,例如 80, 100。",
+ "Command": "命令",
+ "Command line": "命令行",
+ "Commands": "命令",
+ "Comment": "评论",
+ "Comment:": "注释:",
+ "Comment…": "评论…",
+ "Commit": "提交",
+ "Commit Anyway": "仍然提交",
+ "Commit Changelist…": "提交更改列表…",
+ "Commit Checks": "提交检查",
+ "Commit File…": "提交文件…",
+ "Commit Message": "提交消息",
+ "Commit Message History": "提交消息历史记录",
+ "Commit Message Inspections": "提交消息检查",
+ "Commit Options": "提交选项",
+ "Commit message": "提交消息",
+ "Commit message is empty": "提交消息为空",
+ "Commit:": "提交:",
+ "Commits": "提交",
+ "Commits are applied from top to bottom.": "提交将从上到下依次应用。",
+ "Commits to rebase": "要变基的提交",
+ "Commit…": "提交…",
+ "Compact mode": "紧凑模式",
+ "Companion object": "伴生对象",
+ "Compare Files": "比较文件",
+ "Compare Texts": "比较文本",
+ "Compare With": "比较对象",
+ "Compare With…": "比较对象…",
+ "Compare with Branch or Revision…": "与分支或修订比较…",
+ "Compare with Branch…": "与分支比较…",
+ "Compare with Clipboard": "与剪贴板比较",
+ "Compare with Local": "与本地比较",
+ "Compilation failed: fix the errors and reload again.": "编译失败:请修复错误后重新加载。",
+ "Compiles the module of the current file": "编译当前文件所在的模块",
+ "Compiles the project's sources and tests with its build system": "使用项目的构建系统编译其源代码和测试",
+ "Completions": "补全",
+ "Component with CSS module": "带 CSS 模块的组件",
+ "Condition": "条件",
+ "Configurations": "配置",
+ "Configure Editor Tabs…": "配置编辑器标签页…",
+ "Configure Indents…": "配置缩进…",
+ "Configure…": "配置…",
+ "Confirm Drop": "确认删除",
+ "Confirm before exiting the IDE": "退出 IDE 前确认",
+ "Confirm rerun with process termination": "重新运行并终止进程前确认",
+ "Confirmation": "确认",
+ "Conflicted files": "冲突的文件",
+ "Conflicts": "冲突",
+ "Conflicts:": "冲突:",
+ "Connect": "连接",
+ "Connected": "已连接",
+ "Connecting to Docker…": "正在连接 Docker…",
+ "Connecting to GitHub…": "正在连接 GitHub…",
+ "Console": "控制台",
+ "Container log": "容器日志",
+ "Content root": "内容根",
+ "Context menu": "上下文菜单",
+ "Contexts": "上下文",
+ "Continue": "继续",
+ "Continue Cherry-Pick": "继续拣选",
+ "Continue Rebase": "继续变基",
+ "Continue Revert": "继续还原",
+ "Contributes": "贡献",
+ "Convert to Encoding": "转换为编码",
+ "Copied code keeps the editor's syntax colors and font when pasted into documents and mail.": "复制的代码粘贴到文档和邮件中时会保留编辑器的语法颜色和字体。",
+ "Copy": "复制",
+ "Copy / Paste Special": "复制/选择性粘贴",
+ "Copy Action ID": "复制操作 ID",
+ "Copy All": "全部复制",
+ "Copy Commit Message": "复制提交消息",
+ "Copy Configuration": "复制配置",
+ "Copy Container ID": "复制容器 ID",
+ "Copy Coordinates": "复制坐标",
+ "Copy Image ID": "复制镜像 ID",
+ "Copy Image Name": "复制镜像名称",
+ "Copy Name": "复制名称",
+ "Copy Original Text": "复制原始文本",
+ "Copy Patch to Clipboard": "将补丁复制到剪贴板",
+ "Copy Path": "复制路径",
+ "Copy Path from Project Root": "复制项目根目录起的路径",
+ "Copy Path/Reference…": "复制路径/引用…",
+ "Copy Reference": "复制引用",
+ "Copy Revision Number": "复制修订号",
+ "Copy Revision Numbers": "复制修订号",
+ "Copy Rows as CSV": "将行复制为 CSV",
+ "Copy Rows as TSV": "将行复制为 TSV",
+ "Copy Stack": "复制堆栈",
+ "Copy URL": "复制 URL",
+ "Copy Value": "复制值",
+ "Copy as rich text by default": "默认复制为富文本",
+ "Copy revision number": "复制修订号",
+ "Copy to clipboard": "复制到剪贴板",
+ "Copy to clipboard on selection": "选择时复制到剪贴板",
+ "Copy with Header": "带标题复制",
+ "Copy/Paste": "复制/粘贴",
+ "Could not add the comment": "无法添加评论",
+ "Could not apply theme": "无法应用主题",
+ "Could not clear caches": "无法清除缓存",
+ "Could not fill the new file": "无法填充新文件",
+ "Could not install plugin": "无法安装插件",
+ "Could not invalidate caches": "无法清除缓存",
+ "Could not load the pull request": "无法加载拉取请求",
+ "Could not open project": "无法打开项目",
+ "Could not open the folder picker": "无法打开文件夹选择器",
+ "Could not reach GitHub": "无法连接到 GitHub",
+ "Could not save": "无法保存",
+ "Could not save:": "无法保存:",
+ "Could not submit the review": "无法提交审查",
+ "Coverage": "覆盖率",
+ "Coverage is hidden in editors and the project view.": "覆盖率已在编辑器和项目视图中隐藏。",
+ "Coverage needs the desktop app": "覆盖率需要桌面应用",
+ "Coverage suites": "覆盖率套件",
+ "Create": "创建",
+ "Create Draft": "创建草稿",
+ "Create New Branch": "创建新分支",
+ "Create New Test…": "创建新测试…",
+ "Create Patch": "创建补丁",
+ "Create Patch…": "创建补丁…",
+ "Create Pull Request": "创建拉取请求",
+ "Create Pull Request…": "创建拉取请求…",
+ "Create Run Configuration": "创建运行配置",
+ "Create Run Configuration…": "创建运行配置…",
+ "Create Stash": "创建储藏",
+ "Create Tag": "创建标签",
+ "Create Terminal": "创建终端",
+ "Create Terminal in Container": "在容器中创建终端",
+ "Create UTF-8 files": "创建 UTF-8 文件",
+ "Create a branch for your changes first.": "请先为您的更改创建分支。",
+ "Creating virtual environment": "正在创建虚拟环境",
+ "Current": "当前",
+ "Current Branch": "当前分支",
+ "Current File": "当前文件",
+ "Current date": "当前日期",
+ "Current window": "当前窗口",
+ "Cursor shape": "光标形状",
+ "Custom colour": "自定义颜色",
+ "Custom colour hex": "自定义颜色十六进制值",
+ "Customize": "自定义",
+ "Cut": "剪切",
+ "Data Source": "数据源",
+ "Data Source Properties…": "数据源属性…",
+ "Data Source from File…": "从文件创建数据源…",
+ "Data Source from URL": "从 URL 创建数据源",
+ "Data Source from URL…": "从 URL 创建数据源…",
+ "Data Views": "数据视图",
+ "Data class": "数据类",
+ "Data source": "数据源",
+ "Data source settings": "数据源设置",
+ "Data sources": "数据源",
+ "Data type": "数据类型",
+ "Database": "数据库",
+ "Database actions": "数据库操作",
+ "Database output": "数据库输出",
+ "Database:": "数据库:",
+ "Date": "日期",
+ "Date Formats": "日期格式",
+ "Date format": "日期格式",
+ "Deactivate": "停用",
+ "Debug": "调试",
+ "Debug Configuration": "调试配置",
+ "Debug Context Configuration": "调试上下文配置",
+ "Debug adapter": "调试适配器",
+ "Debug adapters & processes": "调试适配器和进程",
+ "Debug console": "调试控制台",
+ "Debug console input": "调试控制台输入",
+ "Debug sessions": "调试会话",
+ "Debug views": "调试视图",
+ "Debuggable configurations": "可调试的配置",
+ "Debugger": "调试器",
+ "Debugger actions": "调试器操作",
+ "Debugger is not available": "调试器不可用",
+ "Debugging": "正在调试",
+ "Debugging Java needs Microsoft java-debug, loaded into the Java language server. Install it and debug again once jdtls has restarted.": "调试 Java 需要将 Microsoft java-debug 加载到 Java 语言服务器中。请安装它,并在 jdtls 重启后再次调试。",
+ "Debugging needs the desktop app": "调试需要桌面应用",
+ "Debug…": "调试…",
+ "Declaration or Usages": "声明或用法",
+ "Decoded text": "解码的文本",
+ "Decodes files outside the project that are not valid UTF-8.": "用于解码项目外非有效 UTF-8 的文件。",
+ "Default": "默认",
+ "Default Directory": "默认目录",
+ "Default Tab name": "默认标签页名称",
+ "Default directory": "默认目录",
+ "Default encoding": "默认编码",
+ "Default encoding for properties files": "属性文件的默认编码",
+ "Default value": "默认值",
+ "Defaults from the": "默认值来自",
+ "Definition": "定义",
+ "Delete": "删除",
+ "Delete Anyway": "仍然删除",
+ "Delete Bookmark": "删除书签",
+ "Delete Branch": "删除分支",
+ "Delete Changelist": "删除更改列表",
+ "Delete Docker Object…": "删除 Docker 对象…",
+ "Delete Keymap": "删除按键映射",
+ "Delete Remote Branch": "删除远程分支",
+ "Delete Rows": "删除行",
+ "Delete Shelved Changes": "删除已搁置的更改",
+ "Delete all rows of": "删除以下表的所有行:",
+ "Delete local copies of added files": "删除已添加文件的本地副本",
+ "Deleted": "已删除",
+ "Delete…": "删除…",
+ "Description": "描述",
+ "Description (Markdown)": "描述 (Markdown)",
+ "Details": "详细信息",
+ "Detect again": "重新检测",
+ "Detect and use existing file indents for editing": "检测并使用现有文件的缩进进行编辑",
+ "Detected from the project. Changes are saved as a user configuration that overrides it.": "从项目中检测到。更改将保存为覆盖它的用户配置。",
+ "Detected from the toolchain": "从工具链检测到",
+ "Detecting installations": "正在检测安装",
+ "Detecting…": "正在检测…",
+ "Dev plugin": "开发插件",
+ "Diff": "差异",
+ "Different tool window background": "不同的工具窗口背景",
+ "Direction": "方向",
+ "Directory": "目录",
+ "Directory (relative to project root)": "目录(相对于项目根目录)",
+ "Directory Mappings": "目录映射",
+ "Directory mappings": "目录映射",
+ "Directory of the current file": "当前文件所在的目录",
+ "Directory of the current file relative to the project": "当前文件所在目录相对于项目的路径",
+ "Directory to Clone Into": "克隆到的目录",
+ "Directory:": "目录:",
+ "Disable": "禁用",
+ "Disable All Downloaded Plugins": "禁用所有已下载的插件",
+ "Disabled": "已禁用",
+ "Dismiss": "关闭",
+ "Display balloon notifications": "显示气球通知",
+ "Display icons in menu items": "在菜单项中显示图标",
+ "Distinguish projects with different colors in the main toolbar": "在主工具栏中用不同颜色区分项目",
+ "Distraction free mode text width:": "无干扰模式文本宽度:",
+ "Do Refactor": "执行重构",
+ "Do not add": "不添加",
+ "Do not ask again": "不再询问",
+ "Do not highlight": "不高亮",
+ "Do not ignore": "不忽略",
+ "Do not remove": "不移除",
+ "Do not step into library scripts": "不要步入库脚本",
+ "Docker is not installed": "未安装 Docker",
+ "Docker is not running": "Docker 未运行",
+ "Documentation": "文档",
+ "Documentation comments": "文档注释",
+ "Does not apply cleanly": "无法干净地应用",
+ "Does not apply cleanly: a 3-way merge will be attempted": "无法干净地应用:将尝试三方合并",
+ "Don't ask again": "不再询问",
+ "Done": "完成",
+ "Down": "停止并移除",
+ "Downloaded": "已下载",
+ "Download…": "下载…",
+ "Draft": "草稿",
+ "Drag-and-drop with Alt pressed only": "仅在按住 Alt 时拖放",
+ "Driver": "驱动程序",
+ "Driver:": "驱动程序:",
+ "Drop": "删除",
+ "Drop Column": "删除列",
+ "Drop Commit": "丢弃提交",
+ "Drop Commits": "丢弃提交",
+ "Drop Stash": "丢弃储藏",
+ "Drop a folder to open it as a project": "拖放文件夹以将其作为项目打开",
+ "Drop files here to open them": "将文件拖放到此处以打开",
+ "Drop syntax trees and EditorConfig caches, compact the index": "丢弃语法树和 EditorConfig 缓存,压缩索引",
+ "Drop…": "删除…",
+ "Duplicate": "复制",
+ "Duplicate Keymap": "复制按键映射",
+ "Duplicate groups": "重复组",
+ "Duplicates": "重复项",
+ "Duplicate…": "复制…",
+ "Edit": "编辑",
+ "Edit Cell": "编辑单元格",
+ "Edit Changelist": "编辑更改列表",
+ "Edit Changelist…": "编辑更改列表…",
+ "Edit Commit Message…": "编辑提交消息…",
+ "Edit Configurations…": "编辑配置…",
+ "Edit Configuration…": "编辑配置…",
+ "Edit Data": "编辑数据",
+ "Edit the configuration that would run the context before saving it": "在保存前编辑将运行上下文的配置",
+ "Editor": "编辑器",
+ "Editor Actions": "编辑器操作",
+ "Editor Tabs": "编辑器标签页",
+ "Editor color scheme": "编辑器配色方案",
+ "Editor resynchronised": "编辑器已重新同步",
+ "Editor tabs": "编辑器标签页",
+ "Editor › Font": "编辑器 › 字体",
+ "Editor › General": "编辑器 › 常规",
+ "Effect": "效果",
+ "Effect color": "效果颜色",
+ "Effects": "效果",
+ "Element": "元素",
+ "Empty": "空",
+ "Empty file": "空文件",
+ "Enable All Downloaded Plugins": "启用所有已下载的插件",
+ "Enable EditorConfig support": "启用 EditorConfig 支持",
+ "Enable Settings › Build, Execution, Deployment › Debugger › Allow placing breakpoints in any file.": "请启用“设置 › 构建、执行、部署 › 调试器 › 允许在任意文件中设置断点”。",
+ "Enable drag-and-drop functionality in editor": "在编辑器中启用拖放功能",
+ "Enable ligatures": "启用连字",
+ "Enable postfix completion": "启用后缀补全",
+ "Enable preview tab": "启用预览标签页",
+ "Enable when debugging code that uses gevent monkey-patching.": "调试使用 gevent monkey-patching 的代码时启用。",
+ "Enabled": "已启用",
+ "Enabled tools appear in Find Action (⇧⌘A) under “External Tools” and can get shortcuts in Keymap. Output is shown in the Run tool window.": "已启用的工具会出现在“查找操作”(⇧⌘A) 的“外部工具”下,并可以在“按键映射”中设置快捷键。输出显示在“运行”工具窗口中。",
+ "Encoding of the output of processes started from Run configurations.": "从运行配置启动的进程的输出编码。",
+ "Engine": "引擎",
+ "Enhanced for loop": "增强型 for 循环",
+ "Ensure every saved file ends with a line break": "确保每个已保存的文件都以换行符结尾",
+ "Enter a tag, branch or commit hash:": "输入标签、分支或提交哈希:",
+ "Enter the name of new tag:": "输入新标签的名称:",
+ "Enum": "枚举",
+ "Enum class": "枚举类",
+ "Environment": "环境",
+ "Environment variables": "环境变量",
+ "Error Highlighting": "错误高亮",
+ "Ethan Schoonover's Solarized palette, dark variant.": "Ethan Schoonover 的 Solarized 调色板,深色变体。",
+ "Evaluate": "计算",
+ "Evaluate Expression…": "计算表达式…",
+ "Evaluate expression": "计算表达式",
+ "Evaluate expression (↩) or add a watch (⇧⌘↩)": "计算表达式 (↩) 或添加监视 (⇧⌘↩)",
+ "Evaluate in the debug console": "在调试控制台中计算",
+ "Evaluation result": "计算结果",
+ "Exception Breakpoints": "异常断点",
+ "Exception breakpoints": "异常断点",
+ "Exclude": "排除",
+ "Exclude / include (⌫)": "排除/包括 (⌫)",
+ "Exclude patterns": "排除模式",
+ "Excluded": "已排除",
+ "Excluded Folders": "已排除的文件夹",
+ "Excluded usages are skipped.": "已排除的用法将被跳过。",
+ "Execute": "执行",
+ "Execute Gradle Task…": "执行 Gradle 任务…",
+ "Execute Maven Goal…": "执行 Maven 目标…",
+ "Execute SQL Statement": "执行 SQL 语句",
+ "Execute a statement in a query console with ⌘↩.": "在查询控制台中按 ⌘↩ 执行语句。",
+ "Existing changelist": "现有更改列表",
+ "Existing changelist:": "现有更改列表:",
+ "Existing environment": "现有环境",
+ "Exit": "退出",
+ "Expand": "展开",
+ "Expand All": "全部展开",
+ "Expand abbreviations with Tab": "使用 Tab 展开缩写",
+ "Expand folded lines": "展开折叠的行",
+ "Expand templates with Tab": "使用 Tab 展开模板",
+ "Explicitly check for incoming commits on remotes": "显式检查远程上的传入提交",
+ "Export Data": "导出数据",
+ "Expression": "表达式",
+ "Expression to evaluate in the selected frame": "要在所选帧中计算的表达式",
+ "Expressions": "表达式",
+ "Extension": "扩展名",
+ "Extension of the current file": "当前文件的扩展名",
+ "External Linters": "外部 Linter",
+ "External Tools": "外部工具",
+ "External tool": "外部工具",
+ "External tools": "外部工具",
+ "External tools actions": "外部工具操作",
+ "Extract Method…": "提取方法…",
+ "FIXME comment": "FIXME 注释",
+ "Failed": "失败",
+ "Failed to restart language server": "重启语言服务器失败",
+ "Fallback font": "备用字体",
+ "Fetch": "获取",
+ "Fetches remotes in the background so incoming commits show in the Branches popup. Auto stops after an authentication failure.": "在后台获取远程,以便传入的提交显示在“分支”弹出窗口中。“自动”在身份验证失败后停止。",
+ "Field access": "字段访问",
+ "Field modification": "字段修改",
+ "Field watchpoints can be set on Java field declarations, or from the Variables view while suspended.": "字段监视点可以在 Java 字段声明上设置,也可以在挂起时从“变量”视图设置。",
+ "File": "文件",
+ "File Encoding": "文件编码",
+ "File Encodings": "文件编码",
+ "File Encodings Settings…": "文件编码设置…",
+ "File Name": "文件名",
+ "File Structure": "文件结构",
+ "File Types": "文件类型",
+ "File and Code Templates": "文件和代码模板",
+ "File encoding": "文件编码",
+ "File header": "文件头",
+ "File mask": "文件掩码",
+ "File mask:": "文件掩码:",
+ "File name": "文件名",
+ "File name style": "文件名样式",
+ "File name with extension": "带扩展名的文件名",
+ "File name without extension": "不带扩展名的文件名",
+ "File not found": "未找到文件",
+ "File or folder": "文件或文件夹",
+ "File patterns": "文件模式",
+ "File templates": "文件模板",
+ "File:": "文件:",
+ "Files": "文件",
+ "Files to include": "要包括的文件",
+ "Files to roll back": "要回滚的文件",
+ "Files to shelve": "要搁置的文件",
+ "Files will be reverted to the state of the selected commit, but local changes will be kept intact.": "文件将还原到所选提交的状态,但本地更改将保持不变。",
+ "Files will be reverted to the state of the selected commit. Warning: any local changes will be lost.": "文件将还原到所选提交的状态。警告:所有本地更改都将丢失。",
+ "Files won't change, differences will be staged for commit.": "文件不会更改,差异将被暂存以供提交。",
+ "Files won't change, differences won't be staged.": "文件不会更改,差异不会被暂存。",
+ "Filter": "过滤",
+ "Filter TODO Items": "过滤 TODO 项",
+ "Filter branches": "过滤分支",
+ "Filter by Path": "按路径过滤",
+ "Filter by User": "按用户过滤",
+ "Filter by message": "按消息过滤",
+ "Filter by name, PID or command line": "按名称、PID 或命令行过滤",
+ "Filter by tool or language": "按工具或语言过滤",
+ "Filter language servers": "过滤语言服务器",
+ "Filter plugins": "过滤插件",
+ "Filter processes": "过滤进程",
+ "Filter recent files": "过滤最近的文件",
+ "Filter recent locations": "过滤最近的位置",
+ "Filter symbols": "过滤符号",
+ "Filter templates": "过滤模板",
+ "Find": "查找",
+ "Find Actions by Shortcut": "按快捷键查找操作",
+ "Find Action…": "查找操作…",
+ "Find Next Occurrence": "查找下一个匹配项",
+ "Find Previous Occurrence": "查找上一个匹配项",
+ "Find Usages": "查找用法",
+ "Find Usages of File": "查找文件的用法",
+ "Find actions by shortcut": "按快捷键查找操作",
+ "Find in Directory…": "在目录中查找…",
+ "Find in Files": "在文件中查找",
+ "Find in Files…": "在文件中查找…",
+ "Find in Folder…": "在文件夹中查找…",
+ "Find in Terminal": "在终端中查找",
+ "Find in file": "在文件中查找",
+ "Find in terminal": "在终端中查找",
+ "Find results": "查找结果",
+ "Find…": "查找…",
+ "First letter only": "仅首字母",
+ "First stroke": "第一次击键",
+ "First stroke:": "第一次击键:",
+ "Fix the highlighted fields": "请修复高亮显示的字段",
+ "Flame Graph": "火焰图",
+ "Flame graph": "火焰图",
+ "Focus Editor": "聚焦编辑器",
+ "Focus application on breakpoint": "在断点处聚焦应用程序",
+ "Fold Selection / Remove Region": "折叠所选内容/移除区域",
+ "Fold by default:": "默认折叠:",
+ "Fold console lines that contain": "折叠包含以下内容的控制台行",
+ "Folders containing modified files are coloured in the Project tool window.": "包含已修改文件的文件夹会在“项目”工具窗口中着色。",
+ "Folding": "折叠",
+ "Follows the IDE theme: currently": "跟随 IDE 主题:当前为",
+ "Font": "字体",
+ "Font preview": "字体预览",
+ "For protanopia and deuteranopia.": "适用于红色盲和绿色盲。",
+ "For symbols not supported by the main font": "用于主字体不支持的符号",
+ "Force": "强制",
+ "Force (with lease)": "强制 (with lease)",
+ "Force Delete": "强制删除",
+ "Force Push": "强制推送",
+ "Force Run to Cursor": "强制运行到光标处",
+ "Force Step Into": "强制步入",
+ "Force Step Over": "强制步过",
+ "Foreground": "前景",
+ "Formats the whole file with the language server's formatter.": "使用语言服务器的格式化程序格式化整个文件。",
+ "Forward": "前进",
+ "Found usages": "找到的用法",
+ "Fragment": "片段",
+ "Frames": "帧",
+ "From Template…": "从模板…",
+ "Function": "函数",
+ "Function component": "函数组件",
+ "Function with return type": "带返回类型的函数",
+ "Functions:": "函数:",
+ "General": "常规",
+ "Generate": "生成",
+ "Generate DDL to Clipboard": "生成 DDL 到剪贴板",
+ "Generate DDL to Query Console": "生成 DDL 到查询控制台",
+ "Generate…": "生成…",
+ "Get from Version Control": "从版本控制获取",
+ "Get from Version Control…": "从版本控制获取…",
+ "Gevent compatible": "兼容 Gevent",
+ "Git Branches": "Git 分支",
+ "Git Log": "Git 日志",
+ "Git Reset": "Git 重置",
+ "Git commands run by the IDE appear here.": "IDE 运行的 Git 命令会显示在这里。",
+ "Git console": "Git 控制台",
+ "GitHub CLI is not installed": "未安装 GitHub CLI",
+ "Glob patterns (e.g. **/dist, *.log) hidden from the project tree and skipped by search and indexing.": "从项目树中隐藏并在搜索和索引时跳过的 Glob 模式(例如 **/dist、*.log)。",
+ "Global Encoding": "全局编码",
+ "Go SDK used by gopls and the go run / test configurations.": "gopls 以及 go run / test 配置使用的 Go SDK。",
+ "Go To": "转到",
+ "Go to Child Commit": "转到子提交",
+ "Go to Class…": "转到类…",
+ "Go to DDL": "转到 DDL",
+ "Go to File": "转到文件",
+ "Go to File…": "转到文件…",
+ "Go to Line:Column": "转到行:列",
+ "Go to Line:Column…": "转到行:列…",
+ "Go to Parent Commit": "转到父提交",
+ "Go to Referenced Table": "转到引用的表",
+ "Go to Source": "转到源代码",
+ "Go to Symbol…": "转到符号…",
+ "Gradle actions": "Gradle 操作",
+ "Gradle command line": "Gradle 命令行",
+ "Gradle projects": "Gradle 项目",
+ "Gradle sync failed": "Gradle 同步失败",
+ "Green": "绿色",
+ "Grey": "灰色",
+ "Greyscale": "灰度",
+ "Group": "组",
+ "Group by Directory": "按目录分组",
+ "Groups": "组",
+ "Gutter Icons": "装订区域图标",
+ "HACK comment": "HACK 注释",
+ "HEAD (Current Branch)": "HEAD(当前分支)",
+ "HTML 5 file": "HTML 5 文件",
+ "HTTP Client": "HTTP 客户端",
+ "HTTP Client environments": "HTTP 客户端环境",
+ "Hard": "硬",
+ "Hard wrap at": "硬换行位置",
+ "Hello: Insert Date": "Hello:插入日期",
+ "Hello: Word Count of Active File": "Hello:当前文件字数",
+ "Help": "帮助",
+ "Hex view": "十六进制视图",
+ "Hide": "隐藏",
+ "Hide Active Tool Window": "隐藏活动工具窗口",
+ "Hide All Tool Windows": "隐藏所有工具窗口",
+ "Hide Coverage": "隐藏覆盖率",
+ "Hide Library Frames": "隐藏库帧",
+ "Hide Replace": "隐藏替换",
+ "Hide debug window on process termination": "进程终止时隐藏调试窗口",
+ "Hide install log": "隐藏安装日志",
+ "Hierarchies": "层次结构",
+ "Hierarchy": "层次结构",
+ "Hierarchy actions": "层次结构操作",
+ "High Contrast": "高对比度",
+ "Highlight hyperlinks": "高亮超链接",
+ "Highlight lines": "高亮行",
+ "Highlight on Caret Movement": "光标移动时高亮",
+ "Highlight words": "高亮单词",
+ "Highlighting": "高亮",
+ "Hit count": "命中次数",
+ "Hit count condition": "命中次数条件",
+ "Home moves caret to first non-whitespace character": "Home 键将光标移动到第一个非空白字符",
+ "Homepage": "主页",
+ "Host:": "主机:",
+ "Hot Swap": "HotSwap",
+ "Hot Swap failed": "HotSwap 失败",
+ "HotSwap: compile and reload the changed classes into the running Java debug session": "HotSwap:编译已更改的类并重新加载到正在运行的 Java 调试会话中",
+ "Hovering a variable while suspended evaluates it in the selected frame.": "挂起时悬停变量会在所选帧中计算它。",
+ "IDE Updates": "IDE 更新",
+ "IDE font": "IDE 字体",
+ "IDE font size": "IDE 字体大小",
+ "IPC round trip": "IPC 往返",
+ "Idle seconds": "空闲秒数",
+ "Ignore files and folders": "忽略文件和文件夹",
+ "Ignore whitespace": "忽略空白",
+ "Ignore whitespaces": "忽略空白",
+ "Ignore whitespaces and empty lines": "忽略空白和空行",
+ "Ignored": "已忽略",
+ "Ignored Files and Folders": "忽略的文件和文件夹",
+ "Ignored names": "忽略的名称",
+ "Image": "图像",
+ "Image viewer": "图像查看器",
+ "Implement Members": "实现成员",
+ "Implementation(s)": "实现",
+ "Imports": "导入",
+ "In Project": "在项目中",
+ "In Selection": "在所选内容中",
+ "Include": "包括",
+ "Include non-project items": "包括非项目项",
+ "Include untracked files": "包括未跟踪的文件",
+ "Incoming commits": "传入的提交",
+ "Indent": "缩进",
+ "Indent Block": "缩进块",
+ "Indentation": "缩进",
+ "Indents Detection": "缩进检测",
+ "Index": "索引",
+ "Index (indexing…)": "索引(正在编制索引…)",
+ "Indexed for loop": "带索引的 for 循环",
+ "Indexing": "正在编制索引",
+ "Inlay Hints": "嵌入提示",
+ "Inline…": "内联…",
+ "Inner": "内部",
+ "Insert Live Template…": "插入实时模板…",
+ "Insert Macro…": "插入宏…",
+ "Insert pair quote": "插入成对引号",
+ "Insert selected suggestion by pressing space, dot, or other context-dependent keys": "按空格、点或其他上下文相关键时插入所选建议",
+ "Inspect": "检查",
+ "Inspect Code": "检查代码",
+ "Inspect Code…": "检查代码…",
+ "Inspect Docker Object": "检查 Docker 对象",
+ "Inspecting…": "正在检查…",
+ "Inspection Results": "检查结果",
+ "Inspection progress": "检查进度",
+ "Inspection results": "检查结果",
+ "Install": "安装",
+ "Install Docker Desktop, OrbStack, Colima or the Docker Engine and make sure": "请安装 Docker Desktop、OrbStack、Colima 或 Docker Engine,并确保",
+ "Install Language Server / Debugger": "安装语言服务器/调试器",
+ "Install Package": "安装软件包",
+ "Install Plugin from Disk": "从磁盘安装插件",
+ "Install Plugin from Disk…": "从磁盘安装插件…",
+ "Install a plugin folder with": "安装插件文件夹:",
+ "Install and Debug": "安装并调试",
+ "Install gh…": "安装 gh…",
+ "Installed": "已安装",
+ "Installed packages": "已安装的软件包",
+ "Installed plugins": "已安装的插件",
+ "Installing plugin": "正在安装插件",
+ "Intentions": "意图",
+ "Interactively Rebase from Here…": "从此处进行交互式变基…",
+ "Interface": "接口",
+ "Interface type": "接口类型",
+ "Interpreter": "解释器",
+ "Interpreter type": "解释器类型",
+ "Interpreter:": "解释器:",
+ "Introduce Constant…": "引入常量…",
+ "Introduce Field…": "引入字段…",
+ "Introduce Parameter…": "引入形参…",
+ "Introduce Variable…": "引入变量…",
+ "Invalid": "无效",
+ "Invalid pattern:": "无效的模式:",
+ "Invalidate Caches": "清除缓存",
+ "Invalidate Caches…": "清除缓存…",
+ "Invalidate and Restart": "清除并重启",
+ "Islands Dark": "Islands 深色",
+ "Islands Light": "Islands 浅色",
+ "Issue ID": "问题 ID",
+ "Issue Link": "问题链接",
+ "Issue Navigation": "问题导航",
+ "Issue navigation": "问题导航",
+ "Issue navigation links": "问题导航链接",
+ "Italic": "斜体",
+ "JUnit 5 Test": "JUnit 5 测试",
+ "JUnit test": "JUnit 测试",
+ "JVM options": "JVM 选项",
+ "Jump outside closing bracket/quote with Tab": "使用 Tab 跳出右括号/引号",
+ "Jump to Last Tool Window": "跳转到上一个工具窗口",
+ "Jump to Navigation Bar": "跳转到导航栏",
+ "Jump to Query Console…": "跳转到查询控制台…",
+ "Jump to Source": "跳转到源代码",
+ "Just Restart": "仅重启",
+ "Keep": "保留",
+ "Keep Column": "保留列",
+ "Keep local history for": "本地历史记录保留时长",
+ "Keep trailing spaces on caret line": "保留光标所在行的尾随空格",
+ "Key pair": "密钥对",
+ "Keymap": "按键映射",
+ "Keymap:": "按键映射:",
+ "Keymap…": "按键映射…",
+ "Keys are recorded as pressed, including Tab and Esc. Use the buttons to finish.": "按键将按原样记录,包括 Tab 和 Esc。请使用按钮完成。",
+ "Keystroke → paint": "按键 → 绘制",
+ "Keystroke-to-paint latency, IPC round trips and long tasks": "按键到绘制的延迟、IPC 往返和长任务",
+ "Keyword": "关键字",
+ "Kind": "类型",
+ "Kind label": "类型标签",
+ "Kinds": "类型",
+ "Label '": "标签 '",
+ "Label name:": "标签名称:",
+ "Language": "语言",
+ "Language Defaults": "语言默认值",
+ "Language Server": "语言服务器",
+ "Language Servers": "语言服务器",
+ "Language Servers…": "语言服务器…",
+ "Language Services": "语言服务",
+ "Language and Region": "语言和地区",
+ "Language servers": "语言服务器",
+ "Language servers and debug adapters": "语言服务器和调试适配器",
+ "Language support for .toy files: detection, comments and indentation.": ".toy 文件的语言支持:检测、注释和缩进。",
+ "Languages": "语言",
+ "Languages & Frameworks": "语言和框架",
+ "Last 24 Hours": "过去 24 小时",
+ "Last 30 Days": "过去 30 天",
+ "Last 7 Days": "过去 7 天",
+ "Last Edit Location": "上一个编辑位置",
+ "Last Year": "过去一年",
+ "Last commit": "上一次提交",
+ "Leading": "前导",
+ "Leave": "保留",
+ "Leave a comment (optional)": "留下评论(可选)",
+ "Leave a comment (required)": "留下评论(必填)",
+ "Limit body line": "限制正文行",
+ "Limit history to": "历史记录限制为",
+ "Limit subject line": "限制主题行",
+ "Line Separator": "行分隔符",
+ "Line and column": "行和列",
+ "Line height": "行高",
+ "Line separator": "行分隔符",
+ "Line, %": "行,%",
+ "Line:Column Number": "行:列号",
+ "Live Templates": "实时模板",
+ "Live templates": "实时模板",
+ "Loaded classes are up to date. Nothing to reload.": "已加载的类是最新的,无需重新加载。",
+ "Loading packages": "正在加载软件包",
+ "Loading packages…": "正在加载软件包…",
+ "Loading plugins": "正在加载插件",
+ "Loading processes…": "正在加载进程…",
+ "Loading pull requests…": "正在加载拉取请求…",
+ "Loading…": "正在加载…",
+ "Local": "本地",
+ "Local History": "本地历史记录",
+ "Local History of all projects will be deleted.": "所有项目的本地历史记录都将被删除。",
+ "Local History: Put Label…": "本地历史记录:添加标签…",
+ "Local History: Show History": "本地历史记录:显示历史记录",
+ "Locate Duplicates": "查找重复项",
+ "Locate Duplicates…": "查找重复项…",
+ "Location": "位置",
+ "Location:": "位置:",
+ "Log": "日志",
+ "Log filters": "日志过滤器",
+ "Log message": "日志消息",
+ "Log message instead of suspending": "记录消息而不挂起",
+ "Long tasks": "长任务",
+ "Looking for references…": "正在查找引用…",
+ "Looks for TODO and FIXME in added lines.": "在新增的行中查找 TODO 和 FIXME。",
+ "Macros": "宏",
+ "Main Menu": "主菜单",
+ "Make File Read-only": "使文件只读",
+ "Make File Writable": "使文件可写",
+ "Make Read-only": "设为只读",
+ "Make Writable": "设为可写",
+ "Make another changelist active first.": "请先将其他更改列表设为活动。",
+ "Manage": "管理",
+ "Manage Plugins": "管理插件",
+ "Mark Directory as": "将目录标记为",
+ "Mark Resolved": "标记为已解决",
+ "Mark as": "标记为",
+ "Mark as:": "标记为:",
+ "Mark modified (*)": "标记已修改 (*)",
+ "Markdown editor layout": "Markdown 编辑器布局",
+ "Markdown file": "Markdown 文件",
+ "Markdown preview": "Markdown 预览",
+ "Marked folders": "已标记的文件夹",
+ "Match Case": "区分大小写",
+ "Match case:": "区分大小写:",
+ "Matched brace": "匹配的括号",
+ "Matches": "匹配项",
+ "Maven actions": "Maven 操作",
+ "Maven command line": "Maven 命令行",
+ "Maven projects": "Maven 项目",
+ "Maven sync finished with errors": "Maven 同步完成,但有错误",
+ "Maximize": "最大化",
+ "Maximize Tool Window": "最大化工具窗口",
+ "Maximum local history size per project": "每个项目的最大本地历史记录大小",
+ "Maximum number of lines": "最大行数",
+ "Memory Indicator": "内存指示器",
+ "Memory and diagnostics": "内存和诊断",
+ "Merge": "合并",
+ "Merge and Push": "合并并推送",
+ "Merge conflicts": "合并冲突",
+ "Merge incoming changes into the current branch": "将传入的更改合并到当前分支",
+ "Merge of": "合并自",
+ "Merged": "已合并",
+ "Merge…": "合并…",
+ "Message:": "消息:",
+ "Method": "方法",
+ "Method List": "方法列表",
+ "Method name": "方法名",
+ "Mine": "我的",
+ "Minimize": "最小化",
+ "Minimum duplicate size in tokens": "最小重复大小(以词法单元计)",
+ "Minimum size": "最小大小",
+ "Mixed": "混合",
+ "Modified": "已修改",
+ "Modified lines": "修改的行",
+ "Modify Column…": "修改列…",
+ "Modify Run Configuration…": "修改运行配置…",
+ "Modify Table…": "修改表…",
+ "Module": "模块",
+ "More": "更多",
+ "More Actions": "更多操作",
+ "More Run/Debug": "更多运行/调试",
+ "More Terminal Options": "更多终端选项",
+ "More Tool Windows": "更多工具窗口",
+ "Most recently opened tab": "最近打开的标签页",
+ "Mouse Control": "鼠标控制",
+ "Mouse reporting": "鼠标报告",
+ "Move": "移动",
+ "Move Changes to Another Changelist": "将更改移动到其他更改列表",
+ "Move Down": "下移",
+ "Move File…": "移动文件…",
+ "Move To": "移动到",
+ "Move Up": "上移",
+ "Move to Another Changelist…": "移动到其他更改列表…",
+ "Move to Opposite Group": "移至相对组",
+ "Move…": "移动…",
+ "Multiple occurrences found": "找到多个匹配项",
+ "Mute Breakpoints": "静音断点",
+ "Mute breakpoints": "静音断点",
+ "Name": "名称",
+ "Name for the new constant": "新常量的名称",
+ "Name for the new variable": "新变量的名称",
+ "Name of the current file": "当前文件的名称",
+ "Name:": "名称:",
+ "Named scope": "命名范围",
+ "Names (e.g. .DS_Store, *.pyc) hidden from the project tree, navigation bar, search, indexing and Git changes.": "从项目树、导航栏、搜索、索引和 Git 更改中隐藏的名称(例如 .DS_Store、*.pyc)。",
+ "Navigate": "导航",
+ "Navigation": "导航",
+ "Navigation Bar": "导航栏",
+ "Navigation bar": "导航栏",
+ "Never": "从不",
+ "New": "新建",
+ "New Branch…": "新建分支…",
+ "New Changelist": "新建更改列表",
+ "New Changelist…": "新建更改列表…",
+ "New Data Source": "新建数据源",
+ "New Data Source…": "新建数据源…",
+ "New Directory": "新建目录",
+ "New Empty File…": "新建空文件…",
+ "New File": "新建文件",
+ "New HTTP Request": "新建 HTTP 请求",
+ "New Scratch File": "新建临时文件",
+ "New Scratch File…": "新建临时文件…",
+ "New Tab": "新建标签页",
+ "New Tag…": "新建标签…",
+ "New Terminal Tab": "新建终端标签页",
+ "New branch name:": "新分支名称:",
+ "New changelist:": "新更改列表:",
+ "New comment": "新评论",
+ "New environment": "新环境",
+ "New file from template": "从模板新建文件",
+ "New from Template…": "从模板新建…",
+ "New kind": "新类型",
+ "New name": "新名称",
+ "New terminal sessions run the interpreter's virtualenv activate script.": "新的终端会话会运行解释器的 virtualenv 激活脚本。",
+ "New window": "新窗口",
+ "New…": "新建…",
+ "Next Bookmark": "下一个书签",
+ "Next Change": "下一个更改",
+ "Next Conflict": "下一个冲突",
+ "Next Conflict Marker": "下一个冲突标记",
+ "Next Difference": "下一个差异",
+ "Next Edit Location": "下一个编辑位置",
+ "Next Occurrence": "下一个匹配项",
+ "Next Page": "下一页",
+ "Next error action goes to high priority problems only": "“下一个错误”操作仅转到高优先级问题",
+ "No Environment": "无环境",
+ "No GitHub repository": "没有 GitHub 仓库",
+ "No Gradle projects": "没有 Gradle 项目",
+ "No HTTP request at the caret": "光标处没有 HTTP 请求",
+ "No Maven projects": "没有 Maven 项目",
+ "No Python found": "未找到 Python",
+ "No TODO items found": "未找到 TODO 项",
+ "No TODO items in this file": "此文件中没有 TODO 项",
+ "No active editor": "没有活动编辑器",
+ "No antialiasing": "无抗锯齿",
+ "No attachable processes": "没有可附加的进程",
+ "No backend caches to clear": "没有要清除的后端缓存",
+ "No bookmarks yet. Toggle a line bookmark with": "还没有书签。切换行书签:",
+ "No breakpoints. Click a line number to add one.": "没有断点。点击行号即可添加。",
+ "No build output": "没有构建输出",
+ "No changes": "没有更改",
+ "No changes selected for commit": "未选择要提交的更改",
+ "No changes to create a patch from": "没有可用于创建补丁的更改",
+ "No changes to roll back": "没有要回滚的更改",
+ "No changes to shelve": "没有要搁置的更改",
+ "No commits": "没有提交",
+ "No configurations. Click + to add one.": "没有配置。点击 + 添加一个。",
+ "No conflicts": "没有冲突",
+ "No coverage data": "没有覆盖率数据",
+ "No data sources": "没有数据源",
+ "No debug session can reload classes": "没有可以重新加载类的调试会话",
+ "No description provided.": "未提供描述。",
+ "No differences": "没有差异",
+ "No document": "没有文档",
+ "No duplicates found": "未找到重复项",
+ "No editor available": "没有可用的编辑器",
+ "No external tools. Click + to add one.": "没有外部工具。点击 + 添加一个。",
+ "No failed tests to rerun": "没有可重新运行的失败测试",
+ "No field declaration on this line": "此行没有字段声明",
+ "No file is open": "没有打开的文件",
+ "No interpreter selected. Choose one above or add a new one.": "未选择解释器。请在上方选择一个或添加新的解释器。",
+ "No language server available": "没有可用的语言服务器",
+ "No languages": "没有语言",
+ "No local changes": "没有本地更改",
+ "No local history for this": "此项没有本地历史记录:",
+ "No matches": "没有匹配项",
+ "No matching branches": "没有匹配的分支",
+ "No matching languages": "没有匹配的语言",
+ "No matching projects": "没有匹配的项目",
+ "No matching templates": "没有匹配的模板",
+ "No merge conflicts": "没有合并冲突",
+ "No merge, rebase, cherry-pick or revert in progress": "没有正在进行的合并、变基、拣选或还原",
+ "No method declaration on this line": "此行没有方法声明",
+ "No notifications": "没有通知",
+ "No occurrences found": "未找到匹配项",
+ "No patterns": "没有模式",
+ "No plugin selected": "未选择插件",
+ "No popup": "不弹出",
+ "No problems found": "未发现问题",
+ "No problems in this file": "此文件中没有问题",
+ "No profiler snapshots": "没有性能分析快照",
+ "No project is open": "没有打开的项目",
+ "No pull requests": "没有拉取请求",
+ "No requests yet": "还没有请求",
+ "No response selected": "未选择响应",
+ "No results": "没有结果",
+ "No reviews": "没有审查",
+ "No run configuration in this project has a debug adapter.": "此项目中没有带调试适配器的运行配置。",
+ "No run or test configuration of the project matches this file.": "项目中没有与此文件匹配的运行或测试配置。",
+ "No search results": "没有搜索结果",
+ "No special permissions.": "没有特殊权限。",
+ "No structure to show": "没有可显示的结构",
+ "No surround templates for this language": "此语言没有包围模板",
+ "No tools match.": "没有匹配的工具。",
+ "No usages found": "未找到用法",
+ "Node interpreter": "Node 解释器",
+ "None": "无",
+ "None configured": "未配置",
+ "Not debugging": "未在调试",
+ "Not logged in to GitHub": "未登录 GitHub",
+ "Not null": "非空",
+ "Nothing found": "未找到任何内容",
+ "Nothing here": "这里什么都没有",
+ "Nothing is running": "没有正在运行的内容",
+ "Nothing matches": "没有匹配项",
+ "Nothing recorded before this label": "此标签之前没有记录",
+ "Nothing to add: the files are already under version control": "没有要添加的内容:这些文件已受版本控制",
+ "Nothing to debug": "没有可调试的内容",
+ "Nothing to run here": "这里没有可运行的内容",
+ "Nothing to show": "没有可显示的内容",
+ "Nothing to undo": "没有可撤消的内容",
+ "Notification groups": "通知组",
+ "Notifications": "通知",
+ "OK": "确定",
+ "Object": "对象",
+ "Object Actions": "对象操作",
+ "Occurrences": "匹配项",
+ "Occurrences of selected text": "所选文本的匹配项",
+ "Offset 0x": "偏移 0x",
+ "Older output is discarded": "较早的输出将被丢弃",
+ "Only in comments": "仅在注释中",
+ "Open": "打开",
+ "Open Diff": "打开差异",
+ "Open File": "打开文件",
+ "Open Files": "打开的文件",
+ "Open Folder": "打开文件夹",
+ "Open In": "打开方式",
+ "Open In Right Split": "在右侧拆分中打开",
+ "Open Project Path": "打开项目路径",
+ "Open Projects": "打开的项目",
+ "Open Recent…": "打开最近的项目…",
+ "Open a Git repository to commit changes.": "请打开一个 Git 仓库以提交更改。",
+ "Open a file to annotate it": "请打开一个文件进行注解",
+ "Open a file to show its local history": "请打开一个文件以显示其本地历史记录",
+ "Open a folder": "打开文件夹",
+ "Open a folder from disk": "从磁盘打开文件夹",
+ "Open a project first": "请先打开一个项目",
+ "Open a project to configure its folders.": "请打开一个项目以配置其文件夹。",
+ "Open as Text": "作为文本打开",
+ "Open console for tool output": "为工具输出打开控制台",
+ "Open documents": "打开的文档",
+ "Open in Browser": "在浏览器中打开",
+ "Open in Find Tool Window": "在“查找”工具窗口中打开",
+ "Open in Find Window": "在查找窗口中打开",
+ "Open in New Window": "在新窗口中打开",
+ "Open in Terminal": "在终端中打开",
+ "Open in editor": "在编辑器中打开",
+ "Open moved files in editor": "在编辑器中打开已移动的文件",
+ "Open new tabs at the end": "在末尾打开新标签页",
+ "Open on GitHub": "在 GitHub 上打开",
+ "Open or select a file to compare": "打开或选择一个要比较的文件",
+ "Open pom.xml": "打开 pom.xml",
+ "Open project in": "打开项目的位置",
+ "Open to the Side": "在侧边打开",
+ "OpenSSH config and authentication agent": "OpenSSH 配置和身份验证代理",
+ "Opening": "正在打开",
+ "Opening Policy": "打开策略",
+ "Opening folders requires the desktop app": "打开文件夹需要桌面应用",
+ "Opening projects requires the desktop app": "打开项目需要桌面应用",
+ "Open…": "打开…",
+ "Optimize Imports": "优化导入",
+ "Optimize Imports in File": "优化文件中的导入",
+ "Optimize imports": "优化导入",
+ "Optimize imports on the fly": "动态优化导入",
+ "Optional": "可选",
+ "Optional:": "可选:",
+ "Options": "选项",
+ "Orange": "橙色",
+ "Original": "原始",
+ "Other": "其他",
+ "Other File Types": "其他文件类型",
+ "Other hints (chaining, closing labels…)": "其他提示(链式调用、结束标签…)",
+ "Otherwise line breakpoints can only be set in files of languages that have a debugger.": "否则只能在有调试器的语言文件中设置行断点。",
+ "Outgoing commits": "传出的提交",
+ "Output": "输出",
+ "Over budget (": "超出预算(",
+ "Override IDE shortcuts": "覆盖 IDE 快捷键",
+ "Override Members": "重写成员",
+ "Override console cycle buffer size": "覆盖控制台循环缓冲区大小",
+ "Override system date and time format": "覆盖系统日期和时间格式",
+ "Overview": "概览",
+ "Package": "软件包",
+ "Package manager": "软件包管理器",
+ "Package to install": "要安装的软件包",
+ "Packages": "软件包",
+ "Packages the project (mvn package, gradle assemble, cargo build --release, npm run build)": "打包项目(mvn package、gradle assemble、cargo build --release、npm run build)",
+ "Page size": "页面大小",
+ "Parameter Info": "形参信息",
+ "Parameter names": "形参名称",
+ "Parameters": "参数",
+ "Parses (hit / incr. / full)": "解析(命中/增量/完整)",
+ "Partially staged: only staged hunks are committed": "部分暂存:仅提交已暂存的块",
+ "Passed": "已通过",
+ "Passed to rustfmt when reformatting, e.g. --edition 2024": "重新格式化时传递给 rustfmt,例如 --edition 2024",
+ "Passed to the JVM running jdtls (java.jdt.ls.vmargs), e.g. -Xmx2g. A Lombok agent is added automatically when the project uses Lombok.": "传递给运行 jdtls 的 JVM (java.jdt.ls.vmargs),例如 -Xmx2g。项目使用 Lombok 时会自动添加 Lombok 代理。",
+ "Password": "密码",
+ "Password:": "密码:",
+ "Paste": "粘贴",
+ "Paste on middle mouse button click": "点击鼠标中键时粘贴",
+ "Patch copied to the clipboard": "补丁已复制到剪贴板",
+ "Patch destination": "补丁目标",
+ "Patch file": "补丁文件",
+ "Patch files": "补丁文件",
+ "Path From Content Root": "来自内容根的路径",
+ "Path of the current file relative to the project": "当前文件相对于项目的路径",
+ "Path to Git executable": "Git 可执行文件路径",
+ "Paths": "路径",
+ "Pattern": "模式",
+ "Patterns": "模式",
+ "Pause": "暂停",
+ "Pause Program": "暂停程序",
+ "Pause the program to evaluate": "暂停程序以进行计算",
+ "Pending": "待定",
+ "Performance (dev diagnostics)": "性能(开发诊断)",
+ "Performance overlay (dev diagnostics)": "性能浮层(开发诊断)",
+ "Permissions": "权限",
+ "Physical memory": "物理内存",
+ "Pick": "拣选",
+ "Pick one in the toolbar above the editor.": "在编辑器上方的工具栏中选择一个。",
+ "Pin / Unpin Tab": "固定/取消固定标签页",
+ "Pin Tab": "固定标签页",
+ "Pinned": "已固定",
+ "Placeholders:": "占位符:",
+ "Placeholders: yyyy, yy, MMMM, MMM, MM, M, dd, d": "占位符:yyyy、yy、MMMM、MMM、MM、M、dd、d",
+ "Play sound": "播放声音",
+ "Plugin": "插件",
+ "Plugin details": "插件详细信息",
+ "Plugin sources": "插件来源",
+ "Plugins": "插件",
+ "Plugins are folders with a": "插件是项目中包含",
+ "Plugins…": "插件…",
+ "Pop Stash": "弹出储藏",
+ "Pop Stash (Apply and Drop)": "弹出储藏(应用并丢弃)",
+ "Popup type": "弹出类型",
+ "Port:": "端口:",
+ "Postfix Completion": "后缀补全",
+ "Postfix templates": "后缀模板",
+ "Prefer": "首选",
+ "Prefer moving caret line to minimize editor scrolling": "优先移动光标所在行,以尽量减少编辑器滚动",
+ "Prefer scrolling editor canvas to keep caret line centered": "优先滚动编辑器画布,使光标所在行保持居中",
+ "Preferred dark theme": "首选深色主题",
+ "Preferred light theme": "首选浅色主题",
+ "Preferred theme for dark OS mode": "操作系统深色模式下的首选主题",
+ "Preferred theme for light OS mode": "操作系统浅色模式下的首选主题",
+ "Preferred themes": "首选主题",
+ "Preferred themes for light and dark OS mode": "操作系统浅色和深色模式下的首选主题",
+ "Prepares a fixup! commit of the local changes for the selected commit.": "为所选提交准备一个包含本地更改的 fixup! 提交。",
+ "Prepares a squash! commit of the local changes for the selected commit.": "为所选提交准备一个包含本地更改的 squash! 提交。",
+ "Preserve Case": "保留大小写",
+ "Press a shortcut": "按下快捷键",
+ "Press a shortcut to find actions": "按下快捷键以查找操作",
+ "Preview": "预览",
+ "Preview Replacement": "预览替换",
+ "Preview failed": "预览失败",
+ "Previous Bookmark": "上一个书签",
+ "Previous Change": "上一个更改",
+ "Previous Conflict": "上一个冲突",
+ "Previous Conflict Marker": "上一个冲突标记",
+ "Previous Difference": "上一个差异",
+ "Previous Occurrence": "上一个匹配项",
+ "Previous Page": "上一页",
+ "Primary key": "主键",
+ "Print class and method name": "打印类名和方法名",
+ "Private Key File": "私钥文件",
+ "Private key:": "私钥:",
+ "Problems": "问题",
+ "Problems scope": "问题范围",
+ "Process → backend ready": "进程 → 后端就绪",
+ "Process → first IPC": "进程 → 首次 IPC",
+ "Process → main": "进程 → main",
+ "Processes": "进程",
+ "Profile": "性能分析",
+ "Profile Context Configuration": "对上下文配置进行性能分析",
+ "Profile a run configuration to see where it spends its time.": "对运行配置进行性能分析,即可查看时间花在了哪里。",
+ "Profile the program or test in the active file": "对当前文件中的程序或测试进行性能分析",
+ "Profiler": "性能分析器",
+ "Profiler snapshots": "性能分析快照",
+ "Profiler views": "性能分析视图",
+ "Profiling needs the desktop app": "性能分析需要桌面应用",
+ "Program": "程序",
+ "Project": "项目",
+ "Project (.openidea/plugins)": "项目 (.openidea/plugins)",
+ "Project Encoding": "项目编码",
+ "Project Errors": "项目错误",
+ "Project Files": "项目文件",
+ "Project GOPATH": "项目 GOPATH",
+ "Project Production Files": "项目生产文件",
+ "Project Settings": "项目设置",
+ "Project Structure": "项目结构",
+ "Project Test Files": "项目测试文件",
+ "Project View": "项目视图",
+ "Project actions": "项目操作",
+ "Project name": "项目名称",
+ "Project root": "项目根目录",
+ "Project root directory": "项目根目录",
+ "Project to run in": "运行所在的项目",
+ "Project:": "项目:",
+ "Projects": "项目",
+ "Properties": "属性",
+ "Properties Files (*.properties)": "属性文件 (*.properties)",
+ "Property": "属性",
+ "Protected branches": "受保护的分支",
+ "Prune": "清理",
+ "Prune Docker…": "清理 Docker…",
+ "Prune…": "清理…",
+ "Public function": "公共函数",
+ "Pull Again": "重新拉取",
+ "Pull Docker Image…": "拉取 Docker 镜像…",
+ "Pull Image…": "拉取镜像…",
+ "Pull Requests": "拉取请求",
+ "Pull request": "拉取请求",
+ "Pull request created": "已创建拉取请求",
+ "Pull request number": "拉取请求编号",
+ "Pull request number:": "拉取请求编号:",
+ "Pull requests": "拉取请求",
+ "Pull requests use the": "拉取请求使用",
+ "Pull…": "拉取…",
+ "Purple": "紫色",
+ "Push": "推送",
+ "Push All up to Here…": "推送到此处为止的所有提交…",
+ "Push rejected": "推送被拒绝",
+ "Push tags:": "推送标签:",
+ "Push…": "推送…",
+ "Put Label": "添加标签",
+ "Put Label…": "添加标签…",
+ "Put a stack trace or a complete thread dump here:": "在此处放入堆栈跟踪或完整的线程转储:",
+ "Put the caret on a method declaration, or add a method breakpoint by name in View Breakpoints.": "请将光标放在方法声明上,或在“查看断点”中按名称添加方法断点。",
+ "Python Debugger": "Python 调试器",
+ "Python Interpreter": "Python 解释器",
+ "Python Package": "Python 软件包",
+ "Python interpreter": "Python 解释器",
+ "Python: only your code (justMyCode). JavaScript: skips node_modules and Node.js internals.": "Python:仅您的代码 (justMyCode)。JavaScript:跳过 node_modules 和 Node.js 内部代码。",
+ "Query Console": "查询控制台",
+ "Quick Documentation": "快速文档",
+ "Re-check installed tools": "重新检查已安装的工具",
+ "Re-reads the effective POMs and dependency trees with Maven": "使用 Maven 重新读取有效 POM 和依赖树",
+ "Re-reads the task list with Gradle": "使用 Gradle 重新读取任务列表",
+ "Reached from the SSH host": "从 SSH 主机访问",
+ "React useEffect hook": "React useEffect Hook",
+ "React useState hook": "React useState Hook",
+ "Read-only": "只读",
+ "Read-only Attribute": "只读属性",
+ "Rebase": "变基",
+ "Rebase Current Branch onto Selected Commit": "将当前分支变基到所选提交",
+ "Rebase and Push": "变基并推送",
+ "Rebase the current branch on top of incoming changes": "将当前分支变基到传入的更改之上",
+ "Rebuild Last": "重新构建上一次",
+ "Rebuild Project": "重新构建项目",
+ "Recent Files": "最近的文件",
+ "Recent Locations": "最近的位置",
+ "Recent Projects": "最近的项目",
+ "Recent Projects…": "最近的项目…",
+ "Recent commit messages": "最近的提交消息",
+ "Recent file masks": "最近的文件掩码",
+ "Recent files": "最近的文件",
+ "Recent locations": "最近的位置",
+ "Recent projects": "最近的项目",
+ "Recently Viewed Files": "最近查看的文件",
+ "Record": "记录",
+ "Red": "红色",
+ "Refactor": "重构",
+ "Refactor This": "重构此项",
+ "Refactor This…": "重构此项…",
+ "Refactoring undone": "重构已撤消",
+ "References to update:": "要更新的引用:",
+ "Reformat Code": "重新格式化代码",
+ "Reformat File": "重新格式化文件",
+ "Reformat code": "重新格式化代码",
+ "Reformat code on save": "保存时重新格式化代码",
+ "Reformat on paste": "粘贴时重新格式化",
+ "Refresh": "刷新",
+ "Refresh Docker": "刷新 Docker",
+ "Refresh Pull Requests": "刷新拉取请求",
+ "Refresh TODO Items": "刷新 TODO 项",
+ "Refresh VCS Status": "刷新 VCS 状态",
+ "Regex": "正则表达式",
+ "Regular expression": "正则表达式",
+ "Relative paths resolve against the project root. “Open in Terminal” still opens the chosen folder.": "相对路径相对于项目根目录解析。“在终端中打开”仍会打开所选文件夹。",
+ "Reload": "重新加载",
+ "Reload All Gradle Projects": "重新加载所有 Gradle 项目",
+ "Reload All Maven Projects": "重新加载所有 Maven 项目",
+ "Reload Changed Classes": "重新加载已更改的类",
+ "Reload Environments": "重新加载环境",
+ "Reload History": "重新加载历史记录",
+ "Reload List of Packages": "重新加载软件包列表",
+ "Reload Page": "重新加载页面",
+ "Reload Plugins": "重新加载插件",
+ "Reload Project Tree from Disk": "从磁盘重新加载项目树",
+ "Reload Run Configurations": "重新加载运行配置",
+ "Reload from Disk": "从磁盘重新加载",
+ "Reload from disk": "从磁盘重新加载",
+ "Reload the changed classes into the running debug session?": "要将已更改的类重新加载到正在运行的调试会话中吗?",
+ "Reload with Encoding": "使用编码重新加载",
+ "Remote": "远程",
+ "Remove": "移除",
+ "Remove All Bookmarks": "移除所有书签",
+ "Remove All Breakpoints": "移除所有断点",
+ "Remove Configuration": "移除配置",
+ "Remove Data Source": "移除数据源",
+ "Remove Data Source…": "移除数据源…",
+ "Remove File from Git": "从 Git 中移除文件",
+ "Remove Kind": "移除类型",
+ "Remove Override (restore detected)": "移除覆盖(恢复检测到的配置)",
+ "Remove Pattern": "移除模式",
+ "Remove Template": "移除模板",
+ "Remove Watch": "移除监视",
+ "Remove coverage highlighting from editors and the project view": "从编辑器和项目视图中移除覆盖率高亮",
+ "Remove data source": "移除数据源",
+ "Remove from Favorites": "从收藏夹中移除",
+ "Remove from Recent Projects": "从最近的项目中移除",
+ "Remove from Recent Projects…": "从最近的项目中移除…",
+ "Remove once hit": "命中后移除",
+ "Remove silently": "静默移除",
+ "Remove successfully applied files from the shelf": "从搁置中移除已成功应用的文件",
+ "Remove trailing blank lines at the end of saved files": "移除已保存文件末尾的空行",
+ "Remove trailing spaces on:": "移除尾随空格:",
+ "Remove variable": "移除变量",
+ "Rename": "重命名",
+ "Rename File Inline": "内联重命名文件",
+ "Rename File…": "重命名文件…",
+ "Rename Keymap": "重命名按键映射",
+ "Rename Session…": "重命名会话…",
+ "Rename Shelved Changes": "重命名已搁置的更改",
+ "Rename Shelved Changes…": "重命名已搁置的更改…",
+ "Rename tab": "重命名标签页",
+ "Rename…": "重命名…",
+ "Reopen Closed Tab": "重新打开已关闭的标签页",
+ "Reopen last project on startup": "启动时重新打开上一个项目",
+ "Reopen projects on startup": "启动时重新打开项目",
+ "Replace": "替换",
+ "Replace All": "全部替换",
+ "Replace All in This File": "在此文件中全部替换",
+ "Replace Preview": "替换预览",
+ "Replace Selected": "替换所选内容",
+ "Replace Structurally": "结构化替换",
+ "Replace Structurally: Preview": "结构化替换:预览",
+ "Replace Structurally…": "结构化替换…",
+ "Replace failed": "替换失败",
+ "Replace in Files": "在文件中替换",
+ "Replace in Files…": "在文件中替换…",
+ "Replace in file": "在文件中替换",
+ "Replace preview": "替换预览",
+ "Replace template": "替换模板",
+ "Replace this occurrence only": "仅替换此匹配项",
+ "Replace with": "替换为",
+ "Replacements": "替换项",
+ "Replacing…": "正在替换…",
+ "Reports errors and warnings from language servers.": "报告来自语言服务器的错误和警告。",
+ "Request": "请求",
+ "Request Changes…": "请求更改…",
+ "Require": "必需",
+ "Rerun": "重新运行",
+ "Rerun Debug Session": "重新运行调试会话",
+ "Rerun Failed Tests": "重新运行失败的测试",
+ "Rerun Find Usages": "重新运行查找用法",
+ "Rerun Inspection": "重新运行检查",
+ "Rerun Query": "重新运行查询",
+ "Rescan Plugins": "重新扫描插件",
+ "Reset": "重置",
+ "Reset Current Branch to Here…": "将当前分支重置到此处…",
+ "Reset Frame": "重置帧",
+ "Reset HEAD…": "重置 HEAD…",
+ "Reset IDE Zoom": "重置 IDE 缩放",
+ "Reset Shortcuts": "重置快捷键",
+ "Reset Zoom": "重置缩放",
+ "Reset to Language Defaults": "重置为语言默认值",
+ "Reset type": "重置类型",
+ "Resize right tool window bar": "调整右侧工具窗口栏大小",
+ "Resize tool window bar": "调整工具窗口栏大小",
+ "Resolve Conflicts…": "解决冲突…",
+ "Resolve all conflicts before continuing": "继续前请解决所有冲突",
+ "Resolve merge conflicts before committing": "提交前请解决合并冲突",
+ "Resolve…": "解决…",
+ "Resource Folders": "资源文件夹",
+ "Resources": "资源",
+ "Response": "响应",
+ "Response body": "响应正文",
+ "Response history": "响应历史记录",
+ "Restart": "重启",
+ "Restart Container": "重启容器",
+ "Restart IDE": "重启 IDE",
+ "Restart Session": "重启会话",
+ "Restart identity": "重置标识",
+ "Restart is only available in the desktop app": "只有桌面应用可以重启",
+ "Restore Default": "恢复默认值",
+ "Restore Default Layout": "恢复默认布局",
+ "Restore Defaults": "恢复默认值",
+ "Restore Rows": "恢复行",
+ "Restore Size": "恢复大小",
+ "Restore detected roots": "恢复检测到的根",
+ "Result": "结果",
+ "Results": "结果",
+ "Resume Program": "恢复程序",
+ "Retry": "重试",
+ "Return to the start of the selected frame's method": "返回所选帧所在方法的开头",
+ "Reveal in Project View": "在项目视图中显示",
+ "Reverse patch": "反向补丁",
+ "Revert": "还原",
+ "Revert Change": "还原更改",
+ "Revert Commit": "还原提交",
+ "Revert Commits": "还原提交",
+ "Reverts the last file move or rename and its reference updates": "还原上一次文件移动或重命名及其引用更新",
+ "Review action": "审查操作",
+ "Review comment": "审查评论",
+ "Review comments": "审查评论",
+ "Review requested": "请求审查",
+ "Review ▾": "审查 ▾",
+ "Reviewers": "审查者",
+ "Revision": "修订",
+ "Revisions": "修订",
+ "Reword": "改写",
+ "Rich-Text Copy": "富文本复制",
+ "Right tool windows": "右侧工具窗口",
+ "Roll Back": "回滚",
+ "Rollback": "回滚",
+ "Rollback Changes": "回滚更改",
+ "Rollback…": "回滚…",
+ "Row limit": "行数限制",
+ "Run": "运行",
+ "Run All HTTP Requests in File": "运行文件中的所有 HTTP 请求",
+ "Run All Requests in File": "运行文件中的所有请求",
+ "Run Code › Analyze Code › Locate Duplicates… to find copied code": "运行“代码 › 分析代码 › 查找重复项…”以查找复制的代码",
+ "Run Code › Inspect Code… to analyse files": "运行“代码 › 检查代码…”以分析文件",
+ "Run Command in Terminal": "在终端中运行命令",
+ "Run Configuration": "运行配置",
+ "Run Context Configuration": "运行上下文配置",
+ "Run Context Configuration with Coverage": "使用覆盖率运行上下文配置",
+ "Run Gradle Task": "运行 Gradle 任务",
+ "Run HTTP Request at Caret": "运行光标处的 HTTP 请求",
+ "Run Maven Build": "运行 Maven 构建",
+ "Run SQL Script": "运行 SQL 脚本",
+ "Run SQL Script…": "运行 SQL 脚本…",
+ "Run a configuration with": "运行配置:",
+ "Run a configuration with coverage to see which lines its tests execute.": "使用覆盖率运行配置,即可查看其测试执行了哪些行。",
+ "Run a request from an .http file with the gutter ▶ or ⌘↩.": "使用装订区域中的 ▶ 或 ⌘↩ 运行 .http 文件中的请求。",
+ "Run actions": "运行操作",
+ "Run and Debug": "运行和调试",
+ "Run code cleanup": "运行代码清理",
+ "Run configurations": "运行配置",
+ "Run configurations and tests": "运行配置和测试",
+ "Run external linter on save": "保存时运行外部 Linter",
+ "Run gh auth login": "运行 gh auth login",
+ "Run sessions": "运行会话",
+ "Run the selected configuration under a sampling profiler": "在采样性能分析器下运行所选配置",
+ "Run the selected configuration with coverage": "使用覆盖率运行所选配置",
+ "Run the test or program in the active file": "运行当前文件中的测试或程序",
+ "Run the test or program in the active file with coverage": "使用覆盖率运行当前文件中的测试或程序",
+ "Run to Cursor": "运行到光标处",
+ "Run to the caret, ignoring breakpoints on the way": "运行到光标处,忽略途中的断点",
+ "Run with Coverage": "使用覆盖率运行",
+ "Run with Executor": "使用执行器运行",
+ "Run with:": "运行环境:",
+ "Run/Debug": "运行/调试",
+ "Run/Debug Configurations": "运行/调试配置",
+ "Running": "正在运行",
+ "Running processes requires the desktop app.": "运行进程需要桌面应用。",
+ "Runs Gradle with --offline": "使用 --offline 运行 Gradle",
+ "Runs Maven with -DskipTests": "使用 -DskipTests 运行 Maven",
+ "Runs Maven with -o": "使用 -o 运行 Maven",
+ "Runs Optimize Imports when the file has no errors, unless it would change the caret line.": "文件没有错误时运行“优化导入”,除非这会更改光标所在行。",
+ "Runs npm scripts and Node-based language servers (vtsls, eslint, pyright…).": "运行 npm 脚本和基于 Node 的语言服务器(vtsls、eslint、pyright…)。",
+ "Runs the language server's Organize Imports action.": "运行语言服务器的“整理导入”操作。",
+ "Runs the language server's formatter before an explicit save (Actions on Save).": "在显式保存前运行语言服务器的格式化程序(保存时操作)。",
+ "Runs this project": "运行此项目",
+ "SQL Inserts": "SQL Insert 语句",
+ "SQL Script Template": "SQL 脚本模板",
+ "SQL Scripts": "SQL 脚本",
+ "SQLite Database File": "SQLite 数据库文件",
+ "SQLite can rename or drop an existing column, not change its type, NOT NULL or default.": "SQLite 可以重命名或删除现有列,但不能更改其类型、NOT NULL 或默认值。",
+ "SSH authentication type": "SSH 身份验证类型",
+ "SSL mode": "SSL 模式",
+ "SSL:": "SSL:",
+ "Safe Delete…": "安全删除…",
+ "Sample plugin: inserts today's date and counts words in the active file.": "示例插件:插入今天的日期,并统计当前文件的字数。",
+ "Save": "保存",
+ "Save All": "全部保存",
+ "Save Files": "保存文件",
+ "Save files if the IDE is idle for": "IDE 空闲以下时长时保存文件",
+ "Save files when switching to a different application or a built-in terminal": "切换到其他应用程序或内置终端时保存文件",
+ "Save or roll back the changes before reloading it from disk.": "从磁盘重新加载前,请先保存或回滚更改。",
+ "Save password": "保存密码",
+ "Save to file:": "保存到文件:",
+ "Scanning for TODO items…": "正在扫描 TODO 项…",
+ "Scheme": "方案",
+ "Scope": "范围",
+ "Scratches": "临时文件",
+ "Script": "脚本",
+ "Scroll to End": "滚动到末尾",
+ "Scrolling": "滚动",
+ "Search (GitHub syntax)": "搜索(GitHub 语法)",
+ "Search Everywhere": "随处搜索",
+ "Search Structurally": "结构化搜索",
+ "Search Structurally…": "结构化搜索…",
+ "Search Text Everywhere": "随处搜索文本",
+ "Search actions": "搜索操作",
+ "Search branches and actions": "搜索分支和操作",
+ "Search configurations": "搜索配置",
+ "Search for references": "搜索引用",
+ "Search frames": "搜索帧",
+ "Search in comments and strings": "在注释和字符串中搜索",
+ "Search installed plugins": "搜索已安装的插件",
+ "Search local plugins": "搜索本地插件",
+ "Search packages": "搜索软件包",
+ "Search projects": "搜索项目",
+ "Search pull requests": "搜索拉取请求",
+ "Search query": "搜索查询",
+ "Search recent projects": "搜索最近的项目",
+ "Search scope": "搜索范围",
+ "Search settings": "搜索设置",
+ "Search template": "搜索模板",
+ "Searches": "搜索",
+ "Searching": "正在搜索",
+ "Searching for usages": "正在搜索用法",
+ "Second stroke": "第二次击键",
+ "Second stroke:": "第二次击键:",
+ "Select All": "全选",
+ "Select Base Interpreter": "选择基础解释器",
+ "Select Folders…": "选择文件夹…",
+ "Select GOPATH": "选择 GOPATH",
+ "Select Next Tab": "选择下一个标签页",
+ "Select Opened File": "选择已打开的文件",
+ "Select Previous Tab": "选择上一个标签页",
+ "Select Python Interpreter": "选择 Python 解释器",
+ "Select Run/Debug Configuration…": "选择运行/调试配置…",
+ "Select Standard Library Sources": "选择标准库源代码",
+ "Select TypeScript lib Directory": "选择 TypeScript lib 目录",
+ "Select a changed file to show its diff": "选择一个已更改的文件以显示其差异",
+ "Select a column": "选择一列",
+ "Select a commit in the Git log": "在 Git 日志中选择一个提交",
+ "Select a commit to view changes": "选择一个提交以查看更改",
+ "Select a configuration": "选择一个配置",
+ "Select a container, image, volume or network.": "选择一个容器、镜像、卷或网络。",
+ "Select a group": "选择一个组",
+ "Select a pull request": "选择一个拉取请求",
+ "Select a result to preview": "选择一个结果进行预览",
+ "Select a revision": "选择一个修订",
+ "Select a template to edit it": "选择一个模板进行编辑",
+ "Select an interpreter": "选择一个解释器",
+ "Select changes to move": "选择要移动的更改",
+ "Select in Project View": "在项目视图中选择",
+ "Selection": "所选内容",
+ "Select…": "选择…",
+ "Sending request #": "正在发送请求 #",
+ "Services": "服务",
+ "Services actions": "服务操作",
+ "Session finished": "会话已结束",
+ "Set Active Changelist": "设置活动更改列表",
+ "Set NULL": "设为 NULL",
+ "Set Value…": "设置值…",
+ "Set active": "设为活动",
+ "Set upstream": "设置上游",
+ "Settings": "设置",
+ "Settings pages": "设置页面",
+ "Settings scope": "设置范围",
+ "Settings…": "设置…",
+ "Shelf": "搁置",
+ "Shell integration": "Shell 集成",
+ "Shell path": "Shell 路径",
+ "Shelve Changes": "搁置更改",
+ "Shelve Changes…": "搁置更改…",
+ "Shelved changes": "已搁置的更改",
+ "Show": "显示",
+ "Show \"Today\", \"Yesterday\" and \"N min ago\" for recent dates": "对最近的日期显示“今天”、“昨天”和“N 分钟前”",
+ "Show All": "全部显示",
+ "Show All Frames": "显示所有帧",
+ "Show Bookmarks": "显示书签",
+ "Show Build": "显示构建",
+ "Show Commit in Git Log": "在 Git 日志中显示提交",
+ "Show Container Log": "显示容器日志",
+ "Show Context Actions": "显示上下文操作",
+ "Show Coverage": "显示覆盖率",
+ "Show Debug Tool Window": "显示调试工具窗口",
+ "Show Diff": "显示差异",
+ "Show Diff with Working Tree": "显示与工作树的差异",
+ "Show Editor Hint": "显示编辑器提示",
+ "Show Errors": "显示错误",
+ "Show Execution Point": "显示执行点",
+ "Show Formatted": "显示格式化内容",
+ "Show Git Log": "显示 Git 日志",
+ "Show Hidden Tabs": "显示隐藏的标签页",
+ "Show History": "显示历史记录",
+ "Show History for File": "显示文件的历史记录",
+ "Show Ignored": "显示已忽略",
+ "Show Infos and Hints": "显示信息和提示",
+ "Show Input Field": "显示输入字段",
+ "Show Local History": "显示本地历史记录",
+ "Show Log": "显示日志",
+ "Show Memory Indicator Details": "显示内存指示器详细信息",
+ "Show Passed": "显示已通过",
+ "Show Raw": "显示原始内容",
+ "Show Replace": "显示替换",
+ "Show Run/Debug window when a process is started": "进程启动时显示运行/调试窗口",
+ "Show Scheme Actions": "显示方案操作",
+ "Show Shelf": "显示搁置",
+ "Show TODO Items in Current File": "显示当前文件中的 TODO 项",
+ "Show Tool Window Names": "显示工具窗口名称",
+ "Show Usage Results": "显示用法结果",
+ "Show Usages": "显示用法",
+ "Show Warnings": "显示警告",
+ "Show all output": "显示所有输出",
+ "Show breadcrumbs for:": "为以下语言显示痕迹导航:",
+ "Show breadcrumbs:": "显示痕迹导航:",
+ "Show changed only": "仅显示已更改的",
+ "Show close button": "显示关闭按钮",
+ "Show code folding outline": "显示代码折叠轮廓",
+ "Show debug window on breakpoint hit": "命中断点时显示调试窗口",
+ "Show details": "显示详细信息",
+ "Show directories with changed descendants": "显示含有已更改子项的目录",
+ "Show edited only": "仅显示已编辑的",
+ "Show file extension": "显示文件扩展名",
+ "Show gutter icons": "显示装订区域图标",
+ "Show hard wrap and visual guides (configured in Code Style options)": "显示硬换行和视觉参考线(在代码样式选项中配置)",
+ "Show in Finder": "在访达中显示",
+ "Show in tool window": "在工具窗口中显示",
+ "Show indent guides": "显示缩进参考线",
+ "Show inlay hints": "显示嵌入提示",
+ "Show inlay hints for:": "为以下语言显示嵌入提示:",
+ "Show install log": "显示安装日志",
+ "Show intention bulb": "显示意图灯泡",
+ "Show line numbers": "显示行号",
+ "Show live templates in code completion": "在代码补全中显示实时模板",
+ "Show method separators": "显示方法分隔符",
+ "Show only monospaced fonts": "仅显示等宽字体",
+ "Show or hide the memory indicator in the status bar": "在状态栏中显示或隐藏内存指示器",
+ "Show postfix templates in code completion": "在代码补全中显示后缀模板",
+ "Show quick documentation on hover": "悬停时显示快速文档",
+ "Show results in the test runner": "在测试运行器中显示结果",
+ "Show right margin": "显示右边距",
+ "Show sticky lines while scrolling": "滚动时显示粘滞行",
+ "Show suggestions as you type": "输入时显示建议",
+ "Show table data": "显示表数据",
+ "Show tabs in multiple rows": "多行显示标签页",
+ "Show the documentation popup in": "在以下时间后显示文档弹出窗口",
+ "Show the parameter info popup in": "在以下时间后显示形参信息弹出窗口",
+ "Show the selected coverage suite in editors and the project view": "在编辑器和项目视图中显示所选覆盖率套件",
+ "Show tool window bars": "显示工具窗口栏",
+ "Show tool window names": "显示工具窗口名称",
+ "Show value tooltip on mouse hover": "鼠标悬停时显示值工具提示",
+ "Show values inline": "内联显示值",
+ "Show virtual space at file bottom": "在文件底部显示虚拟空间",
+ "Show whitespaces": "显示空白",
+ "Shown as the right margin guide in the editor.": "在编辑器中显示为右边距参考线。",
+ "Side-by-side Viewer": "并排查看器",
+ "Sign-off Commit": "签署提交",
+ "Sign-off commit": "签署提交",
+ "Size": "大小",
+ "Size:": "大小:",
+ "Skip": "跳过",
+ "Skip Commit": "跳过提交",
+ "Skip if defined": "已定义时跳过",
+ "Smart Keys": "智能键",
+ "Smart Step Into": "智能步入",
+ "Smart Step Into failed": "智能步入失败",
+ "Smart indent": "智能缩进",
+ "Soft": "软",
+ "Soft Wraps": "软换行",
+ "Soft-Wrap": "软换行",
+ "Soft-wrap": "软换行",
+ "Soft-wrap files": "软换行文件",
+ "Some items could not be copied": "部分项目无法复制",
+ "Some items could not be deleted": "部分项目无法删除",
+ "Some items could not be moved": "部分项目无法移动",
+ "Some references may not have been updated": "部分引用可能未更新",
+ "Sort Alphabetically": "按字母顺序排序",
+ "Source": "来源",
+ "Source Folders": "源代码文件夹",
+ "Sources": "源代码",
+ "Sources of std for navigation and completion (RUST_SRC_PATH).": "用于导航和补全的 std 源代码 (RUST_SRC_PATH)。",
+ "Specify Inspection Scope": "指定检查范围",
+ "Split Down": "向下拆分",
+ "Split Right": "向右拆分",
+ "Split and Move Down": "向下拆分并移动",
+ "Split and Move Right": "向右拆分并移动",
+ "Squash": "压缩",
+ "Squash Commits…": "压缩提交…",
+ "Squash Into…": "压缩到…",
+ "Stage": "暂存",
+ "Stage Change (git add hunk)": "暂存更改 (git add hunk)",
+ "Standard input": "标准输入",
+ "Standard library": "标准库",
+ "Start": "启动",
+ "Start Container": "启动容器",
+ "Start Docker": "启动 Docker",
+ "Start Rebasing": "开始变基",
+ "Start a debug configuration with": "启动调试配置:",
+ "Start a debug session to see the exception filters of its adapter.": "启动调试会话即可查看其适配器的异常过滤器。",
+ "Start debugging a run configuration": "开始调试运行配置",
+ "Start directory": "起始目录",
+ "Startup": "启动",
+ "Stash Changes": "储藏更改",
+ "Stash Changes…": "储藏更改…",
+ "Stashes": "储藏",
+ "State": "状态",
+ "Status": "状态",
+ "Status bar": "状态栏",
+ "Step Into": "步入",
+ "Step over, ignoring breakpoints in the called code": "步过,忽略被调用代码中的断点",
+ "Stepping": "单步执行",
+ "Sticky Lines": "粘滞行",
+ "Sticky balloon": "粘滞气球",
+ "Stop": "停止",
+ "Stop All": "全部停止",
+ "Stop Build": "停止构建",
+ "Stop Container": "停止容器",
+ "Stop Debug Session": "停止调试会话",
+ "Stop Process": "停止进程",
+ "Stop Reloading Gradle Projects": "停止重新加载 Gradle 项目",
+ "Stop Reloading Maven Projects": "停止重新加载 Maven 项目",
+ "Stop Request": "停止请求",
+ "Stop and Rerun": "停止并重新运行",
+ "Stop to Edit": "停止以编辑",
+ "Strikeout": "删除线",
+ "Struct": "结构体",
+ "Struct type": "结构体类型",
+ "Structural Replace": "结构化替换",
+ "Structural Search": "结构化搜索",
+ "Structure": "结构",
+ "Structure actions": "结构操作",
+ "Structure unavailable": "结构不可用",
+ "Subject line length": "主题行长度",
+ "Submit": "提交",
+ "Subpixel": "子像素",
+ "Suggested names": "建议的名称",
+ "Super Method": "超方法",
+ "Surround With": "包围方式",
+ "Surround With…": "包围方式…",
+ "Surround selection on typing quote or brace": "输入引号或括号时包围所选内容",
+ "Suspend on": "挂起时机",
+ "Suspends when empty": "为空时挂起",
+ "Switch to Auto-Commit": "切换到自动提交",
+ "Switcher": "切换器",
+ "Switcher (Backward)": "切换器(向后)",
+ "Symbols": "符号",
+ "Sync with OS": "与操作系统同步",
+ "Synchronize Scrolling": "同步滚动",
+ "Synchronize files after execution": "执行后同步文件",
+ "Syntax trees": "语法树",
+ "System Messages": "系统消息",
+ "System Settings": "系统设置",
+ "System default": "系统默认",
+ "System-Dependent": "取决于系统",
+ "TODO comment": "TODO 注释",
+ "TODO filters": "TODO 过滤器",
+ "TODO items": "TODO 项",
+ "TODO items unavailable": "TODO 项不可用",
+ "TODO patterns": "TODO 模式",
+ "TODO scope": "TODO 范围",
+ "Tab Actions": "标签页操作",
+ "Tab actions": "标签页操作",
+ "Tab limit": "标签页限制",
+ "Tab name": "标签页名称",
+ "Tab placement": "标签页位置",
+ "Tab size": "制表符大小",
+ "Tab to complete, Enter to run": "按 Tab 补全,按 Enter 运行",
+ "Table": "表",
+ "Table:": "表:",
+ "Tabs": "标签页",
+ "Tabs and Indents": "制表符和缩进",
+ "Tag": "标签",
+ "Tag name:": "标签名称:",
+ "Tags to push": "要推送的标签",
+ "Target changelist": "目标更改列表",
+ "Target directory": "目标目录",
+ "Teal": "青色",
+ "Template body": "模板正文",
+ "Template name": "模板名称",
+ "Template text": "模板文本",
+ "Terminal": "终端",
+ "Terminal font size": "终端字体大小",
+ "Terminal line height": "终端行高",
+ "Terminal sessions": "终端会话",
+ "Test": "测试",
+ "Test (pytest)": "测试 (pytest)",
+ "Test Connection": "测试连接",
+ "Test Resource Folders": "测试资源文件夹",
+ "Test Resources": "测试资源",
+ "Test Source Folders": "测试源代码文件夹",
+ "Test case": "测试用例",
+ "Test case (test)": "测试用例 (test)",
+ "Test file": "测试文件",
+ "Test function": "测试函数",
+ "Test module": "测试模块",
+ "Test results": "测试结果",
+ "Test suite": "测试套件",
+ "Tests": "测试",
+ "Text": "文本",
+ "Text occurrences (language server not ready)": "文本匹配项(语言服务器尚未就绪)",
+ "Text or hash": "文本或哈希",
+ "Text selected in the editor": "编辑器中选中的文本",
+ "Text to find": "要查找的文本",
+ "The Java debugger is not installed": "未安装 Java 调试器",
+ "The action already has this shortcut": "该操作已有此快捷键",
+ "The active changelist cannot be deleted": "无法删除活动更改列表",
+ "The active file has no runnable element, test or run configuration.": "当前文件没有可运行的元素、测试或运行配置。",
+ "The caches will be invalidated and rebuilt on the next startup: the symbol index of every project and the syntax caches.": "缓存将被清除,并在下次启动时重建:包括每个项目的符号索引和语法缓存。",
+ "The caret is not inside a conflict": "光标不在冲突内",
+ "The clipboard does not contain a patch": "剪贴板中没有补丁",
+ "The patch file is empty": "补丁文件为空",
+ "The project is not a Git repository.": "该项目不是 Git 仓库。",
+ "The project is not under Git version control": "项目不受 Git 版本控制",
+ "The project path is always shown in the status bar navigation bar.": "项目路径始终显示在状态栏导航栏中。",
+ "The remote contains commits that are not in your branch. Update the branch, then push again.": "远程包含您的分支中没有的提交。请更新分支,然后再次推送。",
+ "The report covers no files": "报告未覆盖任何文件",
+ "The shortcut is already assigned to other actions. Do you want to remove other assignments?": "此快捷键已分配给其他操作。要移除其他分配吗?",
+ "The tab on the left": "左侧标签页",
+ "The tab on the right": "右侧标签页",
+ "The template content could not be inserted.": "无法插入模板内容。",
+ "Their version": "他们的版本",
+ "Theirs (incoming)": "他们的(传入)",
+ "Theme": "主题",
+ "Theme default": "主题默认",
+ "Themes": "主题",
+ "There is no online plugin repository": "没有在线插件仓库",
+ "This directory is preselected in \"Open…\" and \"New Window\" dialogs.": "此目录将在“打开…”和“新窗口”对话框中预先选中。",
+ "This element can't be renamed": "无法重命名此元素",
+ "This page could not be displayed": "无法显示此页面",
+ "This project has no remote on GitHub.": "此项目在 GitHub 上没有远程仓库。",
+ "This version has no release notes.": "此版本没有发行说明。",
+ "This will reset the current branch head to the selected commit, and update the working tree and the index according to the selected mode:": "这会将当前分支头重置到所选提交,并根据所选模式更新工作树和索引:",
+ "Thread": "线程",
+ "Time limit for Run/Debug process termination": "运行/调试进程终止的时间限制",
+ "Timestamps": "时间戳",
+ "Title": "标题",
+ "To commit:": "到提交:",
+ "To directory:": "目标目录:",
+ "To nearest indent position": "到最近的缩进位置",
+ "Toggle 'Skip Tests' Mode": "切换“跳过测试”模式",
+ "Toggle Bookmark": "切换书签",
+ "Toggle Field Watchpoint": "切换字段监视点",
+ "Toggle Light/Dark Theme": "切换浅色/深色主题",
+ "Toggle Line Breakpoint": "切换行断点",
+ "Toggle Method Breakpoint": "切换方法断点",
+ "Toggle Offline Mode": "切换离线模式",
+ "Toggle Performance Overlay (Dev)": "切换性能浮层(开发)",
+ "Toggle Read-only Attribute": "切换只读属性",
+ "Toggle Temporary Line Breakpoint": "切换临时行断点",
+ "Tool": "工具",
+ "Tool Settings": "工具设置",
+ "Tool Windows": "工具窗口",
+ "Tool windows": "工具窗口",
+ "Toolchain": "工具链",
+ "Toolchain location": "工具链位置",
+ "Tools": "工具",
+ "Tooltip delay": "工具提示延迟",
+ "Top": "顶部",
+ "Total": "总计",
+ "Trailing": "尾随",
+ "Trait implementation": "Trait 实现",
+ "Transaction mode": "事务模式",
+ "Trim whitespaces": "修剪空白",
+ "Truncate": "截断",
+ "Truncate…": "截断…",
+ "Trust Host and Retry": "信任主机并重试",
+ "Trust and Connect": "信任并连接",
+ "Tx: Auto": "事务:自动",
+ "Tx: Manual": "事务:手动",
+ "Type Declaration": "类型声明",
+ "Type Hierarchy": "类型层次结构",
+ "Type an expression followed by": "输入表达式,后跟",
+ "Type hierarchy": "类型层次结构",
+ "Type to filter by file name or code": "输入以按文件名或代码过滤",
+ "Type to filter symbols": "输入以过滤符号",
+ "TypeScript version": "TypeScript 版本",
+ "Types": "类型",
+ "Typography Settings": "排版设置",
+ "UI Options": "UI 选项",
+ "UI elements take up less screen space": "UI 元素占用更少的屏幕空间",
+ "UI font": "UI 字体",
+ "UI font size": "UI 字体大小",
+ "URL:": "URL:",
+ "Unchecked values are inherited from the scheme.": "未勾选的值继承自方案。",
+ "Uncommitted changes are stashed before the update and restored afterwards.": "更新前会储藏未提交的更改,并在之后恢复。",
+ "Underline": "下划线",
+ "Underscored": "下划线",
+ "Underwaved": "波浪线",
+ "Undo": "撤消",
+ "Undo Commit": "撤消提交",
+ "Undo Commit…": "撤消提交…",
+ "Undo Move / Rename": "撤消移动/重命名",
+ "Unified Viewer": "统一查看器",
+ "Unindent": "取消缩进",
+ "Uninstall": "卸载",
+ "Uninstall…": "卸载…",
+ "Unknown SSH Host": "未知的 SSH 主机",
+ "Unmute Breakpoints": "取消静音断点",
+ "Unpause": "取消暂停",
+ "Unpin Tab": "取消固定标签页",
+ "Unresolved Conflicts": "未解决的冲突",
+ "Unshelve": "取消搁置",
+ "Unshelve Changes": "取消搁置更改",
+ "Unshelve…": "取消搁置…",
+ "Unsplit": "取消拆分",
+ "Unstage": "取消暂存",
+ "Unstash Changes…": "取消储藏更改…",
+ "Update": "更新",
+ "Update Project": "更新项目",
+ "Update Project…": "更新项目…",
+ "Update method": "更新方式",
+ "Update type": "更新类型",
+ "Update type:": "更新类型:",
+ "Upgrade": "升级",
+ "Uptime": "运行时间",
+ "Usage searches": "用法搜索",
+ "Usages": "用法",
+ "Usages Detected": "检测到用法",
+ "Usages actions": "用法操作",
+ "Usages of element at caret": "光标处元素的用法",
+ "Use \"CamelHumps\" words": "使用“驼峰”单词",
+ "Use 24-hour time format": "使用 24 小时制",
+ "Use Call Hierarchy (⌃⌥H) or Type Hierarchy (⌃H) on a symbol to see its hierarchy here": "对符号使用调用层次结构 (⌃⌥H) 或类型层次结构 (⌃H),即可在此查看其层次结构",
+ "Use DROP CASCADE syntax": "使用 DROP CASCADE 语法",
+ "Use Default Theme": "使用默认主题",
+ "Use Find Usages (⌥F7) on a symbol to see its usages here": "对符号使用查找用法 (⌥F7),即可在此查看其用法",
+ "Use Find in Files (": "使用“在文件中查找”(",
+ "Use IF EXISTS syntax": "使用 IF EXISTS 语法",
+ "Use Option as Meta key": "将 Option 用作 Meta 键",
+ "Use SSH tunnel": "使用 SSH 隧道",
+ "Use block caret": "使用块状光标",
+ "Use contrast scrollbars": "使用对比度滚动条",
+ "Use custom font": "使用自定义字体",
+ "Use custom font:": "使用自定义字体:",
+ "Use editor font": "使用编辑器字体",
+ "Use lighter color in the dark theme and darker color in the light theme as a background": "在深色主题中使用较浅的颜色、在浅色主题中使用较深的颜色作为背景",
+ "Use original line's indent for wrapped parts": "换行部分使用原始行的缩进",
+ "Use pretty formatting": "使用友好格式",
+ "Use project colors in main toolbar": "在主工具栏中使用项目颜色",
+ "Use soft wraps in console": "在控制台中使用软换行",
+ "Use tab character": "使用制表符",
+ "Used by the npm run configurations detected from package.json scripts.": "供从 package.json 脚本检测到的 npm 运行配置使用。",
+ "Used for new files.": "用于新文件。",
+ "User": "用户",
+ "User name or email": "用户名或电子邮件",
+ "User:": "用户:",
+ "Uses HostName, User, Port, IdentityFile and ProxyJump from ~/.ssh/config, and keys of the SSH agent.": "使用 ~/.ssh/config 中的 HostName、User、Port、IdentityFile 和 ProxyJump,以及 SSH 代理中的密钥。",
+ "VCS Operations": "VCS 操作",
+ "VCS Operations…": "VCS 操作…",
+ "Value": "值",
+ "Value tooltip delay (ms)": "值工具提示延迟(毫秒)",
+ "Value tooltips are off": "值工具提示已关闭",
+ "Values are inserted as SQL: quote strings, e.g. 'abc'.": "值将按 SQL 插入:字符串请加引号,例如 'abc'。",
+ "Values of local variables are shown after the lines that use them while suspended.": "挂起时,局部变量的值会显示在使用它们的行之后。",
+ "Variable": "变量",
+ "Variables": "变量",
+ "Variables:": "变量:",
+ "Version": "版本",
+ "Version Control": "版本控制",
+ "Version control is not configured": "未配置版本控制",
+ "Version used by vtsls / typescript-language-server (typescript.tsdk, tsserver.path).": "vtsls / typescript-language-server 使用的版本(typescript.tsdk、tsserver.path)。",
+ "Vertical": "竖线",
+ "View": "视图",
+ "View Breakpoints…": "查看断点…",
+ "View Pull Requests": "查看拉取请求",
+ "View Usages": "查看用法",
+ "View in Browser": "在浏览器中查看",
+ "Violet": "紫色",
+ "Virtual Space": "虚拟空间",
+ "Virtualenv Environment": "Virtualenv 环境",
+ "Virtualenv Location": "Virtualenv 位置",
+ "Visual guides": "视觉参考线",
+ "WHERE filter": "WHERE 过滤器",
+ "Warn if CRLF line separators are about to be committed": "即将提交 CRLF 行分隔符时发出警告",
+ "Warn when committing in detached HEAD or during rebase": "在分离的 HEAD 中或变基期间提交时发出警告",
+ "Warning": "警告",
+ "Watching": "监视",
+ "Welcome": "欢迎",
+ "Welcome to OpenIDEA": "欢迎使用 OpenIDEA",
+ "What's New": "新功能",
+ "When caret is moved": "移动光标时",
+ "When files are created": "创建文件时",
+ "When files are deleted": "删除文件时",
+ "When the current tab is closed, activate": "关闭当前标签页时,激活",
+ "When the tab limit is reached": "达到标签页限制时",
+ "Widescreen tool window layout": "宽屏工具窗口布局",
+ "Window": "窗口",
+ "Words": "单词",
+ "Working": "正在工作",
+ "Working directory": "工作目录",
+ "Wrap when typing reaches right margin": "输入到达右边距时换行",
+ "Wrapping": "换行",
+ "Yellow": "黄色",
+ "You can also drop a folder onto this window.": "也可以将文件夹拖放到此窗口。",
+ "Your version": "您的版本",
+ "Yours (current branch)": "您的(当前分支)",
+ "Zoom": "缩放",
+ "Zoom In IDE": "放大 IDE",
+ "Zoom Out IDE": "缩小 IDE",
+ "Zoomed into": "已放大到",
+ "a dollar sign. Leading tabs are indent units.": "美元符号。前导制表符表示缩进单位。",
+ "any number of nodes (arguments, statements). A placeholder used twice must match equal code.": "匹配任意数量的节点(实参、语句)。使用两次的占位符必须匹配相同的代码。",
+ "any, rust, typescript…": "any、rust、typescript…",
+ "cargo run configurations and rust-analyzer use this toolchain (PATH, RUSTUP_TOOLCHAIN).": "cargo 运行配置和 rust-analyzer 使用此工具链(PATH、RUSTUP_TOOLCHAIN)。",
+ "chord prefix": "组合键前缀",
+ "command line tool. Install it, then run": "命令行工具。请安装它,然后运行",
+ "configured in": "配置位置:",
+ "const declaration": "const 声明",
+ "current branch": "当前分支",
+ "debugpy is not installed": "未安装 debugpy",
+ "delete specific rows from a table": "从表中删除特定行",
+ "detected from": "检测自",
+ "earlier lines were discarded": "较早的行已丢弃",
+ "failed to load": "加载失败",
+ "for loop": "for 循环",
+ "for range loop": "for range 循环",
+ "for…in loop": "for…in 循环",
+ "for…of loop": "for…of 循环",
+ "found in the changed lines:": "在更改的行中找到:",
+ "from packageManager / lock file": "来自 packageManager / 锁文件",
+ "from ~/.ssh/config": "来自 ~/.ssh/config",
+ "func literal": "func 字面量",
+ "has been resolved and staged.": "已解决并暂存。",
+ "has uncommitted changes. Commit or roll them back before switching to auto-commit?": "有未提交的更改。切换到自动提交前要提交还是回滚这些更改?",
+ "host or ~/.ssh/config alias": "主机或 ~/.ssh/config 别名",
+ "if statement": "if 语句",
+ "impl block": "impl 块",
+ "import default": "默认导入",
+ "in a terminal, then retry.": "(在终端中),然后重试。",
+ "insert rows into a table": "向表中插入行",
+ "inside your project.": "的文件夹。",
+ "is already assigned to:": "已分配给:",
+ "is omitted (with one following blank line) when there is no package.": "的行在没有软件包时会被省略(连同其后的一个空行)。",
+ "is on PATH.": "位于 PATH 中。",
+ "language definition:": "语言定义:",
+ "last · p50 · p95 · max": "最近 · p50 · p95 · 最大",
+ "let binding": "let 绑定",
+ "let mut binding": "let mut 绑定",
+ "library frames hidden": "个库帧已隐藏",
+ "main function": "main 函数",
+ "main function with __main__ guard": "带 __main__ 守卫的 main 函数",
+ "main() function": "main() 函数",
+ "main() method": "main() 方法",
+ "main(args) function": "main(args) 函数",
+ "match expression": "match 表达式",
+ "match one node,": "匹配一个节点,",
+ "new column definition": "新列定义",
+ "new table definition": "新表定义",
+ "new view definition": "新视图定义",
+ "no file is open in the editor": "编辑器中没有打开的文件",
+ "no symbols": "没有符号",
+ "not found": "未找到",
+ "not installed in this project": "此项目中未安装",
+ "occurrences ·": "个匹配项 ·",
+ "or click a line number to set a breakpoint.": "或点击行号设置断点。",
+ "or pick one in the toolbar.": "或在工具栏中选择一个。",
+ "pip output": "pip 输出",
+ "places the caret. A line with": "放置光标。包含",
+ "println! with Debug": "使用 Debug 的 println!",
+ "pytest test function": "pytest 测试函数",
+ "renamed from": "重命名自",
+ "replaced ·": "已替换 ·",
+ "rust-analyzer runs the tool after each save and reports its diagnostics.": "rust-analyzer 会在每次保存后运行该工具并报告其诊断。",
+ "select a limited number of rows from a table": "从表中选择有限数量的行",
+ "select all rows from a table": "从表中选择所有行",
+ "select specific rows from a table": "从表中选择特定行",
+ "select the number of specific rows in a table": "选择表中特定行的数量",
+ "stdin closed": "stdin 已关闭",
+ "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 声明",
+ "var declaration": "var 声明",
+ "variables (repeated ones are linked),": "变量(重复的变量会联动),",
+ "via the gear menu › Install Plugin from Disk….": "通过齿轮菜单 › 从磁盘安装插件…。",
+ "will be reverted to their last committed state. Uncommitted changes are lost.": "将还原到上次提交的状态。未提交的更改将会丢失。",
+ "will be shelved and reverted in the working tree.": "将被搁置,并在工作树中还原。",
+ "with BOM": "带 BOM",
+ "with BOM under Windows, with no BOM otherwise": "在 Windows 下带 BOM,其他系统不带 BOM",
+ "with NO BOM": "不带 BOM",
+ "with statement": "with 语句",
+ "· Conflicts": "· 冲突",
+ "· read-only": "· 只读",
+ "… more": "… 更多",
+ "↵ Open · ⇧↵ Open to the side · ⌘↵ Open in Find Window": "↵ 打开 · ⇧↵ 在侧边打开 · ⌘↵ 在查找窗口中打开",
+ "⌥← / ⌥→ and ⌥⌫ stop at humps of camelCase names.": "⌥← / ⌥→ 和 ⌥⌫ 会在 camelCase 名称的驼峰处停止。"
+}
diff --git a/src/platform/locales/zh.json b/src/platform/locales/zh.json
index 59a008bfd..158933fdc 100644
--- a/src/platform/locales/zh.json
+++ b/src/platform/locales/zh.json
@@ -34,10 +34,10 @@
"app.category.help": "帮助",
"app.category.view": "视图",
"app.category.window": "窗口",
- "app.exit.body": "确定要退出吗?",
+ "app.exit.body": "确定要退出 OpenIDEA 吗?",
"app.exit.confirm": "退出",
"app.exit.dontAsk": "不再询问",
- "app.exit.title": "退出 OpenIDEA?",
+ "app.exit.title": "确认退出",
"app.keymap.count": "{count, plural, other {# 个快捷键}}",
"app.keymap.empty": "没有匹配的快捷键",
"app.keymap.filter": "按操作或快捷键筛选",
@@ -62,10 +62,10 @@
"app.window.openFailed": "无法打开 {name}",
"app.window.pickTitle": "在新窗口中打开",
"app.window.askTitle": "打开项目",
- "app.window.askBody": "在新窗口还是当前窗口中打开项目“{name}”?",
+ "app.window.askBody": "项目可以在新窗口中打开,也可以替换当前窗口中的项目。\n要如何打开“{name}”?",
"app.window.askThis": "当前窗口",
"app.window.askNew": "新窗口",
- "app.window.askRemember": "记住选择,不再询问",
+ "app.window.askRemember": "不再询问",
"common.cancel": "取消",
"common.close": "关闭",
"common.copied": "已复制",
@@ -312,5 +312,6 @@
"menu.github.pullRequests": "查看拉取请求",
"menu.github.createPullRequest": "创建拉取请求…",
"menu.github.checkoutPullRequest": "签出拉取请求…",
- "menu.github.openInBrowser": "在 GitHub 上打开"
+ "menu.github.openInBrowser": "在 GitHub 上打开",
+ "settings.zoom.hint": "使用 {zoomIn} 或 {zoomOut} 更改,使用 {reset} 重置为 100%"
}
diff --git a/src/ui/Button.tsx b/src/ui/Button.tsx
index 5dde7d07c..dcc83eedb 100644
--- a/src/ui/Button.tsx
+++ b/src/ui/Button.tsx
@@ -5,6 +5,7 @@ import { shortcutLabel } from "@/platform/keymap";
import { Icon, type IconName } from "./icons";
import { tooltipAttrs } from "./Tooltip";
import styles from "./Button.module.css";
+import { useTx } from "@/platform/i18n";
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
variant?: "primary" | "secondary" | "ghost";
@@ -14,18 +15,20 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
}
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(
- { variant = "secondary", size = "normal", icon, className, children, type = "button", ...rest },
+ { variant = "secondary", size = "normal", icon, className, children, type = "button", title, ...rest },
ref,
) {
+ const tx = useTx();
return (
<button
ref={ref}
type={type}
className={clsx(styles.button, styles[variant], size === "small" && styles.small, className)}
+ title={tx(title)}
{...rest}
>
{icon && <Icon name={icon} size={14} />}
- {children}
+ {typeof children === "string" ? tx(children) : children}
</button>
);
});
@@ -65,8 +68,9 @@ export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(functio
},
ref,
) {
+ const tx = useTx();
const a = action ? getAction(action) : undefined;
- const label = title ?? a?.title ?? action ?? icon;
+ const label = tx(title) ?? a?.title ?? action ?? icon;
const keys = shortcut ?? (action ? shortcutLabel(action) : undefined);
return (
<button
diff --git a/src/ui/Checkbox.tsx b/src/ui/Checkbox.tsx
index 95a36a1d4..e2b13e4f1 100644
--- a/src/ui/Checkbox.tsx
+++ b/src/ui/Checkbox.tsx
@@ -2,6 +2,7 @@ import { useId, type ReactNode } from "react";
import clsx from "clsx";
import { Icon } from "./icons";
import styles from "./Checkbox.module.css";
+import { useTx } from "@/platform/i18n";
export interface CheckboxProps {
checked: boolean;
@@ -16,6 +17,7 @@ export interface CheckboxProps {
export function Checkbox({ checked, onChange, label, disabled, indeterminate, className, ...aria }: CheckboxProps) {
const id = useId();
+ const tx = useTx();
return (
<label className={clsx(styles.row, disabled && styles.disabled, className)} htmlFor={id}>
<span className={styles.boxWrap}>
@@ -26,7 +28,7 @@ export function Checkbox({ checked, onChange, label, disabled, indeterminate, cl
checked={checked}
disabled={disabled}
aria-checked={indeterminate ? "mixed" : checked}
- aria-label={aria["aria-label"]}
+ aria-label={tx(aria["aria-label"])}
onChange={(e) => onChange(e.target.checked)}
ref={(el) => {
if (el) el.indeterminate = !!indeterminate;
@@ -36,7 +38,7 @@ export function Checkbox({ checked, onChange, label, disabled, indeterminate, cl
{indeterminate ? <Icon name="minus" size={12} /> : checked ? <Icon name="check" size={12} /> : null}
</span>
</span>
- {label != null && <span className={styles.label}>{label}</span>}
+ {label != null && <span className={styles.label}>{typeof label === "string" ? tx(label) : label}</span>}
</label>
);
}
diff --git a/src/ui/Dialog.module.css b/src/ui/Dialog.module.css
index 3adef91a8..494b6fc0f 100644
--- a/src/ui/Dialog.module.css
+++ b/src/ui/Dialog.module.css
@@ -190,6 +190,65 @@
outline-offset: 1px;
}
+/* Messages alert (IDEA AlertDialog): 32px icon, bold title, text; draggable anywhere but controls. */
+.message {
+ flex: 1;
+ min-height: 0;
+ overflow: auto;
+ display: flex;
+ gap: 16px;
+ padding: 20px 24px 4px 20px;
+ cursor: default;
+ touch-action: none;
+}
+.messageIcon {
+ flex: none;
+}
+.messageShape {
+ fill: var(--message-icon-color);
+}
+.messageGlyph {
+ stroke: var(--fg-button-primary);
+}
+.question,
+.info {
+ --message-icon-color: var(--info);
+}
+.warning {
+ --message-icon-color: var(--warning);
+}
+.error {
+ --message-icon-color: var(--danger);
+}
+.messageText {
+ flex: 1;
+ min-width: 0;
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ padding-top: 4px;
+}
+.messageTitle {
+ color: var(--fg-strong);
+ font-weight: 600;
+}
+.messageBody {
+ color: var(--fg-strong);
+ line-height: 1.5;
+ overflow-wrap: anywhere;
+ white-space: pre-line;
+}
+.messageExtra {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 8px;
+ margin-top: 8px;
+}
+.messageFooter {
+ padding: 16px 24px 20px;
+}
+
@keyframes rise {
from {
opacity: 0;
diff --git a/src/ui/Dialog.tsx b/src/ui/Dialog.tsx
index 237ca3b1c..3e893b2a4 100644
--- a/src/ui/Dialog.tsx
+++ b/src/ui/Dialog.tsx
@@ -5,6 +5,7 @@ import { usePlatform } from "@/platform/platformInfo";
import { Button, IconButton } from "./Button";
import { Icon } from "./icons";
import { FOCUSABLE, openLayer, trapTab } from "./popupState";
+import { useTx } from "@/platform/i18n";
import styles from "./Dialog.module.css";
/**
@@ -44,7 +45,10 @@ const MAC_ORDER: Record<DialogButtonRole, number> = { cancel: -10, extra: 0, def
* default action last, others in between. Elsewhere: declaration order with the
* default action first, e.g. OK · Cancel · Apply.
*/
-export function orderDialogButtons<T extends { role?: DialogButtonRole }>(buttons: readonly T[], platform: DialogPlatform): T[] {
+export function orderDialogButtons<T extends { role?: DialogButtonRole }>(
+ buttons: readonly T[],
+ platform: DialogPlatform,
+): T[] {
const role = (b: T) => b.role ?? "extra";
if (platform === "mac") {
return buttons
@@ -67,6 +71,7 @@ export function DialogButtons({
platform?: DialogPlatform;
}) {
const platform = useDialogPlatform(override);
+ const tx = useTx();
return (
<div className={styles.buttons}>
{orderDialogButtons(buttons, platform).map((b) => (
@@ -74,12 +79,12 @@ export function DialogButtons({
key={b.label}
variant={b.role === "default" ? "primary" : "secondary"}
disabled={b.disabled}
- title={b.title}
+ title={tx(b.title)}
data-autofocus={b.autoFocus ? "" : undefined}
data-dialog-default={b.role === "default" ? "" : undefined}
onClick={b.onClick ?? (b.role === "cancel" ? onCancel : undefined)}
>
- {b.label}
+ {tx(b.label)}
</Button>
))}
</div>
@@ -117,6 +122,50 @@ export interface DialogProps {
chrome?: "default" | "window";
/** Test hook: force macOS or Windows/Linux chrome and button order. */
platform?: DialogPlatform;
+ /**
+ * A Messages alert (IDEA `MessageDialogBuilder`): no title bar, this icon on the
+ * left, the title in bold above the content, `footerStart` under the text.
+ */
+ icon?: MessageIconKind;
+}
+
+export type MessageIconKind = "question" | "info" | "warning" | "error";
+
+const MESSAGE_GLYPH: Record<MessageIconKind, ReactNode> = {
+ question: (
+ <path
+ d="M12.6 12.6a3.4 3.4 0 1 1 5 3c-1 .6-1.6 1.2-1.6 2.4v.6M16 22.2v.4"
+ fill="none"
+ strokeWidth="2.6"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ ),
+ info: <path d="M16 15v7M16 10.2v.4" fill="none" strokeWidth="2.6" strokeLinecap="round" />,
+ warning: <path d="M16 11v6.5M16 21.6v.4" fill="none" strokeWidth="2.6" strokeLinecap="round" />,
+ error: <path d="M12 12l8 8M20 12l-8 8" fill="none" strokeWidth="2.6" strokeLinecap="round" />,
+};
+
+function MessageIcon({ kind }: { kind: MessageIconKind }) {
+ return (
+ <svg
+ className={clsx(styles.messageIcon, styles[kind])}
+ width={32}
+ height={32}
+ viewBox="0 0 32 32"
+ aria-hidden="true"
+ >
+ {kind === "warning" ? (
+ <path
+ className={styles.messageShape}
+ d="M13.4 4.6a3 3 0 0 1 5.2 0l11 19.4A3 3 0 0 1 27 28.5H5A3 3 0 0 1 2.4 24z"
+ />
+ ) : (
+ <circle className={styles.messageShape} cx="16" cy="16" r="14" />
+ )}
+ <g className={styles.messageGlyph}>{MESSAGE_GLYPH[kind]}</g>
+ </svg>
+ );
}
/**
@@ -145,12 +194,15 @@ function DialogInner({
className,
dismissOnBackdrop,
platform: platformOverride,
+ icon,
...aria
}: DialogProps) {
const ref = useRef<HTMLDivElement>(null);
const platform = useDialogPlatform(platformOverride);
+ const tx = useTx();
+ if (typeof title === "string") title = tx(title);
// Choosers and untitled dialogs (Recent Files, About) are IDEA popups.
- const popup = position === "top" || title == null;
+ const popup = position === "top" || (title == null && !icon);
const onCloseRef = useRef(onClose);
const buttonsRef = useRef(buttons);
useLayoutEffect(() => {
@@ -176,10 +228,12 @@ function DialogInner({
const layer = openLayer(() => ref.current);
const previous = document.activeElement as HTMLElement | null;
const el = ref.current;
- // Content first, then the default button; never the title bar's close button.
+ // Content first (an alert's checkbox is not content), then the default button; never the title bar's close button.
const target =
el?.querySelector<HTMLElement>("[data-autofocus]") ??
- el?.querySelector<HTMLElement>(`[data-dialog-body] :is(${FOCUSABLE})`) ??
+ (el?.hasAttribute("data-alert")
+ ? null
+ : el?.querySelector<HTMLElement>(`[data-dialog-body] :is(${FOCUSABLE})`)) ??
el?.querySelector<HTMLElement>("[data-dialog-footer] [data-dialog-default]:not([disabled])") ??
el?.querySelector<HTMLElement>(`[data-dialog-footer] :is(${FOCUSABLE})`) ??
el;
@@ -213,7 +267,7 @@ function DialogInner({
}, []);
const drag = (e: PointerEvent<HTMLDivElement>) => {
- if (popup || e.button !== 0 || (e.target as Element).closest("button")) return;
+ if (popup || e.button !== 0 || (e.target as Element).closest("button, input, label, a, select, textarea")) return;
const el = ref.current;
if (!el) return;
e.preventDefault();
@@ -222,7 +276,10 @@ function DialogInner({
const base = { left: rect.left - offset.x, top: rect.top - offset.y };
const move = (ev: globalThis.PointerEvent) => {
// Keep the title bar reachable.
- const x = Math.min(Math.max(ev.clientX - start.x, -base.left - rect.width + 80), window.innerWidth - base.left - 80);
+ const x = Math.min(
+ Math.max(ev.clientX - start.x, -base.left - rect.width + 80),
+ window.innerWidth - base.left - 80,
+ );
const y = Math.min(Math.max(ev.clientY - start.y, -base.top), window.innerHeight - base.top - 28);
setOffset({ x, y });
};
@@ -251,11 +308,12 @@ function DialogInner({
aria-label={label}
tabIndex={-1}
data-platform={platform}
+ data-alert={icon ? "" : undefined}
data-inactive={active ? undefined : ""}
className={clsx(styles.dialog, popup ? styles.popup : styles.window, className)}
style={{ width, translate: offset.x || offset.y ? `${offset.x}px ${offset.y}px` : undefined }}
>
- {popup ? (
+ {icon ? null : popup ? (
title != null && (
<div className={styles.popupHeader}>
<span className={styles.title}>{title}</span>
@@ -284,21 +342,38 @@ function DialogInner({
<IconButton icon="close" title="Close" size="small" tabIndex={-1} onClick={onClose} />
</div>
)}
- <div className={styles.body} data-dialog-body="">
- {children}
- </div>
- {hasFooter && (
- <div className={styles.footer} data-dialog-footer="">
- {onHelp && (
- <button type="button" className={styles.help} aria-label="Help" onClick={onHelp}>
- ?
- </button>
- )}
- {footerStart && <div className={styles.footerStart}>{footerStart}</div>}
- {footer}
- {!!buttons?.length && <DialogButtons buttons={buttons} onCancel={onClose} platform={platform} />}
+ {icon ? (
+ <div className={styles.message} data-dialog-body="" onPointerDown={drag}>
+ <MessageIcon kind={icon} />
+ <div className={styles.messageText}>
+ {title != null && <div className={styles.messageTitle}>{title}</div>}
+ <div className={styles.messageBody}>{typeof children === "string" ? tx(children) : children}</div>
+ {footerStart && <div className={styles.messageExtra}>{footerStart}</div>}
+ </div>
+ </div>
+ ) : (
+ <div className={styles.body} data-dialog-body="">
+ {children}
</div>
)}
+ {icon
+ ? !!buttons?.length && (
+ <div className={clsx(styles.footer, styles.messageFooter)} data-dialog-footer="" onPointerDown={drag}>
+ <DialogButtons buttons={buttons} onCancel={onClose} platform={platform} />
+ </div>
+ )
+ : hasFooter && (
+ <div className={styles.footer} data-dialog-footer="">
+ {onHelp && (
+ <button type="button" className={styles.help} aria-label="Help" onClick={onHelp}>
+ ?
+ </button>
+ )}
+ {footerStart && <div className={styles.footerStart}>{footerStart}</div>}
+ {footer}
+ {!!buttons?.length && <DialogButtons buttons={buttons} onCancel={onClose} platform={platform} />}
+ </div>
+ )}
</div>
</div>,
document.body,
diff --git a/src/ui/Feedback.tsx b/src/ui/Feedback.tsx
index 1439b01c7..a1d4ec31f 100644
--- a/src/ui/Feedback.tsx
+++ b/src/ui/Feedback.tsx
@@ -2,6 +2,7 @@ import type { ReactNode } from "react";
import clsx from "clsx";
import { Icon, type IconName } from "./icons";
import { IconButton } from "./Button";
+import { T } from "./T";
import styles from "./Feedback.module.css";
export interface ProgressBarProps {
@@ -87,7 +88,7 @@ export interface EmptyStateProps {
export function EmptyState({ title, children, actions, className }: EmptyStateProps) {
return (
<div className={clsx(styles.empty, className)}>
- {title && <div className={styles.emptyTitle}>{title}</div>}
+ {title && <div className={styles.emptyTitle}>{typeof title === "string" ? <T>{title}</T> : title}</div>}
{children && <div className={styles.emptyBody}>{children}</div>}
{actions && <div className={styles.emptyActions}>{actions}</div>}
</div>
@@ -134,15 +135,15 @@ export function Toast({
<Icon name={LEVEL_ICON[level]} size={16} className={clsx(styles.toastIcon, styles[`level-${level}`])} />
<div className={styles.toastMain}>
<div className={styles.toastHead}>
- <span className={styles.toastTitle}>{title}</span>
+ <span className={styles.toastTitle}>{typeof title === "string" ? <T>{title}</T> : title}</span>
{meta && <span className={styles.toastMeta}>{meta}</span>}
</div>
- {body && <div className={styles.toastBody}>{body}</div>}
+ {body && <div className={styles.toastBody}>{typeof body === "string" ? <T>{body}</T> : body}</div>}
{actions && actions.length > 0 && (
<div className={styles.toastActions}>
{actions.map((a) => (
<button key={a.label} type="button" className={styles.link} onClick={a.run}>
- {a.label}
+ <T>{a.label}</T>
</button>
))}
</div>
diff --git a/src/ui/Input.tsx b/src/ui/Input.tsx
index a186ec492..bb2e8ddc9 100644
--- a/src/ui/Input.tsx
+++ b/src/ui/Input.tsx
@@ -3,6 +3,7 @@ import clsx from "clsx";
import { Icon, type IconName } from "./icons";
import { IconButton } from "./Button";
import styles from "./Input.module.css";
+import { useTx } from "@/platform/i18n";
export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
invalid?: boolean;
@@ -12,9 +13,10 @@ export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>,
}
export const Input = forwardRef<HTMLInputElement, InputProps>(function Input(
- { invalid, mono, variant = "framed", className, spellCheck = false, autoComplete = "off", ...rest },
+ { invalid, mono, variant = "framed", className, spellCheck = false, autoComplete = "off", placeholder, ...rest },
ref,
) {
+ const tx = useTx();
return (
<input
ref={ref}
@@ -23,6 +25,7 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(function Input(
autoCorrect="off"
autoCapitalize="off"
aria-invalid={invalid || undefined}
+ placeholder={tx(placeholder)}
className={clsx(styles.input, variant === "bare" ? styles.bare : styles.framed, mono && styles.mono, className)}
{...rest}
/>
@@ -65,10 +68,12 @@ export const SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(functi
size = "normal",
variant = "framed",
className,
+ placeholder,
...rest
},
ref,
) {
+ const tx = useTx();
return (
<div
className={clsx(
@@ -90,6 +95,7 @@ export const SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(functi
autoCorrect="off"
autoCapitalize="off"
aria-invalid={invalid || undefined}
+ placeholder={tx(placeholder)}
onChange={(e) => onChange(e.target.value)}
{...rest}
/>
diff --git a/src/ui/Menu.tsx b/src/ui/Menu.tsx
index 78b4cee41..8856ffaf2 100644
--- a/src/ui/Menu.tsx
+++ b/src/ui/Menu.tsx
@@ -21,11 +21,19 @@ import { Icon, type IconName } from "./icons";
import { Popup, type PopupAnchor } from "./Popup";
import type { Placement } from "@floating-ui/react-dom";
import styles from "./Menu.module.css";
+import { tx } from "@/platform/i18n";
export type MenuItem =
| { kind: "separator" }
| { kind: "header"; label: string }
- | { kind: "action"; action: string; arg?: unknown; label?: string; icon?: IconName | (string & {}); disabled?: boolean }
+ | {
+ kind: "action";
+ action: string;
+ arg?: unknown;
+ label?: string;
+ icon?: IconName | (string & {});
+ disabled?: boolean;
+ }
| {
kind?: "item";
id?: string;
@@ -61,7 +69,7 @@ export function resolveMenuItems(items: MenuItem[]): Resolved[] {
return;
}
if (item.kind === "header") {
- out.push({ kind: "header", key: `h${i}`, label: item.label });
+ out.push({ kind: "header", key: `h${i}`, label: tx(item.label) });
return;
}
if (item.kind === "action") {
@@ -70,7 +78,7 @@ export function resolveMenuItems(items: MenuItem[]): Resolved[] {
out.push({
kind: "item",
key: item.action,
- label: item.label ?? a.title,
+ label: tx(item.label) ?? a.title,
icon: item.icon ?? a.icon,
shortcut: shortcutLabel(item.action),
disabled: !!item.disabled || !isActionEnabled(a),
@@ -78,7 +86,7 @@ export function resolveMenuItems(items: MenuItem[]): Resolved[] {
});
return;
}
- out.push({ ...item, kind: "item", key: item.id ?? `${i}:${item.label}` });
+ out.push({ ...item, label: tx(item.label), kind: "item", key: item.id ?? `${i}:${item.label}` });
});
while (out.length && out[out.length - 1]!.kind === "separator") out.pop();
return out;
diff --git a/src/ui/Select.tsx b/src/ui/Select.tsx
index 24f43484d..6eb2738c8 100644
--- a/src/ui/Select.tsx
+++ b/src/ui/Select.tsx
@@ -3,6 +3,7 @@ import clsx from "clsx";
import { Icon, type IconName } from "./icons";
import { Popup } from "./Popup";
import { List, listNavigate } from "./List";
+import { useTx } from "@/platform/i18n";
import styles from "./Select.module.css";
export interface SelectOption<V extends string = string> {
@@ -39,6 +40,7 @@ export function Select<V extends string = string>({
renderValue,
...aria
}: SelectProps<V>) {
+ const tx = useTx();
const [open, setOpen] = useState(false);
const triggerRef = useRef<HTMLButtonElement>(null);
const current = options.find((o) => o.value === value);
@@ -78,7 +80,7 @@ export function Select<V extends string = string>({
const n = options.length;
for (let s = 1; s <= n; s++) {
const i = (active + s) % n;
- if (!options[i]!.disabled && options[i]!.label.toLowerCase().startsWith(ch)) {
+ if (!options[i]!.disabled && tx(options[i]!.label).toLowerCase().startsWith(ch)) {
setActive(i);
break;
}
@@ -109,7 +111,9 @@ export function Select<V extends string = string>({
) : (
<>
{current?.icon && <Icon name={current.icon} size={14} />}
- <span className={clsx(styles.value, !current && styles.placeholder)}>{current?.label ?? placeholder}</span>
+ <span className={clsx(styles.value, !current && styles.placeholder)}>
+ {tx(current?.label ?? placeholder)}
+ </span>
</>
)}
<Icon name="chevron-down" size={14} className={styles.chevron} />
@@ -127,7 +131,7 @@ export function Select<V extends string = string>({
items={options}
getKey={(o) => o.value}
isSection={isSection}
- renderSection={(o) => <span className={styles.disabled}>{o.label}</span>}
+ renderSection={(o) => <span className={styles.disabled}>{tx(o.label)}</span>}
activeIndex={active}
onActiveChange={setActive}
onActivate={(o) => choose(o)}
@@ -140,7 +144,7 @@ export function Select<V extends string = string>({
<>
<span className={styles.check}>{o.value === value && <Icon name="check" size={12} />}</span>
{o.icon && <Icon name={o.icon} size={14} />}
- <span className={styles.optionLabel}>{o.label}</span>
+ <span className={styles.optionLabel}>{tx(o.label)}</span>
{o.detail && <span className={styles.detail}>{o.detail}</span>}
</>
)}
diff --git a/src/ui/T.tsx b/src/ui/T.tsx
new file mode 100644
index 000000000..acf038249
--- /dev/null
+++ b/src/ui/T.tsx
@@ -0,0 +1,6 @@
+import { useTx } from "@/platform/i18n";
+
+/** English UI text, translated through the source-text catalog; re-renders on locale change. */
+export function T({ children }: { children: string }) {
+ return useTx()(children);
+}
diff --git a/src/ui/Tabs.tsx b/src/ui/Tabs.tsx
index e73894e86..f3dcb0c05 100644
--- a/src/ui/Tabs.tsx
+++ b/src/ui/Tabs.tsx
@@ -18,7 +18,9 @@ import { Icon, type IconName } from "./icons";
import { IconButton } from "./Button";
import { Menu, type MenuItem } from "./Menu";
import { tooltipAttrs } from "./Tooltip";
+import { T } from "./T";
import styles from "./Tabs.module.css";
+import { tx } from "@/platform/i18n";
export interface TabItem {
id: string;
@@ -181,7 +183,7 @@ export function Tabs({
const menuItems: MenuItem[] = items.map((t) => ({
id: t.id,
- label: t.text ?? (typeof t.label === "string" ? t.label : t.id),
+ label: tx(t.text ?? (typeof t.label === "string" ? t.label : t.id)),
icon: t.icon,
checked: t.id === activeId ? true : undefined,
run: () => onSelect(t.id),
@@ -250,7 +252,9 @@ export function Tabs({
{...tooltipAttrs(item.tooltip)}
>
{item.icon && <Icon name={item.icon} size={14} className={styles.tabIcon} />}
- <span className={clsx(styles.tabLabel, item.italic && styles.italic)}>{item.label}</span>
+ <span className={clsx(styles.tabLabel, item.italic && styles.italic)}>
+ {typeof item.label === "string" ? <T>{item.label}</T> : item.label}
+ </span>
{item.trailing}
{item.modified && !closable && <span className={styles.modified} aria-label="Modified" />}
</button>
diff --git a/src/ui/Tooltip.tsx b/src/ui/Tooltip.tsx
index 9396a7c9a..cbf9c8f81 100644
--- a/src/ui/Tooltip.tsx
+++ b/src/ui/Tooltip.tsx
@@ -7,6 +7,7 @@ import { cloneElement, isValidElement, useEffect, useRef, useState, type ReactEl
import { createPortal } from "react-dom";
import { computePosition, flip, offset, shift } from "@floating-ui/react-dom";
import styles from "./Tooltip.module.css";
+import { tx } from "@/platform/i18n";
export const TOOLTIP_DELAY = 600;
const WARM_MS = 400;
@@ -57,7 +58,7 @@ export function TooltipHost() {
};
const show = (el: HTMLElement) => {
- const text = el.dataset.tooltip;
+ const text = tx(el.dataset.tooltip);
if (!text || !el.isConnected) return;
visible = true;
anchorRef.current = el;
diff --git a/src/ui/Tree.tsx b/src/ui/Tree.tsx
index ed57e9590..a8033d3ca 100644
--- a/src/ui/Tree.tsx
+++ b/src/ui/Tree.tsx
@@ -26,6 +26,7 @@ import { Spinner } from "./Feedback";
import { fuzzyMatch } from "./match";
import { acquirePopup } from "./popupState";
import styles from "./Tree.module.css";
+import { T } from "./T";
export interface TreeRowState {
depth: number;
@@ -435,7 +436,7 @@ export function Tree<T>(props: TreeProps<T>) {
style={{ ...style, paddingLeft: pad + 20 }}
role="presentation"
>
- <Spinner size={12} /> Loading…
+ <Spinner size={12} /> <T>Loading…</T>
</div>
);
}
diff --git a/src/ui/index.ts b/src/ui/index.ts
index e1c2c6874..c95050444 100644
--- a/src/ui/index.ts
+++ b/src/ui/index.ts
@@ -20,3 +20,4 @@ export { acquirePopup, isPopupOpen, openLayer } from "./popupState";
export * from "./BarButton";
export * from "./AppLogo";
export { lazyComponent, prefetchLazyComponents } from "./lazy";
+export { T } from "./T";
diff --git a/src/workbench/ErrorBoundary.tsx b/src/workbench/ErrorBoundary.tsx
index 1afd9d48b..d1041108c 100644
--- a/src/workbench/ErrorBoundary.tsx
+++ b/src/workbench/ErrorBoundary.tsx
@@ -26,6 +26,6 @@ export class ErrorBoundary extends Component<Props, { error: Error | null }> {
}
/** Renders a component supplied through a slot or contribution. */
-export function Slot({ component: C }: { component: ComponentType }) {
- return <C />;
+export function Slot<P extends object = object>({ component: C, ...props }: { component: ComponentType<P> } & P) {
+ return <C {...(props as P)} />;
}
diff --git a/src/workbench/Notifications.tsx b/src/workbench/Notifications.tsx
index c1dbfab86..08909dabb 100644
--- a/src/workbench/Notifications.tsx
+++ b/src/workbench/Notifications.tsx
@@ -1,5 +1,5 @@
import { useEffect, useState } from "react";
-import { EmptyState, IconButton, Toast } from "@/ui";
+import { EmptyState, IconButton, Toast, T } from "@/ui";
import {
BALLOON_TIMEOUT,
clearNotifications,
@@ -83,7 +83,9 @@ export function NotificationsToolWindow() {
return (
<div className={styles.list} data-autofocus="" tabIndex={-1}>
{items.length === 0 ? (
- <EmptyState icon="bell">No notifications</EmptyState>
+ <EmptyState icon="bell">
+ <T>No notifications</T>
+ </EmptyState>
) : (
items.map((n) => (
<Toast
@@ -104,7 +106,16 @@ export function NotificationsToolWindow() {
export function NotificationsHeaderActions() {
const count = useNotifications((s) => s.items.filter((n) => n.logged).length);
- return <IconButton icon="trash" title="Clear All" size="small" iconSize={16} disabled={!count} onClick={clearNotifications} />;
+ return (
+ <IconButton
+ icon="trash"
+ title="Clear All"
+ size="small"
+ iconSize={16}
+ disabled={!count}
+ onClick={clearNotifications}
+ />
+ );
}
/** Unread count on the Notifications stripe button. */
diff --git a/src/workbench/StatusBar.tsx b/src/workbench/StatusBar.tsx
index c42a089ad..212ae1e2c 100644
--- a/src/workbench/StatusBar.tsx
+++ b/src/workbench/StatusBar.tsx
@@ -1,6 +1,6 @@
import { useMemo, useRef, useState } from "react";
import clsx from "clsx";
-import { BarButton, IconButton, Popup, ProgressBar, showContextMenu } from "@/ui";
+import { BarButton, IconButton, Popup, ProgressBar, showContextMenu, T } from "@/ui";
import { useContributions, type StatusItemContribution } from "./contributions";
import { ErrorBoundary } from "./ErrorBoundary";
import { isStatusItemVisible, statusBarMenu, useStatusWidgetOverrides } from "./statusBarWidgets";
@@ -74,7 +74,9 @@ export function TaskStatus() {
onClick={() => setOpen((v) => !v)}
className={styles.task}
>
- <span className={styles.taskTitle}>{current.title}</span>
+ <span className={styles.taskTitle}>
+ <T>{current.title}</T>
+ </span>
<ProgressBar
value={current.done ? 1 : current.fraction}
className={styles.taskBar}
@@ -91,11 +93,15 @@ export function TaskStatus() {
aria-label="Background tasks"
>
<div className={styles.taskList}>
- <div className={styles.taskListHeader}>Background Tasks</div>
+ <div className={styles.taskListHeader}>
+ <T>Background Tasks</T>
+ </div>
{tasks.map((t) => (
<div key={t.id} className={styles.taskRow}>
<div className={styles.taskRowHead}>
- <span className={styles.taskRowTitle}>{t.title}</span>
+ <span className={styles.taskRowTitle}>
+ <T>{t.title}</T>
+ </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?.()} />
diff --git a/src/workbench/TitleBar.tsx b/src/workbench/TitleBar.tsx
index 9b864d3a3..6ccfbea26 100644
--- a/src/workbench/TitleBar.tsx
+++ b/src/workbench/TitleBar.tsx
@@ -3,9 +3,9 @@ import clsx from "clsx";
import { useActions } from "@/platform/actions";
import { shortcutLabel } from "@/platform/keymap";
import { useProject } from "@/platform/project";
-import { BarButton, Icon, IconButton, Menu, type MenuItem } from "@/ui";
-import { useContributions, type TitleItemContribution } from "./contributions";
-import { ErrorBoundary } from "./ErrorBoundary";
+import { BarButton, Icon, IconButton, Menu, type MenuItem, T } from "@/ui";
+import { useContributions, useWorkbenchSlots, type TitleItemContribution } from "./contributions";
+import { ErrorBoundary, Slot } from "./ErrorBoundary";
import { MainMenu } from "./MainMenu";
import { WindowControls } from "./WindowControls";
import { usePlatform } from "@/platform/platformInfo";
@@ -37,6 +37,7 @@ function ProjectButton() {
const [open, setOpen] = useState(false);
const ref = useRef<HTMLButtonElement>(null);
const actions = useActions((s) => s.actions);
+ const Popup = useWorkbenchSlots((s) => s.projectPopup);
const items = useMemo<MenuItem[]>(() => {
const list: MenuItem[] = [{ kind: "action", action: "file.openProject", label: "Open…" }];
if (actions.has("welcome.recentProjects")) list.push({ kind: "action", action: "welcome.recentProjects" });
@@ -52,7 +53,7 @@ function ProjectButton() {
className={styles.widget}
tooltip={root}
aria-label={label}
- aria-haspopup="menu"
+ aria-haspopup={Popup ? "dialog" : "menu"}
aria-expanded={open}
onClick={() => setOpen((v) => !v)}
>
@@ -62,7 +63,11 @@ function ProjectButton() {
<span className={styles.widgetText}>{label}</span>
<Icon name="chevron-down" size={12} className={styles.chevron} />
</BarButton>
- <Menu open={open} onClose={() => setOpen(false)} anchor={ref} items={items} aria-label="Project" />
+ {Popup ? (
+ open && <Slot component={Popup} anchor={ref} onClose={() => setOpen(false)} />
+ ) : (
+ <Menu open={open} onClose={() => setOpen(false)} anchor={ref} items={items} aria-label="Project" />
+ )}
</>
);
}
@@ -89,7 +94,9 @@ function VcsFallback() {
aria-expanded={open}
onClick={() => setOpen((v) => !v)}
>
- <span className={styles.widgetText}>Version Control</span>
+ <span className={styles.widgetText}>
+ <T>Version Control</T>
+ </span>
<Icon name="chevron-down" size={12} className={styles.chevron} />
</BarButton>
<Menu open={open} onClose={() => setOpen(false)} anchor={ref} items={items} aria-label="Version Control" />
@@ -135,7 +142,7 @@ export function TitleBar({
{frameless && !minimal && <MainMenu onExpandedChange={setMenuExpanded} />}
{title && (
<span className={styles.windowTitle} data-tauri-drag-region>
- {title}
+ {typeof title === "string" ? <T>{title}</T> : title}
</span>
)}
{!minimal && !menuExpanded && (
diff --git a/src/workbench/Welcome.tsx b/src/workbench/Welcome.tsx
index 8507807f3..daf4baac7 100644
--- a/src/workbench/Welcome.tsx
+++ b/src/workbench/Welcome.tsx
@@ -2,7 +2,7 @@ import { useState } from "react";
import { executeAction } from "@/platform/actions";
import { shortcutLabel } from "@/platform/keymap";
import { useProject } from "@/platform/project";
-import { Button, Spinner } from "@/ui";
+import { Button, Spinner, T } from "@/ui";
import { useWorkbenchSlots } from "./contributions";
import { ErrorBoundary, Slot } from "./ErrorBoundary";
import { usePlatform } from "@/platform/platformInfo";
@@ -16,7 +16,9 @@ function WelcomeFallback() {
return (
<div className={styles.fallback}>
<div className={styles.brand}>
- <span className={styles.name}>OpenIDEA</span>
+ <span className={styles.name}>
+ <T>OpenIDEA</T>
+ </span>
{version && <span className={styles.version}>{version}</span>}
</div>
<div className={styles.actions}>
@@ -33,12 +35,14 @@ function WelcomeFallback() {
}
}}
>
- Open…
+ <T>Open…</T>
</Button>
{(busy || opening) && <Spinner size={14} className={styles.spinner} />}
</div>
<div className={styles.hint}>
- <span>Open a folder</span>
+ <span>
+ <T>Open a folder</T>
+ </span>
<span className={styles.keys}>{shortcutLabel("file.openProject")}</span>
</div>
</div>
diff --git a/src/workbench/contributions.ts b/src/workbench/contributions.ts
index 17b587497..8c794206e 100644
--- a/src/workbench/contributions.ts
+++ b/src/workbench/contributions.ts
@@ -8,7 +8,7 @@
* The workbench renders whatever is registered; the action
* `toolwindow.<id>` toggles it (registered automatically).
*/
-import type { ComponentType, ReactNode } from "react";
+import type { ComponentType, ReactNode, RefObject } from "react";
import type { RunConfig } from "@/bindings";
import type { MenuItem } from "@/ui/Menu";
import { create } from "zustand";
@@ -181,11 +181,18 @@ interface WorkbenchSlots {
editorArea?: ComponentType;
/** Shown instead of the workbench when no project is open (recent projects…). */
welcome?: ComponentType;
+ /** The title bar project widget's popup (open / recent projects). */
+ projectPopup?: ComponentType<ProjectPopupProps>;
+}
+
+export interface ProjectPopupProps {
+ anchor: RefObject<HTMLElement | null>;
+ onClose: () => void;
}
export const useWorkbenchSlots = create<WorkbenchSlots>(() => ({}));
-function provideSlot(slot: keyof WorkbenchSlots, component: ComponentType): () => void {
+function provideSlot<K extends keyof WorkbenchSlots>(slot: K, component: NonNullable<WorkbenchSlots[K]>): () => void {
useWorkbenchSlots.setState({ [slot]: component });
return () => {
if (useWorkbenchSlots.getState()[slot] === component) useWorkbenchSlots.setState({ [slot]: undefined });
@@ -194,6 +201,8 @@ function provideSlot(slot: keyof WorkbenchSlots, component: ComponentType): () =
export const provideEditorArea = (component: ComponentType) => provideSlot("editorArea", component);
export const provideWelcomeView = (component: ComponentType) => provideSlot("welcome", component);
+export const provideProjectPopup = (component: ComponentType<ProjectPopupProps>) =>
+ provideSlot("projectPopup", component);
// ---------------------------------------------------------------------------
// File editors: `openFile` asks providers whether a path opens in another
diff --git a/src/workbench/toolwindows/ToolWindows.tsx b/src/workbench/toolwindows/ToolWindows.tsx
index 172ab666c..aebab66b9 100644
--- a/src/workbench/toolwindows/ToolWindows.tsx
+++ b/src/workbench/toolwindows/ToolWindows.tsx
@@ -16,14 +16,7 @@ import { create } from "zustand";
import { call, commands } from "@/platform/ipc";
import { shortcutLabel } from "@/platform/keymap";
import { useProject } from "@/platform/project";
-import {
- Icon,
- IconButton,
- Menu,
- showContextMenu,
- tooltipAttrs,
- type MenuItem,
-} from "@/ui";
+import { Icon, IconButton, Menu, showContextMenu, tooltipAttrs, type MenuItem, T } from "@/ui";
import { FOCUSABLE } from "@/ui/popupState";
import { useContributions, type ToolWindowAnchor, type ToolWindowContribution } from "../contributions";
import { useDistractionFree } from "../distractionFree";
@@ -43,6 +36,7 @@ import {
type StripeGroup,
} from "./store";
import styles from "./ToolWindows.module.css";
+import { tx } from "@/platform/i18n";
function byOrder(a: ToolWindowContribution, b: ToolWindowContribution) {
return (a.order ?? 100) - (b.order ?? 100) || a.title.localeCompare(b.title);
@@ -92,15 +86,13 @@ export function moveToMenu(tw: ToolWindowContribution): MenuItem {
return {
label: "Move To",
submenu: [
- ...GROUP_LABELS.map(
- ([group, label]): MenuItem => ({
- id: group,
- label,
- checked: group === current ? true : undefined,
- disabled: group === current,
- run: () => moveToolWindow(tw.id, group),
- }),
- ),
+ ...GROUP_LABELS.map(([group, label]): MenuItem => ({
+ id: group,
+ label,
+ checked: group === current ? true : undefined,
+ disabled: group === current,
+ run: () => moveToolWindow(tw.id, group),
+ })),
{ kind: "separator" },
{ label: "Restore Default Layout", run: resetToolWindowPlacements },
],
@@ -292,7 +284,7 @@ function StripeButton({
active && focused && styles.stripeFocused,
side === "right" && styles.stripeRight,
)}
- aria-label={tw.title}
+ aria-label={tx(tw.title)}
aria-pressed={active}
aria-keyshortcuts={shortcut}
data-stripe-button={tw.id}
@@ -313,11 +305,8 @@ function StripeButton({
{tw.useBadge && <StripeBadge useBadge={tw.useBadge} />}
</span>
{showName && (
- <span
- className={clsx(styles.stripeLabel, !/\s/.test(tw.title) && styles.stripeLabelWord)}
- aria-hidden="true"
- >
- {tw.title}
+ <span className={clsx(styles.stripeLabel, !/\s/.test(tw.title) && styles.stripeLabelWord)} aria-hidden="true">
+ <T>{tw.title}</T>
</span>
)}
</button>
@@ -421,7 +410,9 @@ export function ToolWindowStripe({
const isDrag = (e: DragEvent) => [...e.dataTransfer.types].includes(TOOL_WINDOW_MIME);
const indicator = (group: StripeGroup, before: string | null) =>
- drop && drop.group === group && drop.before === before ? <div className={styles.stripeDrop} aria-hidden="true" /> : null;
+ drop && drop.group === group && drop.before === before ? (
+ <div className={styles.stripeDrop} aria-hidden="true" />
+ ) : null;
const renderGroup = (group: StripeGroup, list: ToolWindowContribution[]) => (
<>
{list.map((w) => (
@@ -532,7 +523,7 @@ function ToolWindowView({ tw, hidden }: { tw: ToolWindowContribution; hidden: bo
ref={ref}
className={styles.window}
data-toolwindow={tw.id}
- aria-label={tw.title}
+ aria-label={tx(tw.title)}
hidden={hidden}
tabIndex={-1}
>
@@ -550,7 +541,9 @@ function ToolWindowView({ tw, hidden }: { tw: ToolWindowContribution; hidden: bo
aria-expanded={titleOpen}
onClick={() => setTitleOpen((v) => !v)}
>
- <span className={styles.title}>{tw.title}</span>
+ <span className={styles.title}>
+ <T>{tw.title}</T>
+ </span>
<Icon name="chevron-down" size={12} className={styles.titleChevron} />
</button>
<Menu
@@ -558,11 +551,13 @@ function ToolWindowView({ tw, hidden }: { tw: ToolWindowContribution; hidden: bo
onClose={() => setTitleOpen(false)}
anchor={titleRef}
items={own}
- aria-label={`${tw.title} view options`}
+ aria-label={`${tx(tw.title)} view options`}
/>
</>
) : (
- <span className={clsx(styles.title, styles.titlePlain)}>{tw.title}</span>
+ <span className={clsx(styles.title, styles.titlePlain)}>
+ <T>{tw.title}</T>
+ </span>
)}
{Tabs && (
<div className={styles.headerContent}>
@@ -597,7 +592,7 @@ function ToolWindowView({ tw, hidden }: { tw: ToolWindowContribution; hidden: bo
anchor={moreRef}
items={more}
placement="bottom-end"
- aria-label={`${tw.title} options`}
+ aria-label={`${tx(tw.title)} options`}
/>
</header>
<div className={styles.body} data-toolwindow-body="">