Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
add translation for 6 more dialogs
Nrivera8d6e5b1ea98
diff --git a/src/public/app/widgets/dialogs/include_note.js b/src/public/app/widgets/dialogs/include_note.jsindex f4d81778d2..64f07da669 100644--- a/src/public/app/widgets/dialogs/include_note.js+++ b/src/public/app/widgets/dialogs/include_note.js@@ -1,3 +1,4 @@+import { t } from "../../services/i18n.js";import treeService from '../../services/tree.js';import noteAutocompleteService from '../../services/note_autocomplete.js';import utils from "../../services/utils.js";@@ -9,7 +10,7 @@ const TPL = `<div class="modal-dialog modal-lg" role="document"><div class="modal-content"><div class="modal-header">- <h5 class="modal-title">Include note</h5>+ <h5 class="modal-title">${t('include_note.dialog_title')}</h5><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>@@ -17,35 +18,35 @@ const TPL = `<form class="include-note-form"><div class="modal-body"><div class="form-group">- <label for="include-note-autocomplete">Note</label>+ <label for="include-note-autocomplete">${t('include_note.label_note')}</label><div class="input-group">- <input class="include-note-autocomplete form-control" placeholder="search for note by its name">+ <input class="include-note-autocomplete form-control" placeholder="${t('include_note.placeholder_search')}"></div></div>- Box size of the included note:+ ${t('include_note.box_size_prompt')}<div class="form-check"><label class="form-check-label"><input class="form-check-input" type="radio" name="include-note-box-size" value="small">- small (~ 10 lines)+ ${t('include_note.box_size_small')}</label></div><div class="form-check"><label class="form-check-label"><input class="form-check-input" type="radio" name="include-note-box-size" value="medium" checked>- medium (~ 30 lines)+ ${t('include_note.box_size_medium')}</label></div><div class="form-check"><label class="form-check-label"><input class="form-check-input" type="radio" name="include-note-box-size" value="full">- full (box shows complete text)+ ${t('include_note.box_size_full')}</label></div></div><div class="modal-footer">- <button type="submit" class="btn btn-primary">Include note <kbd>enter</kbd></button>+ <button type="submit" class="btn btn-primary">${t('include_note.button_include')} <kbd>enter</kbd></button></div></form></div>@@ -62,10 +63,8 @@ export default class IncludeNoteDialog extends BasicWidget {if (notePath) {this.$widget.modal('hide');-this.includeNote(notePath);- }- else {+ } else {logError("No noteId to include.");}@@ -75,15 +74,12 @@ export default class IncludeNoteDialog extends BasicWidget {async showIncludeNoteDialogEvent({textTypeWidget}) {this.textTypeWidget = textTypeWidget;-await this.refresh();-utils.openDialog(this.$widget);}async refresh(widget) {this.$autoComplete.val('');-noteAutocompleteService.initNoteAutocomplete(this.$autoComplete, {hideGoToSelectedNoteButton: true,allowCreatingNotes: true@@ -94,15 +90,13 @@ export default class IncludeNoteDialog extends BasicWidget {async includeNote(notePath) {const noteId = treeService.getNoteIdFromUrl(notePath);const note = await froca.getNote(noteId);-const boxSize = $("input[name='include-note-box-size']:checked").val();if (['image', 'canvas', 'mermaid'].includes(note.type)) {// there's no benefit to use insert note functionlity for images,// so we'll just add an IMG tagthis.textTypeWidget.addImage(noteId);- }- else {+ } else {this.textTypeWidget.addIncludeNote(noteId, boxSize);}}diff --git a/src/public/app/widgets/dialogs/info.js b/src/public/app/widgets/dialogs/info.jsindex 738ac438d2..5bfdb31cdc 100644--- a/src/public/app/widgets/dialogs/info.js+++ b/src/public/app/widgets/dialogs/info.js@@ -1,3 +1,4 @@+import { t } from "../../services/i18n.js";import utils from "../../services/utils.js";import BasicWidget from "../basic_widget.js";@@ -6,9 +7,9 @@ const TPL = `<div class="modal-dialog" role="document"><div class="modal-content"><div class="modal-header">- <h5 class="modal-title mr-auto">Info message</h5>+ <h5 class="modal-title mr-auto">${t("info.modalTitle")}</h5>- <button type="button" class="close" data-dismiss="modal" aria-label="Close">+ <button type="button" class="close" data-dismiss="modal" aria-label="${t("info.closeButton")}"><span aria-hidden="true">×</span></button></div>@@ -16,7 +17,7 @@ const TPL = `<div class="info-dialog-content"></div></div><div class="modal-footer">- <button class="info-dialog-ok-button btn btn-primary btn-sm">OK</button>+ <button class="info-dialog-ok-button btn btn-primary btn-sm">${t("info.okButton")}</button></div></div></div>diff --git a/src/public/app/widgets/dialogs/jump_to_note.js b/src/public/app/widgets/dialogs/jump_to_note.jsindex c6bfed2e7b..c8f33a11a3 100644--- a/src/public/app/widgets/dialogs/jump_to_note.js+++ b/src/public/app/widgets/dialogs/jump_to_note.js@@ -1,3 +1,4 @@+import { t } from "../../services/i18n.js";import noteAutocompleteService from '../../services/note_autocomplete.js';import utils from "../../services/utils.js";import appContext from "../../components/app_context.js";@@ -9,7 +10,7 @@ const TPL = `<div class="jump-to-note-dialog modal mx-auto" tabindex="-1" role="<div class="modal-content"><div class="modal-header"><div class="input-group">- <input class="jump-to-note-autocomplete form-control" placeholder="search for note by its name">+ <input class="jump-to-note-autocomplete form-control" placeholder="${t('jump_to_note.search_placeholder')}"></div><button type="button" class="close" data-dismiss="modal" aria-label="Close">@@ -20,7 +21,7 @@ const TPL = `<div class="jump-to-note-dialog modal mx-auto" tabindex="-1" role="<div class="algolia-autocomplete-container jump-to-note-results"></div></div><div class="modal-footer">- <button class="show-in-full-text-button btn btn-sm">Search in full text <kbd>Ctrl+Enter</kbd></button>+ <button class="show-in-full-text-button btn btn-sm">${t('jump_to_note.search_button')}</button></div></div></div>diff --git a/src/public/app/widgets/dialogs/markdown_import.js b/src/public/app/widgets/dialogs/markdown_import.jsindex b57d41574f..48bbf851d7 100644--- a/src/public/app/widgets/dialogs/markdown_import.js+++ b/src/public/app/widgets/dialogs/markdown_import.js@@ -1,3 +1,4 @@+import { t } from "../../services/i18n.js";import toastService from "../../services/toast.js";import utils from "../../services/utils.js";import appContext from "../../components/app_context.js";@@ -10,18 +11,18 @@ const TPL = `<div class="modal-dialog modal-lg" role="document"><div class="modal-content"><div class="modal-header">- <h5 class="modal-title">Markdown import</h5>+ <h5 class="modal-title">${t("markdown_import.dialog_title")}</h5><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button></div><div class="modal-body">- <p>Because of browser sandbox it's not possible to directly read clipboard from JavaScript. Please paste the Markdown to import to textarea below and click on Import button</p>+ <p>${t("markdown_import.modal_body_text")}</p><textarea class="markdown-import-textarea" style="height: 340px; width: 100%"></textarea></div><div class="modal-footer">- <button class="markdown-import-button btn btn-primary">Import <kbd>Ctrl+Enter</kbd></button>+ <button class="markdown-import-button btn btn-primary">${t("markdown_import.import_button")}</button></div></div></div>@@ -56,7 +57,7 @@ export default class MarkdownImportDialog extends BasicWidget {textEditor.model.insertContent(modelFragment, textEditor.model.document.selection);- toastService.showMessage("Markdown content has been imported into the document.");+ toastService.showMessage(t("markdown_import.import_success"));}async pasteMarkdownIntoTextEvent() {diff --git a/src/public/app/widgets/dialogs/move_to.js b/src/public/app/widgets/dialogs/move_to.jsindex 73e6788346..38063dd175 100644--- a/src/public/app/widgets/dialogs/move_to.js+++ b/src/public/app/widgets/dialogs/move_to.js@@ -5,13 +5,14 @@ import froca from "../../services/froca.js";import branchService from "../../services/branches.js";import treeService from "../../services/tree.js";import BasicWidget from "../basic_widget.js";+import { t } from "../../services/i18n.js"; // Added importconst TPL = `<div class="move-to-dialog modal mx-auto" tabindex="-1" role="dialog"><div class="modal-dialog modal-lg" style="max-width: 1000px" role="document"><div class="modal-content"><div class="modal-header">- <h5 class="modal-title mr-auto">Move notes to ...</h5>+ <h5 class="modal-title mr-auto">${t("move_to.dialog_title")}</h5><button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: 0 !important;"><span aria-hidden="true">×</span>@@ -19,21 +20,21 @@ const TPL = `</div><form class="move-to-form"><div class="modal-body">- <h5>Notes to move</h5>+ <h5>${t("move_to.notes_to_move")}</h5><ul class="move-to-note-list" style="max-height: 200px; overflow: auto;"></ul><div class="form-group"><label style="width: 100%">- Target parent note+ ${t("move_to.target_parent_note")}<div class="input-group">- <input class="move-to-note-autocomplete form-control" placeholder="search for note by its name">+ <input class="move-to-note-autocomplete form-control" placeholder="${t("move_to.search_placeholder")}"></div></label></div></div><div class="modal-footer">- <button type="submit" class="btn btn-primary">Move to selected note <kbd>enter</kbd></button>+ <button type="submit" class="btn btn-primary">${t("move_to.move_button")}</button></div></form></div>@@ -63,7 +64,7 @@ export default class MoveToDialog extends BasicWidget {froca.getBranchId(parentNoteId, noteId).then(branchId => this.moveNotesTo(branchId));}else {- logError("No path to move to.");+ logError(t("move_to.error_no_path"));}return false;@@ -96,6 +97,6 @@ export default class MoveToDialog extends BasicWidget {const parentBranch = froca.getBranch(parentBranchId);const parentNote = await parentBranch.getNote();- toastService.showMessage(`Selected notes have been moved into ${parentNote.title}`);+ toastService.showMessage(`${t("move_to.move_success_message")} ${parentNote.title}`);}}diff --git a/src/public/app/widgets/dialogs/note_type_chooser.js b/src/public/app/widgets/dialogs/note_type_chooser.jsindex 9a55b94170..18687bb46d 100644--- a/src/public/app/widgets/dialogs/note_type_chooser.js+++ b/src/public/app/widgets/dialogs/note_type_chooser.js@@ -1,3 +1,4 @@+import { t } from "../../services/i18n.js";import noteTypesService from "../../services/note_types.js";import BasicWidget from "../basic_widget.js";@@ -22,17 +23,17 @@ const TPL = `<div class="modal-dialog" style="max-width: 500px;" role="document"><div class="modal-content"><div class="modal-header">- <h5 class="modal-title mr-auto">Choose note type</h5>+ <h5 class="modal-title mr-auto">${t("note_type_chooser.modal_title")}</h5><button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: 0 !important;"><span aria-hidden="true">×</span></button></div><div class="modal-body">- Choose note type / template of the new note:+ ${t("note_type_chooser.modal_body")}<div class="dropdown">- <button class="note-type-dropdown-trigger" type="button" style="display: none;" data-toggle="dropdown">Dropdown trigger</button>+ <button class="note-type-dropdown-trigger" type="button" style="display: none;" data-toggle="dropdown">${t("note_type_chooser.dropdown_trigger")}</button><div class="note-type-dropdown dropdown-menu"></div></div>@@ -102,7 +103,7 @@ export default class NoteTypeChooserDialog extends BasicWidget {for (const noteType of noteTypes) {if (noteType.title === '----') {- this.$noteTypeDropdown.append($('<h6 class="dropdown-header">').append("Templates:"));+ this.$noteTypeDropdown.append($('<h6 class="dropdown-header">').append(t("note_type_chooser.templates")));}else {this.$noteTypeDropdown.append(diff --git a/src/public/translations/cn/translation.json b/src/public/translations/cn/translation.jsonindex 7f0101daab..ce0da68c8c 100644--- a/src/public/translations/cn/translation.json+++ b/src/public/translations/cn/translation.json@@ -14,7 +14,7 @@"help_on_links": "链接帮助","close": "关闭","note": "笔记",- "search_note": "根据名称搜索笔记",+ "search_note": "按名称搜索笔记","link_title_mirrors": "链接标题跟随笔记标题变化","link_title_arbitrary": "链接标题可随意修改","link_title": "链接标题"@@ -43,7 +43,7 @@"help_on_links": "链接帮助","notes_to_clone": "要克隆的笔记","target_parent_note": "目标父笔记",- "search_for_note_by_its_name": "根据名称搜索笔记",+ "search_for_note_by_its_name": "按名称搜索笔记","cloned_note_prefix_title": "克隆的笔记将在笔记树中显示给定的前缀","prefix_optional": "前缀(可选)","clone_to_selected_note": "克隆到选定的笔记 <kbd>回车</kbd>",@@ -157,5 +157,45 @@"codeImportedAsCode": "如果元数据不明确,将识别的代码文件(例如<code>.json</code>)导入为代码笔记","replaceUnderscoresWithSpaces": "在导入的笔记名称中将下划线替换为空格","import": "导入"+ },+ "include_note": {+ "dialog_title": "包含笔记",+ "label_note": "笔记",+ "placeholder_search": "按名称搜索笔记",+ "box_size_prompt": "包含笔记的框大小:",+ "box_size_small": "小型 (显示大约10行)",+ "box_size_medium": "中型 (显示大约30行)",+ "box_size_full": "完整显示(完整文本框)",+ "button_include": "包含笔记"+ },+ "info": {+ "modalTitle": "信息消息",+ "closeButton": "关闭",+ "okButton": "确定"+ },+ "jump_to_note": {+ "search_placeholder": "按笔记名称搜索",+ "search_button": "全文搜索 <kbd>Ctrl+回车</kbd>"+ },+ "move_to": {+ "dialog_title": "移动笔记到...",+ "notes_to_move": "需要移动的笔记",+ "target_parent_note": "目标父笔记",+ "search_placeholder": "通过名称搜索笔记",+ "move_button": "移动到选定的笔记 <kbd>回车</kbd>",+ "error_no_path": "没有可以移动到的路径。",+ "move_success_message": "所选笔记已移动到 "+ },+ "markdown_import": {+ "dialog_title": "Markdown 导入",+ "modal_body_text": "由于浏览器沙箱的限制,无法直接从 JavaScript 读取剪贴板内容。请将要导入的 Markdown 文本粘贴到下面的文本框中,然后点击导入按钮。",+ "import_button": "导入 Ctrl+回车",+ "import_success": "Markdown 内容已成功导入文档。"+ },+ "note_type_chooser": {+ "modal_title": "选择笔记类型",+ "modal_body": "选择新笔记的类型或模板:",+ "dropdown_trigger": "下拉触发",+ "templates": "模板:"}}diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.jsonindex 007f07904b..e90872aee7 100644--- a/src/public/translations/en/translation.json+++ b/src/public/translations/en/translation.json@@ -157,6 +157,45 @@"codeImportedAsCode": "Import recognized code files (e.g. <code>.json</code>) as code notes if it's unclear from metadata","replaceUnderscoresWithSpaces": "Replace underscores with spaces in imported note names","import": "Import"+ },+ "include_note": {+ "dialog_title": "Include note",+ "label_note": "Note",+ "placeholder_search": "search for note by its name",+ "box_size_prompt": "Box size of the included note:",+ "box_size_small": "small (~ 10 lines)",+ "box_size_medium": "medium (~ 30 lines)",+ "box_size_full": "full (box shows complete text)",+ "button_include": "Include note"+ },+ "info": {+ "modalTitle": "Info message",+ "closeButton": "Close",+ "okButton": "OK"+ },+ "jump_to_note": {+ "search_placeholder": "search for note by its name",+ "search_button": "Search in full text <kbd>Ctrl+Enter</kbd>"+ },+ "markdown_import": {+ "dialog_title": "Markdown import",+ "modal_body_text": "Because of browser sandbox it's not possible to directly read clipboard from JavaScript. Please paste the Markdown to import to textarea below and click on Import button",+ "import_button": "Import Ctrl+Enter",+ "import_success": "Markdown content has been imported into the document."+ },+ "move_to": {+ "dialog_title": "Move notes to ...",+ "notes_to_move": "Notes to move",+ "target_parent_note": "Target parent note",+ "search_placeholder": "search for note by its name",+ "move_button": "Move to selected note <kbd>enter</kbd>",+ "error_no_path": "No path to move to.",+ "move_success_message": "Selected notes have been moved into "+ },+ "note_type_chooser": {+ "modal_title": "Choose note type",+ "modal_body": "Choose note type / template of the new note:",+ "dropdown_trigger": "Dropdown trigger",+ "templates": "Templates:"}-}