mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
chore(command_palette): add translations
This commit is contained in:
parent
6915993a35
commit
933a11e9db
@ -23,15 +23,20 @@ class CommandRegistry {
|
|||||||
private aliases: Map<string, string> = new Map();
|
private aliases: Map<string, string> = new Map();
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
this.loadCommands();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async loadCommands() {
|
||||||
|
await translationsInitializedPromise;
|
||||||
this.registerDefaultCommands();
|
this.registerDefaultCommands();
|
||||||
this.loadKeyboardActionsAsync();
|
await this.loadKeyboardActionsAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
private registerDefaultCommands() {
|
private registerDefaultCommands() {
|
||||||
this.register({
|
this.register({
|
||||||
id: "export-note",
|
id: "export-note",
|
||||||
name: "Export Note",
|
name: t("command_palette.export_note_title"),
|
||||||
description: "Export current note",
|
description: t("command_palette.export_note_description"),
|
||||||
icon: "bx bx-export",
|
icon: "bx bx-export",
|
||||||
handler: () => {
|
handler: () => {
|
||||||
const notePath = appContext.tabManager.getActiveContextNotePath();
|
const notePath = appContext.tabManager.getActiveContextNotePath();
|
||||||
@ -46,8 +51,8 @@ class CommandRegistry {
|
|||||||
|
|
||||||
this.register({
|
this.register({
|
||||||
id: "show-attachments",
|
id: "show-attachments",
|
||||||
name: "Show Attachments",
|
name: t("command_palette.show_attachments_title"),
|
||||||
description: "View note attachments",
|
description: t("command_palette.show_attachments_description"),
|
||||||
icon: "bx bx-paperclip",
|
icon: "bx bx-paperclip",
|
||||||
handler: () => appContext.triggerCommand("showAttachments")
|
handler: () => appContext.triggerCommand("showAttachments")
|
||||||
});
|
});
|
||||||
@ -55,16 +60,16 @@ class CommandRegistry {
|
|||||||
// Special search commands with custom logic
|
// Special search commands with custom logic
|
||||||
this.register({
|
this.register({
|
||||||
id: "search-notes",
|
id: "search-notes",
|
||||||
name: "Search Notes",
|
name: t("command_palette.search_notes_title"),
|
||||||
description: "Open advanced search",
|
description: t("command_palette.search_notes_description"),
|
||||||
icon: "bx bx-search",
|
icon: "bx bx-search",
|
||||||
handler: () => appContext.triggerCommand("searchNotes", {})
|
handler: () => appContext.triggerCommand("searchNotes", {})
|
||||||
});
|
});
|
||||||
|
|
||||||
this.register({
|
this.register({
|
||||||
id: "search-in-subtree",
|
id: "search-in-subtree",
|
||||||
name: "Search in Subtree",
|
name: t("command_palette.search_subtree_title"),
|
||||||
description: "Search within current subtree",
|
description: t("command_palette.search_subtree_description"),
|
||||||
icon: "bx bx-search-alt",
|
icon: "bx bx-search-alt",
|
||||||
handler: () => {
|
handler: () => {
|
||||||
const notePath = appContext.tabManager.getActiveContextNotePath();
|
const notePath = appContext.tabManager.getActiveContextNotePath();
|
||||||
@ -76,16 +81,16 @@ class CommandRegistry {
|
|||||||
|
|
||||||
this.register({
|
this.register({
|
||||||
id: "show-search-history",
|
id: "show-search-history",
|
||||||
name: "Show Search History",
|
name: t("command_palette.search_history_title"),
|
||||||
description: "View previous searches",
|
description: t("command_palette.search_history_description"),
|
||||||
icon: "bx bx-history",
|
icon: "bx bx-history",
|
||||||
handler: () => appContext.triggerCommand("showSearchHistory")
|
handler: () => appContext.triggerCommand("showSearchHistory")
|
||||||
});
|
});
|
||||||
|
|
||||||
this.register({
|
this.register({
|
||||||
id: "show-launch-bar",
|
id: "show-launch-bar",
|
||||||
name: "Configure Launch Bar",
|
name: t("command_palette.configure_launch_bar_title"),
|
||||||
description: "Open the launch bar configuration, to add or remove items.",
|
description: t("command_palette.configure_launch_bar_description"),
|
||||||
icon: "bx bx-sidebar",
|
icon: "bx bx-sidebar",
|
||||||
handler: () => appContext.triggerCommand("showLaunchBarSubtree")
|
handler: () => appContext.triggerCommand("showLaunchBarSubtree")
|
||||||
});
|
});
|
||||||
@ -93,7 +98,6 @@ class CommandRegistry {
|
|||||||
|
|
||||||
private async loadKeyboardActionsAsync() {
|
private async loadKeyboardActionsAsync() {
|
||||||
try {
|
try {
|
||||||
await translationsInitializedPromise;
|
|
||||||
const actions = await keyboardActions.getActions();
|
const actions = await keyboardActions.getActions();
|
||||||
this.registerKeyboardActions(actions);
|
this.registerKeyboardActions(actions);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -1989,6 +1989,18 @@
|
|||||||
"add-column": "Add Column"
|
"add-column": "Add Column"
|
||||||
},
|
},
|
||||||
"command_palette": {
|
"command_palette": {
|
||||||
"tree-action-name": "Tree: {{name}}"
|
"tree-action-name": "Tree: {{name}}",
|
||||||
|
"export_note_title": "Export Note",
|
||||||
|
"export_note_description": "Export current note",
|
||||||
|
"show_attachments_title": "Show Attachments",
|
||||||
|
"show_attachments_description": "View note attachments",
|
||||||
|
"search_notes_title": "Search Notes",
|
||||||
|
"search_notes_description": "Open advanced search",
|
||||||
|
"search_subtree_title": "Search in Subtree",
|
||||||
|
"search_subtree_description": "Search within current subtree",
|
||||||
|
"search_history_title": "Show Search History",
|
||||||
|
"search_history_description": "View previous searches",
|
||||||
|
"configure_launch_bar_title": "Configure Launch Bar",
|
||||||
|
"configure_launch_bar_description": "Open the launch bar configuration, to add or remove items."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user