feat(i18n): add translation for note_autocomplete

This commit is contained in:
Elian Doran 2024-12-14 01:48:56 +02:00
parent 0f1a98795f
commit c95e478595
No known key found for this signature in database
2 changed files with 16 additions and 7 deletions

View File

@ -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");

View File

@ -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"
}
}