Skip to content

Build your personal knowledge base with Trilium Notes

feat(mind map): name new nodes in the user's language

Elian Doran42977553c7fb
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 426f2f999b..361c0636f9 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -3523,6 +3523,8 @@
"linkBidirectional": "Bidirectional Link",
"clickTips": "Please click the target node",
"summary": "Summary",
+ "new-topic": "New topic",
+ "new-node": "New node",
"text-color": "Text",
"background-color": "Background",
"branch-color": "Branch",
diff --git a/apps/client/src/translations/ro/translation.json b/apps/client/src/translations/ro/translation.json
index 7c4bba0183..5b5940ebf7 100644
--- a/apps/client/src/translations/ro/translation.json
+++ b/apps/client/src/translations/ro/translation.json
@@ -2608,7 +2608,9 @@
"link": "Legătură",
"linkBidirectional": "Legătură bidirecțională",
"clickTips": "Vă rugăm să faceți clic pe nodul țintă",
- "summary": "Rezumat"
+ "summary": "Rezumat",
+ "new-topic": "Subiect nou",
+ "new-node": "Nod nou"
},
"llm": {
"feature_not_enabled": "Activați funcția experimentală LLM din Setări → Avansat → Funcții experimentale pentru a folosi integrările AI.",
diff --git a/apps/client/src/widgets/type_widgets/mind_map/MindMap.tsx b/apps/client/src/widgets/type_widgets/mind_map/MindMap.tsx
index 5a1a5d9ecd..9ce970e35b 100644
--- a/apps/client/src/widgets/type_widgets/mind_map/MindMap.tsx
+++ b/apps/client/src/widgets/type_widgets/mind_map/MindMap.tsx
@@ -20,8 +20,6 @@ import { renderIconClasses } from "./icons";
import { renderNodeLinks } from "./links";
import NodePanel from "./NodePanel";
-const NEW_TOPIC_NAME = "";
-
/**
* Recursively sanitizes a parsed Mind Elixir data structure in place, neutralizing any
* `dangerouslySetInnerHTML` payloads found anywhere in the tree.
@@ -134,7 +132,9 @@ export default function MindMap({ note, ntxId, noteContext }: TypeWidgetProps) {
console.debug("Wrong JSON content: ", content);
}
} else {
- newContent = VanillaMindElixir.new(NEW_TOPIC_NAME);
+ // Named rather than left blank: Mind Elixir falls back to an English "new topic" of
+ // its own for any empty name it is given.
+ newContent = VanillaMindElixir.new(t("mind-map.new-topic"));
}
apiRef.current?.init(newContent!);
}
@@ -216,6 +216,9 @@ function MindElixir({ children, containerRef: externalContainerRef, containerPro
el: containerRef.current,
editable,
contextMenu: { locale: buildMindElixirLangPack() },
+ // The name every node added to the map is born with, which Mind Elixir would otherwise
+ // give in English. Read afresh on every build, which follows a change of locale.
+ newTopicName: t("mind-map.new-node"),
theme: buildTheme(defaultColorScheme.current, containerRef.current)
});