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 8 type widgets
Nriver2754bd7a9385
diff --git a/src/public/app/widgets/type_widgets/attachment_detail.js b/src/public/app/widgets/type_widgets/attachment_detail.jsindex fbc38e5615..9bdec99adb 100644--- a/src/public/app/widgets/type_widgets/attachment_detail.js+++ b/src/public/app/widgets/type_widgets/attachment_detail.js@@ -3,6 +3,7 @@ import AttachmentDetailWidget from "../attachment_detail.js";import linkService from "../../services/link.js";import froca from "../../services/froca.js";import utils from "../../services/utils.js";+import { t } from "../../services/i18n.js";const TPL = `<div class="attachment-detail note-detail-printable">@@ -47,15 +48,15 @@ export default class AttachmentDetailTypeWidget extends TypeWidget {this.$wrapper.empty();this.children = [];- const $helpButton = $('<button class="attachment-help-button" type="button" data-help-page="attachments" title="Open help page on attachments"><span class="bx bx-help-circle"></span></button>');+ const $helpButton = $('<button class="attachment-help-button" type="button" data-help-page="attachments" title="' + t('attachment_detail.open_help_page') + '"><span class="bx bx-help-circle"></span></button>');utils.initHelpButtons($helpButton);this.$linksWrapper.empty().append(- "Owning note: ",+ t('attachment_detail.owning_note'),await linkService.createLink(this.noteId),- ", you can also open the ",+ t('attachment_detail.you_can_also_open'),await linkService.createLink(this.noteId, {- title: 'List of all attachments',+ title: t('attachment_detail.list_of_all_attachments'),viewScope: {viewMode: 'attachments'}@@ -66,8 +67,7 @@ export default class AttachmentDetailTypeWidget extends TypeWidget {const attachment = await froca.getAttachment(this.attachmentId, true);if (!attachment) {- this.$wrapper.html("<strong>This attachment has been deleted.</strong>");-+ this.$wrapper.html("<strong>" + t('attachment_detail.attachment_deleted') + "</strong>");return;}diff --git a/src/public/app/widgets/type_widgets/attachment_list.js b/src/public/app/widgets/type_widgets/attachment_list.jsindex 8f6aa9f9e6..5bb4587033 100644--- a/src/public/app/widgets/type_widgets/attachment_list.js+++ b/src/public/app/widgets/type_widgets/attachment_list.js@@ -2,6 +2,7 @@ import TypeWidget from "./type_widget.js";import AttachmentDetailWidget from "../attachment_detail.js";import linkService from "../../services/link.js";import utils from "../../services/utils.js";+import { t } from "../../services/i18n.js";const TPL = `<div class="attachment-list note-detail-printable">@@ -39,19 +40,19 @@ export default class AttachmentListTypeWidget extends TypeWidget {}async doRefresh(note) {- const $helpButton = $('<button class="attachment-help-button" type="button" data-help-page="attachments" title="Open help page on attachments"><span class="bx bx-help-circle"></span></button>');+ const $helpButton = $('<button class="attachment-help-button" type="button" data-help-page="attachments" title="' + t('attachment_list.open_help_page') + '"><span class="bx bx-help-circle"></span></button>');utils.initHelpButtons($helpButton);const noteLink = await linkService.createLink(this.noteId); // do separately to avoid race condition between empty() and .append()this.$linksWrapper.empty().append($('<div>').append(- "Owning note: ",+ t('attachment_list.owning_note'),noteLink,),$('<div>').append($('<button class="btn btn-sm">')- .text("Upload attachments")+ .text(t('attachment_list.upload_attachments')).on('click', () => this.triggerCommand("showUploadAttachmentsDialog", {noteId: this.noteId})),$helpButton)@@ -64,8 +65,7 @@ export default class AttachmentListTypeWidget extends TypeWidget {const attachments = await note.getAttachments();if (attachments.length === 0) {- this.$list.html('<div class="alert alert-info">This note has no attachments.</div>');-+ this.$list.html('<div class="alert alert-info">' + t('attachment_list.no_attachments') + '</div>');return;}diff --git a/src/public/app/widgets/type_widgets/book.js b/src/public/app/widgets/type_widgets/book.jsindex 4c6c54c336..0fa02b7294 100644--- a/src/public/app/widgets/type_widgets/book.js+++ b/src/public/app/widgets/type_widgets/book.js@@ -1,4 +1,5 @@import TypeWidget from "./type_widget.js";+import { t } from "../../services/i18n.js";const TPL = `<div class="note-detail-book note-detail-printable">@@ -13,7 +14,7 @@ const TPL = `</style><div class="note-detail-book-empty-help alert alert-warning" style="margin: 50px; padding: 20px;">- This note of type Book doesn't have any child notes so there's nothing to display. See <a href="https://github.com/zadam/trilium/wiki/Book-note">wiki</a> for details.+ ${t('book.no_children_help')}</div></div>`;diff --git a/src/public/app/widgets/type_widgets/editable_code.js b/src/public/app/widgets/type_widgets/editable_code.jsindex 16b6f93ed1..3046b9e0cc 100644--- a/src/public/app/widgets/type_widgets/editable_code.js+++ b/src/public/app/widgets/type_widgets/editable_code.js@@ -1,3 +1,4 @@+import { t } from "../../services/i18n.js";import libraryLoader from "../../services/library_loader.js";import TypeWidget from "./type_widget.js";import keyboardActionService from "../../services/keyboard_actions.js";@@ -62,7 +63,7 @@ export default class EditableCodeTypeWidget extends TypeWidget {// all the way to the bottom of the note. With line wrap, there's no horizontal scrollbar so no problemlineWrapping: options.is('codeLineWrapEnabled'),dragDrop: false, // with true the editor inlines dropped files which is not what we expect- placeholder: "Type the content of your code note here...",+ placeholder: t('editable_code.placeholder'),});this.codeEditor.on('change', () => this.spacedUpdate.scheduleUpdate());diff --git a/src/public/app/widgets/type_widgets/editable_text.js b/src/public/app/widgets/type_widgets/editable_text.jsindex 48cb041aa2..6afd1ed589 100644--- a/src/public/app/widgets/type_widgets/editable_text.js+++ b/src/public/app/widgets/type_widgets/editable_text.js@@ -1,3 +1,4 @@+import { t } from "../../services/i18n.js";import libraryLoader from "../../services/library_loader.js";import noteAutocompleteService from '../../services/note_autocomplete.js';import mimeTypesService from '../../services/mime_types.js';@@ -167,7 +168,7 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {});await this.watchdog.create(this.$editor[0], {- placeholder: "Type the content of your note here ...",+ placeholder: t('editable_text.placeholder'),mention: mentionSetup,codeBlock: {languages: codeBlockLanguagesdiff --git a/src/public/app/widgets/type_widgets/empty.js b/src/public/app/widgets/type_widgets/empty.jsindex 031e09ee3e..fba2a1f7f5 100644--- a/src/public/app/widgets/type_widgets/empty.js+++ b/src/public/app/widgets/type_widgets/empty.js@@ -2,6 +2,7 @@ import noteAutocompleteService from '../../services/note_autocomplete.js';import TypeWidget from "./type_widget.js";import appContext from "../../components/app_context.js";import searchService from "../../services/search.js";+import { t } from "../../services/i18n.js";const TPL = `<div class="note-detail-empty note-detail-printable">@@ -33,9 +34,9 @@ const TPL = `</style><div class="form-group">- <label>Open a note by typing the note's title into the input below or choose a note in the tree.</label>+ <label>${t('empty.open_note_instruction')}</label><div class="input-group">- <input class="form-control note-autocomplete" placeholder="search for a note by its name">+ <input class="form-control note-autocomplete" placeholder="${t('empty.search_placeholder')}"></div></div>@@ -78,7 +79,7 @@ export default class EmptyTypeWidget extends TypeWidget {$('<div class="workspace-note">').append($("<div>").addClass(`${workspaceNote.getIcon()} workspace-icon`)).append($("<div>").text(workspaceNote.title))- .attr("title", `Enter workspace ${workspaceNote.title}`)+ .attr("title", t('empty.enter_workspace', { title: workspaceNote.title })).on('click', () => this.triggerCommand('hoistNote', {noteId: workspaceNote.noteId})));}diff --git a/src/public/app/widgets/type_widgets/file.js b/src/public/app/widgets/type_widgets/file.jsindex 783eac1ef0..6785517134 100644--- a/src/public/app/widgets/type_widgets/file.js+++ b/src/public/app/widgets/type_widgets/file.js@@ -1,5 +1,6 @@import openService from "../../services/open.js";import TypeWidget from "./type_widget.js";+import { t } from "../../services/i18n.js";const TPL = `<div class="note-detail-file note-detail-printable">@@ -25,7 +26,7 @@ const TPL = `<pre class="file-preview-content"></pre><div class="file-preview-not-available alert alert-info">- File preview is not available for this file format.+ ${t('file.file_preview_not_available')}</div><iframe class="pdf-preview" style="width: 100%; height: 100%; flex-grow: 100;"></iframe>diff --git a/src/public/app/widgets/type_widgets/protected_session.js b/src/public/app/widgets/type_widgets/protected_session.jsindex 994313fc2e..8d236f92f8 100644--- a/src/public/app/widgets/type_widgets/protected_session.js+++ b/src/public/app/widgets/type_widgets/protected_session.js@@ -1,5 +1,6 @@import protectedSessionService from '../../services/protected_session.js';import TypeWidget from "./type_widget.js";+import { t } from "../../services/i18n.js";const TPL = `<div class="protected-session-password-component note-detail-printable">@@ -12,11 +13,11 @@ const TPL = `<form class="protected-session-password-form"><div class="form-group">- <label for="protected-session-password-in-detail">Showing protected note requires entering your password:</label>+ <label for="protected-session-password-in-detail">${t('protected_session.enter_password_instruction')}</label><input class="protected-session-password-in-detail form-control protected-session-password" type="password"></div>- <button class="btn btn-primary">Start protected session <kbd>enter</kbd></button>+ <button class="btn btn-primary">${t('protected_session.start_session_button')} <kbd>enter</kbd></button></form></div>`;diff --git a/src/public/translations/cn/translation.json b/src/public/translations/cn/translation.jsonindex 6e73be2902..2f2ecd6954 100644--- a/src/public/translations/cn/translation.json+++ b/src/public/translations/cn/translation.json@@ -853,5 +853,39 @@"label_year_comparison": "数字比较(也包括>,>=,<)。","label_date_created": "上个月创建的笔记","error": "搜索错误:{{error}}"+ },+ "attachment_detail": {+ "open_help_page": "打开附件帮助页面",+ "owning_note": "所属笔记: ",+ "you_can_also_open": ",你还可以打开",+ "list_of_all_attachments": "所有附件列表",+ "attachment_deleted": "该附件已被删除。"+ },+ "attachment_list": {+ "open_help_page": "打开附件帮助页面",+ "owning_note": "所属笔记: ",+ "upload_attachments": "上传附件",+ "no_attachments": "此笔记没有附件。"+ },+ "book": {+ "no_children_help": "此类型为书籍的笔记没有任何子笔记,因此没有内容显示。请参阅 <a href=\"https://github.com/zadam/trilium/wiki/Book-note\">wiki</a> 了解详情"+ },+ "editable_code": {+ "placeholder": "在这里输入您的代码笔记内容..."+ },+ "editable_text": {+ "placeholder": "在这里输入您的笔记内容..."+ },+ "empty": {+ "open_note_instruction": "通过在下面的输入框中输入笔记标题或在树中选择笔记来打开笔记。",+ "search_placeholder": "按名称搜索笔记",+ "enter_workspace": "进入工作区 {{title}}"+ },+ "file": {+ "file_preview_not_available": "此文件格式不支持预览。"+ },+ "protected_session": {+ "enter_password_instruction": "显示受保护的笔记需要输入您的密码:",+ "start_session_button": "开始受保护的会话"}}diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.jsonindex 67a7538206..9ec0a91ad3 100644--- a/src/public/translations/en/translation.json+++ b/src/public/translations/en/translation.json@@ -854,5 +854,39 @@"label_year_comparison": "numerical comparison (also >, >=, <).","label_date_created": "notes created in the last month","error": "Search error: {{error}}"+ },+ "attachment_detail": {+ "open_help_page": "Open help page on attachments",+ "owning_note": "Owning note: ",+ "you_can_also_open": ", you can also open the ",+ "list_of_all_attachments": "List of all attachments",+ "attachment_deleted": "This attachment has been deleted."+ },+ "attachment_list": {+ "open_help_page": "Open help page on attachments",+ "owning_note": "Owning note: ",+ "upload_attachments": "Upload attachments",+ "no_attachments": "This note has no attachments."+ },+ "book": {+ "no_children_help": "This note of type Book doesn't have any child notes so there's nothing to display. See <a href=\"https://github.com/zadam/trilium/wiki/Book-note\">wiki</a> for details."+ },+ "editable_code": {+ "placeholder": "Type the content of your code note here..."+ },+ "editable_text": {+ "placeholder": "Type the content of your note here ..."+ },+ "empty": {+ "open_note_instruction": "Open a note by typing the note's title into the input below or choose a note in the tree.",+ "search_placeholder": "search for a note by its name",+ "enter_workspace": "Enter workspace {{title}}"+ },+ "file": {+ "file_preview_not_available": "File preview is not available for this file format."+ },+ "protected_session": {+ "enter_password_instruction": "Showing protected note requires entering your password:",+ "start_session_button": "Start protected session"}}