diff --git a/src/public/app/widgets/floating_buttons/code_buttons.js b/src/public/app/widgets/floating_buttons/code_buttons.js index 3556d99cc..676aeee08 100644 --- a/src/public/app/widgets/floating_buttons/code_buttons.js +++ b/src/public/app/widgets/floating_buttons/code_buttons.js @@ -1,3 +1,4 @@ +import { t } from "../../services/i18n.js"; import server from "../../services/server.js"; import ws from "../../services/ws.js"; import appContext from "../../components/app_context.js"; @@ -15,15 +16,15 @@ const TPL = ` } - - - `; @@ -39,7 +40,7 @@ export default class CodeButtonsWidget extends NoteContextAwareWidget { this.$widget = $(TPL); this.$openTriliumApiDocsButton = this.$widget.find(".trilium-api-docs-button"); this.$openTriliumApiDocsButton.on("click", () => { - toastService.showMessage("Opening API docs..."); + toastService.showMessage(t('code_buttons.opening_api_docs_message')); if (this.note.mime.endsWith("frontend")) { window.open("https://zadam.github.io/trilium/frontend_api/FrontendScriptApi.html", "_blank"); @@ -58,7 +59,7 @@ export default class CodeButtonsWidget extends NoteContextAwareWidget { await appContext.tabManager.getActiveContext().setNote(notePath); - toastService.showMessage(`SQL Console note has been saved into ${await treeService.getNotePathTitle(notePath)}`); + toastService.showMessage(t('code_buttons.sql_console_saved_message', { notePath: await treeService.getNotePathTitle(notePath) })); }); keyboardActionService.updateDisplayedShortcuts(this.$widget); diff --git a/src/public/app/widgets/floating_buttons/copy_image_reference_button.js b/src/public/app/widgets/floating_buttons/copy_image_reference_button.js index 025d5b238..bf88feda9 100644 --- a/src/public/app/widgets/floating_buttons/copy_image_reference_button.js +++ b/src/public/app/widgets/floating_buttons/copy_image_reference_button.js @@ -1,3 +1,4 @@ +import { t } from "../../services/i18n.js"; import NoteContextAwareWidget from "../note_context_aware_widget.js"; import utils from "../../services/utils.js"; import imageService from "../../services/image.js"; @@ -5,7 +6,7 @@ import imageService from "../../services/image.js"; const TPL = ` + title="${t('hide_floating_buttons_button.button_title')}"> `; diff --git a/src/public/app/widgets/floating_buttons/mermaid_export_button.js b/src/public/app/widgets/floating_buttons/mermaid_export_button.js index c53b8d8a4..de275819b 100644 --- a/src/public/app/widgets/floating_buttons/mermaid_export_button.js +++ b/src/public/app/widgets/floating_buttons/mermaid_export_button.js @@ -1,9 +1,10 @@ +import { t } from "../../services/i18n.js"; import NoteContextAwareWidget from "../note_context_aware_widget.js"; const TPL = ` `; diff --git a/src/public/app/widgets/floating_buttons/relation_map_buttons.js b/src/public/app/widgets/floating_buttons/relation_map_buttons.js index 29c6629f6..63aa0ad18 100644 --- a/src/public/app/widgets/floating_buttons/relation_map_buttons.js +++ b/src/public/app/widgets/floating_buttons/relation_map_buttons.js @@ -1,3 +1,4 @@ +import { t } from "../../services/i18n.js"; import NoteContextAwareWidget from "../note_context_aware_widget.js"; const TPL = ` @@ -11,20 +12,20 @@ const TPL = ` + title="${t('relation_map_buttons.create_child_note_title')}"> + title="${t('relation_map_buttons.reset_pan_zoom_title')}">
+ title="${t('relation_map_buttons.zoom_in_title')}"> + title="${t('relation_map_buttons.zoom_out_title')}">
`; diff --git a/src/public/app/widgets/floating_buttons/zpetne_odkazy.js b/src/public/app/widgets/floating_buttons/zpetne_odkazy.js index 3b5205dd6..9b6ee2885 100644 --- a/src/public/app/widgets/floating_buttons/zpetne_odkazy.js +++ b/src/public/app/widgets/floating_buttons/zpetne_odkazy.js @@ -2,6 +2,7 @@ * !!! Filename is intentionally mangled, because some adblockers don't like the word "backlinks". */ +import { t } from "../../services/i18n.js"; import NoteContextAwareWidget from "../note_context_aware_widget.js"; import linkService from "../../services/link.js"; import server from "../../services/server.js"; @@ -100,8 +101,8 @@ export default class BacklinksWidget extends NoteContextAwareWidget { this.toggle(true); this.$count.text( - `${resp.count} backlink` - + (resp.count === 1 ? '' : 's') + // i18next plural + `${t('zpetne_odkazy.backlink', {count: resp.count})}` ); } @@ -138,7 +139,7 @@ export default class BacklinksWidget extends NoteContextAwareWidget { })); if (backlink.relationName) { - $item.append($("

").text(`relation: ${backlink.relationName}`)); + $item.append($("

").text(`${t('zpetne_odkazy.relation')}: ${backlink.relationName}`)); } else { $item.append(...backlink.excerpts); diff --git a/src/public/translations/cn/translation.json b/src/public/translations/cn/translation.json index 253ce279b..195ee012c 100644 --- a/src/public/translations/cn/translation.json +++ b/src/public/translations/cn/translation.json @@ -623,5 +623,32 @@ }, "note_launcher": { "this_launcher_doesnt_define_target_note": "此启动器未定义目标笔记。" + }, + "code_buttons": { + "execute_button_title": "执行脚本", + "trilium_api_docs_button_title": "打开 Trilium API 文档", + "save_to_note_button_title": "保存到笔记", + "opening_api_docs_message": "正在打开 API 文档...", + "sql_console_saved_message": "SQL 控制台已保存到 {{note_path}}" + }, + "copy_image_reference_button": { + "button_title": "复制图片引用到剪贴板,可粘贴到文本笔记中。" + }, + "hide_floating_buttons_button": { + "button_title": "隐藏按钮" + }, + "mermaid_export_button": { + "button_title": "导出Mermaid图表为SVG" + }, + "relation_map_buttons": { + "create_child_note_title": "创建新的子笔记并添加到关系图", + "reset_pan_zoom_title": "重置平移和缩放到初始坐标和放大倍率", + "zoom_in_title": "放大", + "zoom_out_title": "缩小" + }, + "zpetne_odkazy": { + "backlink": "{{count}} 个反链", + "backlinks": "{{count}} 个反链", + "relation": "关系" } } diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.json index d1d7d97ab..6d1b921f2 100644 --- a/src/public/translations/en/translation.json +++ b/src/public/translations/en/translation.json @@ -624,5 +624,32 @@ }, "note_launcher": { "this_launcher_doesnt_define_target_note": "This launcher doesn't define target note." + }, + "code_buttons": { + "execute_button_title": "Execute script", + "trilium_api_docs_button_title": "Open Trilium API docs", + "save_to_note_button_title": "Save to note", + "opening_api_docs_message": "Opening API docs...", + "sql_console_saved_message": "SQL Console note has been saved into {{note_path}}" + }, + "copy_image_reference_button": { + "button_title": "Copy image reference to the clipboard, can be pasted into a text note." + }, + "hide_floating_buttons_button": { + "button_title": "Hide buttons" + }, + "mermaid_export_button": { + "button_title": "Export Mermaid diagram as SVG" + }, + "relation_map_buttons": { + "create_child_note_title": "Create new child note and add it into this relation map", + "reset_pan_zoom_title": "Reset pan & zoom to initial coordinates and magnification", + "zoom_in_title": "Zoom In", + "zoom_out_title": "Zoom Out" + }, + "zpetne_odkazy": { + "backlink": "{{count}} Backlink", + "backlinks": "{{count}} Backlinks", + "relation": "relation" } }