Skip to content

Commit

Permalink
Merge pull request #859 from pano9000/i18n_translatable_duplicate_not…
Browse files Browse the repository at this point in the history
…e_#825

i18n: make duplicate notes suffix translatable
  • Loading branch information
eliandoran authored Dec 29, 2024
2 parents 42c6c44 + 256853a commit 3c37d5d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/services/notes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 3 additions & 1 deletion translations/en/server.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
}
}

0 comments on commit 3c37d5d

Please sign in to comment.