mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-13 04:13:19 +08:00
client: Translate quick search
This commit is contained in:
parent
da0ddbb80d
commit
17c8708b54
@ -5,6 +5,7 @@ import froca from "../services/froca.js";
|
|||||||
import utils from "../services/utils.js";
|
import utils from "../services/utils.js";
|
||||||
import appContext from "../components/app_context.js";
|
import appContext from "../components/app_context.js";
|
||||||
import shortcutService from "../services/shortcuts.js";
|
import shortcutService from "../services/shortcuts.js";
|
||||||
|
import { t } from "../services/i18n.js";
|
||||||
|
|
||||||
const TPL = `
|
const TPL = `
|
||||||
<div class="quick-search input-group input-group-sm">
|
<div class="quick-search input-group input-group-sm">
|
||||||
@ -35,7 +36,7 @@ const TPL = `
|
|||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu dropdown-menu-left"></div>
|
<div class="dropdown-menu dropdown-menu-left"></div>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control form-control-sm search-string" placeholder="Quick search">
|
<input type="text" class="form-control form-control-sm search-string" placeholder="${t("quick-search.placeholder")}">
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
const MAX_DISPLAYED_NOTES = 15;
|
const MAX_DISPLAYED_NOTES = 15;
|
||||||
@ -94,7 +95,7 @@ export default class QuickSearchWidget extends BasicWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.$dropdownMenu.empty();
|
this.$dropdownMenu.empty();
|
||||||
this.$dropdownMenu.append('<span class="dropdown-item disabled"><span class="bx bx-loader bx-spin"></span> Searching ...</span>');
|
this.$dropdownMenu.append(`<span class="dropdown-item disabled"><span class="bx bx-loader bx-spin"></span>${t("quick-search.searching")}</span>`);
|
||||||
|
|
||||||
const { searchResultNoteIds, error } = await server.get(`quick-search/${encodeURIComponent(searchString)}`);
|
const { searchResultNoteIds, error } = await server.get(`quick-search/${encodeURIComponent(searchString)}`);
|
||||||
|
|
||||||
@ -115,7 +116,7 @@ export default class QuickSearchWidget extends BasicWidget {
|
|||||||
this.$dropdownMenu.empty();
|
this.$dropdownMenu.empty();
|
||||||
|
|
||||||
if (displayedNoteIds.length === 0) {
|
if (displayedNoteIds.length === 0) {
|
||||||
this.$dropdownMenu.append('<span class="dropdown-item disabled">No results found</span>');
|
this.$dropdownMenu.append(`<span class="dropdown-item disabled">${t("quick-search.no-results")}</span>`);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const note of await froca.getNotes(displayedNoteIds)) {
|
for (const note of await froca.getNotes(displayedNoteIds)) {
|
||||||
@ -140,11 +141,12 @@ export default class QuickSearchWidget extends BasicWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (searchResultNoteIds.length > MAX_DISPLAYED_NOTES) {
|
if (searchResultNoteIds.length > MAX_DISPLAYED_NOTES) {
|
||||||
this.$dropdownMenu.append(`<span class="dropdown-item disabled">... and ${searchResultNoteIds.length - MAX_DISPLAYED_NOTES} more results.</span>`);
|
const numRemainingResults = (searchResultNoteIds.length - MAX_DISPLAYED_NOTES);
|
||||||
|
this.$dropdownMenu.append(`<span class="dropdown-item disabled">${t("quick-search.more-results", { number: numRemainingResults })}</span>`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const $showInFullButton = $('<a class="dropdown-item" tabindex="0">')
|
const $showInFullButton = $('<a class="dropdown-item" tabindex="0">')
|
||||||
.append($('<button class="btn btn-sm">Show in full search</button>'));
|
.append($(`<button class="btn btn-sm">${t("quick-search.show-in-full-search")}</button>`));
|
||||||
|
|
||||||
this.$dropdownMenu.append($showInFullButton);
|
this.$dropdownMenu.append($showInFullButton);
|
||||||
|
|
||||||
|
@ -1346,5 +1346,12 @@
|
|||||||
},
|
},
|
||||||
"mermaid": {
|
"mermaid": {
|
||||||
"diagram_error": "The diagram could not be displayed. See <a href=\"https://mermaid-js.github.io/mermaid/#/flowchart?id=graph\">help and examples</a>."
|
"diagram_error": "The diagram could not be displayed. See <a href=\"https://mermaid-js.github.io/mermaid/#/flowchart?id=graph\">help and examples</a>."
|
||||||
|
},
|
||||||
|
"quick-search": {
|
||||||
|
"placeholder": "Quick search",
|
||||||
|
"searching": "Searching...",
|
||||||
|
"no-results": "No results found",
|
||||||
|
"more-results": "... and {{number}} more results.",
|
||||||
|
"show-in-full-search": "Show in full search"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1346,5 +1346,12 @@
|
|||||||
"disconnected_with_changes": "<p>Nu s-a putut realiza conexiunea la server-ul de sincronizare.<br>Există modificări nesincronizate.</p><p>Clic pentru a rula o sincronizare.</p>",
|
"disconnected_with_changes": "<p>Nu s-a putut realiza conexiunea la server-ul de sincronizare.<br>Există modificări nesincronizate.</p><p>Clic pentru a rula o sincronizare.</p>",
|
||||||
"in_progress": "Sincronizare cu server-ul în curs.",
|
"in_progress": "Sincronizare cu server-ul în curs.",
|
||||||
"unknown": "<p>Starea sincronizării va fi cunoscută după o încercare de sincronizare.</p><p>Clic pentru a rula sincronizarea acum.</p>"
|
"unknown": "<p>Starea sincronizării va fi cunoscută după o încercare de sincronizare.</p><p>Clic pentru a rula sincronizarea acum.</p>"
|
||||||
|
},
|
||||||
|
"quick-search": {
|
||||||
|
"more-results": "... și încă {{number}} rezultate.",
|
||||||
|
"no-results": "Niciun rezultat găsit",
|
||||||
|
"placeholder": "Căutare rapidă",
|
||||||
|
"searching": "Se caută...",
|
||||||
|
"show-in-full-search": "Afișează în căutare completă"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user