Skip to content

Build your personal knowledge base with Trilium Notes

i18n: make duplicate notes suffix translatable

Panagiotis Papadopoulos256853a6f81f
diff --git a/src/services/notes.ts b/src/services/notes.ts
index 14a44020f5..73ec387faf 100644
--- a/src/services/notes.ts
+++ b/src/services/notes.ts
@@ -923,8 +923,10 @@ function duplicateSubtree(origNoteId: string, newParentNoteId: string) {
const res = duplicateSubtreeInner(origNote, origBranch, newParentNoteId, noteIdMapping);
- if (!res.note.title.endsWith('(dup)')) {
- res.note.title += " (dup)";
+ const duplicateNoteSuffix = t("notes.duplicate-note-suffix");
+
+ if (!res.note.title.endsWith(duplicateNoteSuffix) && !res.note.title.startsWith(duplicateNoteSuffix)) {
+ res.note.title = t("notes.duplicate-note-title", { noteTitle: res.note.title, duplicateNoteSuffix: duplicateNoteSuffix });
}
res.note.save();
diff --git a/translations/en/server.json b/translations/en/server.json
index f726aaa5d6..c04fc52f9c 100644
--- a/translations/en/server.json
+++ b/translations/en/server.json
@@ -242,6 +242,8 @@
"visible-launchers-title": "Visible Launchers"
},
"notes": {
- "new-note": "New note"
+ "new-note": "New note",
+ "duplicate-note-suffix": "(dup)",
+ "duplicate-note-title": "{{ noteTitle }} {{ duplicateNoteSuffix }}"
}
}