Skip to content

Build your personal knowledge base with Trilium Notes

feat(i18n): add translation for note_autocomplete

Elian Doranc95e47859593
diff --git a/src/public/app/services/note_autocomplete.js b/src/public/app/services/note_autocomplete.js
index 93c366bfa9..7fb29de46d 100644
--- a/src/public/app/services/note_autocomplete.js
+++ b/src/public/app/services/note_autocomplete.js
@@ -3,6 +3,7 @@ import appContext from "../components/app_context.js";
import utils from './utils.js';
import noteCreateService from './note_create.js';
import froca from "./froca.js";
+import { t } from "./i18n.js";
// this key needs to have this value, so it's hit by the tooltip
const SELECTED_NOTE_PATH_KEY = "data-note-path";
@@ -38,7 +39,7 @@ async function autocompleteSource(term, cb, options = {}) {
cb(
[{
noteTitle: term,
- highlightedNotePathTitle: `Searching...`
+ highlightedNotePathTitle: t("quick-search.searching")
}]
);
}
@@ -52,7 +53,7 @@ async function autocompleteSource(term, cb, options = {}) {
action: 'create-note',
noteTitle: term,
parentNoteId: activeNoteId || 'root',
- highlightedNotePathTitle: `Create and link child note "${utils.escapeHtml(term)}"`
+ highlightedNotePathTitle: t("note_autocomplete.create-note", { term })
}
].concat(results);
}
@@ -62,7 +63,7 @@ async function autocompleteSource(term, cb, options = {}) {
{
action: 'search-notes',
noteTitle: term,
- highlightedNotePathTitle: `Search for "${utils.escapeHtml(term)}" <kbd style='color: var(--muted-text-color); background-color: transparent; float: right;'>Ctrl+Enter</kbd>`
+ highlightedNotePathTitle: `${t("note_autocomplete.search-for", { term })} <kbd style='color: var(--muted-text-color); background-color: transparent; float: right;'>Ctrl+Enter</kbd>`
}
]);
}
@@ -72,7 +73,7 @@ async function autocompleteSource(term, cb, options = {}) {
{
action: 'external-link',
externalLink: term,
- highlightedNotePathTitle: `Insert external link to "${utils.escapeHtml(term)}"`
+ highlightedNotePathTitle: t("note_autocomplete.insert-external-link", { term })
}
].concat(results);
}
@@ -139,15 +140,15 @@ function initNoteAutocomplete($el, options) {
const $clearTextButton = $("<button>")
.addClass("input-group-text input-clearer-button bx bxs-tag-x")
- .prop("title", "Clear text field");
+ .prop("title", t("note_autocomplete.clear-text-field"));
const $showRecentNotesButton = $("<button>")
.addClass("input-group-text show-recent-notes-button bx bx-time")
- .prop("title", "Show recent notes");
+ .prop("title", t("note_autocomplete.show-recent-notes"));
const $fullTextSearchButton = $("<button>")
.addClass("input-group-text full-text-search-button bx bx-search")
- .prop("title", "Full text search (Shift+Enter)");
+ .prop("title", `${t("note_autocomplete.full-text-search")} (Shift+Enter)`);
const $goToSelectedNoteButton = $("<a>")
.addClass("input-group-text go-to-selected-note-button bx bx-arrow-to-right");
diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.json
index 23dbf00f66..62a00dda98 100644
--- a/src/public/translations/en/translation.json
+++ b/src/public/translations/en/translation.json
@@ -1583,5 +1583,13 @@
"background-effects-description": "The Mica effect adds a blurred, stylish background to app windows, creating depth and a modern look.",
"restart-app-button": "Restart the application to view the changes",
"zoom-factor": "Zoom factor"
+ },
+ "note_autocomplete": {
+ "search-for": "Search for \"{{term}}\"",
+ "create-note": "Create and link child note \"{{term}}\"",
+ "insert-external-link": "Insert external link to \"{{term}}\"",
+ "clear-text-field": "Clear text field",
+ "show-recent-notes": "Show recent notes",
+ "full-text-search": "Full text search"
}
}