Skip to content

Build your personal knowledge base with Trilium Notes

client/image compression tool: reuse translation strings, set the correct title for the dialog

Adorian Dorane335ed952cfa
diff --git a/apps/client/src/widgets/ribbon/NoteActions.tsx b/apps/client/src/widgets/ribbon/NoteActions.tsx
index 7f0ec362d4..73a04683e1 100644
--- a/apps/client/src/widgets/ribbon/NoteActions.tsx
+++ b/apps/client/src/widgets/ribbon/NoteActions.tsx
@@ -196,7 +196,7 @@ export function NoteContextMenu({ note, noteContext, itemsAtStart, itemsNearNote
<ConvertNoteFormat note={note} />}
{/* Always the note-level dialog, an image note included: it has children of its
own, and reaching them is what makes this "images" and not "image". */}
- <CommandItem icon="bx bx-collapse-alt" text={t("note_actions.compress_images")}
+ <CommandItem icon="bx bx-collapse-alt" text={t("compress-images")}
disabled={isInOptionsOrHelp}
command={() => void showImageCompressionDialog({ type: "note", noteId: note.noteId })} />
<CommandItem command="showNoteOCRText" icon="bx bx-text" disabled={!["image", "file"].includes(noteType)} text={t("note_actions.view_ocr_text")} />
diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/context_menu.ts b/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/context_menu.ts
index a3a7e1bb50..bf4abcfbfa 100644
--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/context_menu.ts
+++ b/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/context_menu.ts
@@ -84,7 +84,7 @@ export async function openSpaceUsageContextMenu(
handler: () => onShowDetails(notePath)
},
{
- title: t("space_usage.menu_compress_images"),
+ title: t("compress-images"),
uiIcon: "bx bx-image",
handler: () => {
// An image note *is* one image, so the dialog is told its type and offers only the
diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/image_compression_dialog.tsx b/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/image_compression_dialog.tsx
index f5a9dae57f..e712360bd1 100644
--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/image_compression_dialog.tsx
+++ b/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/image_compression_dialog.tsx
@@ -87,6 +87,10 @@ function ImageCompressionDialog({ target, onFinished }: {
const reading = useCompressionReading(target, options);
const formats = readableFormats(target, reading);
+ // Named for what the run will actually reach. The dialog names its own action twice — once as
+ // the heading, once on the button that carries it out — and both say the same thing.
+ const action = isSingleImage(target) ? t("compress-image") : t("compress-images");
+
async function runPendingCompression() {
const settings = pending.current;
@@ -122,7 +126,7 @@ function ImageCompressionDialog({ target, onFinished }: {
return (
<Modal
className="image-compression-dialog"
- title={t("space_usage.compress_title")}
+ title={action}
size="sm"
minWidth={COMPRESSION_DIALOG_MIN_WIDTH}
show={shown}
@@ -130,7 +134,7 @@ function ImageCompressionDialog({ target, onFinished }: {
footer={<>
<Button text={t("space_usage.compress_cancel")} onClick={() => setShown(false)} />
<Button
- text={t("space_usage.compress_run")}
+ text={action}
kind="primary"
// Nothing asked of anything actually here would visit every image and change
// none of them: a run that provably does nothing is not one to offer. Also