Skip to content

Build your personal knowledge base with Trilium Notes

feat(settings): cross-reference OCR and language & region settings

Elian Doran6ecb1cb2b022
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index a11334dd5c..104b960d51 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -1265,6 +1265,7 @@
"jpeg_quality": "JPEG quality",
"jpeg_quality_description": "Recommended range is 50–85. Lower values reduce file size, higher values preserve detail.",
"ocr_section_title": "Text Extraction (OCR)",
+ "ocr_related_content_languages": "Content languages (used for text extraction)",
"ocr_auto_process": "Auto-process new files",
"ocr_auto_process_description": "Automatically extract text from newly uploaded or pasted files.",
"ocr_min_confidence": "Minimum confidence",
@@ -1983,7 +1984,7 @@
},
"content_language": {
"title": "Content languages",
- "description": "Select one or more languages that should appear in the language selection in the Basic Properties section of a read-only or editable text note. This will allow features such as spell-checking or right-to-left support."
+ "description": "Select one or more languages that should appear in the language selection in the Basic Properties section of a read-only or editable text note. This will allow features such as spell-checking, right-to-left support and text extraction (OCR)."
},
"switch_layout_button": {
"title_vertical": "Move editing pane to the bottom",
diff --git a/apps/client/src/widgets/type_widgets/options/media.tsx b/apps/client/src/widgets/type_widgets/options/media.tsx
index e64c6f8114..6e37b60985 100644
--- a/apps/client/src/widgets/type_widgets/options/media.tsx
+++ b/apps/client/src/widgets/type_widgets/options/media.tsx
@@ -5,10 +5,11 @@ import server from "../../../services/server";
import toast from "../../../services/toast";
import { FormTextBoxWithUnit } from "../../react/FormTextBox";
import FormToggle from "../../react/FormToggle";
-import Slider from "../../react/Slider";
import { useTriliumOption, useTriliumOptionBool } from "../../react/hooks";
+import Slider from "../../react/Slider";
import OptionsRow from "./components/OptionsRow";
import OptionsSection from "./components/OptionsSection";
+import RelatedSettings from "./components/RelatedSettings";
export default function MediaSettings() {
return (
@@ -68,25 +69,34 @@ function OcrSettings() {
const [ ocrMinConfidence, setOcrMinConfidence ] = useTriliumOption("ocrMinConfidence");
return (
- <OptionsSection title={t("images.ocr_section_title")}>
- <OptionsRow name="ocr-auto-process" label={t("images.ocr_auto_process")} description={t("images.ocr_auto_process_description")}>
- <FormToggle
- switchOnName="" switchOffName=""
- currentValue={ocrAutoProcess}
- onChange={setOcrAutoProcess}
- />
- </OptionsRow>
-
- <OptionsRow name="ocr-min-confidence" label={`${t("images.ocr_min_confidence")} (${Math.round(parseFloat(ocrMinConfidence ?? "0.75") * 100)}%)`} description={t("images.ocr_confidence_description")}>
- <Slider
- min={0} max={100} step={5}
- value={Math.round(parseFloat(ocrMinConfidence ?? "0.75") * 100)}
- onChange={(v) => setOcrMinConfidence(String(v / 100))}
- />
- </OptionsRow>
-
- <BatchProcessing />
- </OptionsSection>
+ <>
+ <OptionsSection title={t("images.ocr_section_title")}>
+ <OptionsRow name="ocr-auto-process" label={t("images.ocr_auto_process")} description={t("images.ocr_auto_process_description")}>
+ <FormToggle
+ switchOnName="" switchOffName=""
+ currentValue={ocrAutoProcess}
+ onChange={setOcrAutoProcess}
+ />
+ </OptionsRow>
+
+ <OptionsRow name="ocr-min-confidence" label={`${t("images.ocr_min_confidence")} (${Math.round(parseFloat(ocrMinConfidence ?? "0.75") * 100)}%)`} description={t("images.ocr_confidence_description")}>
+ <Slider
+ min={0} max={100} step={5}
+ value={Math.round(parseFloat(ocrMinConfidence ?? "0.75") * 100)}
+ onChange={(v) => setOcrMinConfidence(String(v / 100))}
+ />
+ </OptionsRow>
+
+ <BatchProcessing />
+ </OptionsSection>
+
+ <RelatedSettings items={[
+ {
+ title: t("images.ocr_related_content_languages"),
+ targetPage: "_optionsLocalization"
+ }
+ ]} />
+ </>
);
}
diff --git a/apps/server/package.json b/apps/server/package.json
index 44e3f6d333..2b7dbf4aac 100644
--- a/apps/server/package.json
+++ b/apps/server/package.json
@@ -5,7 +5,7 @@
"private": true,
"main": "./src/main.ts",
"scripts": {
- "dev": "cross-env NODE_ENV=development TRILIUM_ENV=dev TRILIUM_DATA_DIR=data TRILIUM_RESOURCE_DIR=src tsx watch --ignore '../client/node_modules/.vite-temp' ./src/main.ts",
+ "dev": "cross-env NODE_ENV=development TRILIUM_ENV=dev TRILIUM_DATA_DIR=data3 TRILIUM_RESOURCE_DIR=src TRILIUM_PORT=8081 tsx watch --ignore '../client/node_modules/.vite-temp' ./src/main.ts",
"dev-alt": "cross-env NODE_ENV=development TRILIUM_ENV=dev TRILIUM_DATA_DIR=data2 TRILIUM_RESOURCE_DIR=src tsx watch --ignore '../client/node_modules/.vite-temp' ./src/main.ts",
"start-no-dir": "cross-env NODE_ENV=development TRILIUM_ENV=dev TRILIUM_RESOURCE_DIR=src tsx watch --ignore '../client/node_modules/.vite-temp' ./src/main.ts",
"edit-integration-db": "cross-env NODE_ENV=development TRILIUM_PORT=8086 TRILIUM_ENV=dev TRILIUM_DATA_DIR=spec/db TRILIUM_INTEGRATION_TEST=edit TRILIUM_RESOURCE_DIR=src tsx watch --ignore '../client/node_modules/.vite-temp' ./src/main.ts",