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 buttons: attachments actions
Nriver02ecdf565e46
diff --git a/src/public/app/widgets/buttons/attachments_actions.js b/src/public/app/widgets/buttons/attachments_actions.jsindex c620301710..a7bdf70ab8 100644--- a/src/public/app/widgets/buttons/attachments_actions.js+++ b/src/public/app/widgets/buttons/attachments_actions.js@@ -1,3 +1,4 @@+import { t } from "../../services/i18n.js";import BasicWidget from "../basic_widget.js";import server from "../../services/server.js";import dialogService from "../../services/dialog.js";@@ -32,15 +33,15 @@ const TPL = `<div class="dropdown-menu dropdown-menu-right"><a data-trigger-command="openAttachment" class="dropdown-item"- title="File will be open in an external application and watched for changes. You'll then be able to upload the modified version back to Trilium.">Open externally</a>+ title="${t('attachments_actions.open_externally_title')}">${t('attachments_actions.open_externally')}</a><a data-trigger-command="openAttachmentCustom" class="dropdown-item"- title="File will be open in an external application and watched for changes. You'll then be able to upload the modified version back to Trilium.">Open custom</a>- <a data-trigger-command="downloadAttachment" class="dropdown-item">Download</a>- <a data-trigger-command="renameAttachment" class="dropdown-item">Rename attachment</a>- <a data-trigger-command="uploadNewAttachmentRevision" class="dropdown-item">Upload new revision</a>- <a data-trigger-command="copyAttachmentLinkToClipboard" class="dropdown-item">Copy link to clipboard</a>- <a data-trigger-command="convertAttachmentIntoNote" class="dropdown-item">Convert attachment into note</a>- <a data-trigger-command="deleteAttachment" class="dropdown-item">Delete attachment</a>+ title="${t('attachments_actions.open_custom_title')}">${t('attachments_actions.open_custom')}</a>+ <a data-trigger-command="downloadAttachment" class="dropdown-item">${t('attachments_actions.download')}</a>+ <a data-trigger-command="renameAttachment" class="dropdown-item">${t('attachments_actions.rename_attachment')}</a>+ <a data-trigger-command="uploadNewAttachmentRevision" class="dropdown-item">${t('attachments_actions.upload_new_revision')}</a>+ <a data-trigger-command="copyAttachmentLinkToClipboard" class="dropdown-item">${t('attachments_actions.copy_link_to_clipboard')}</a>+ <a data-trigger-command="convertAttachmentIntoNote" class="dropdown-item">${t('attachments_actions.convert_attachment_into_note')}</a>+ <a data-trigger-command="deleteAttachment" class="dropdown-item">${t('attachments_actions.delete_attachment')}</a></div><input type="file" class="attachment-upload-new-revision-input" style="display: none">@@ -70,26 +71,24 @@ export default class AttachmentActionsWidget extends BasicWidget {const result = await server.upload(`attachments/${this.attachmentId}/file`, fileToUpload);if (result.uploaded) {- toastService.showMessage("New attachment revision has been uploaded.");+ toastService.showMessage(t('attachments_actions.upload_success'));} else {- toastService.showError("Upload of a new attachment revision failed.");+ toastService.showError(t('attachments_actions.upload_failed'));}});if (!this.isFullDetail) {- // we deactivate this button because the WatchedFileUpdateStatusWidget assumes only one visible attachment- // in a note context, so it doesn't work in a listconst $openAttachmentButton = this.$widget.find("[data-trigger-command='openAttachment']");$openAttachmentButton.addClass("disabled").append($('<span class="disabled-tooltip"> (?)</span>')- .attr("title", "Opening attachment externally is available only from the detail page, please first click on the attachment detail first and repeat the action.")+ .attr("title", t('attachments_actions.open_externally_detail_page')));const $openAttachmentCustomButton = this.$widget.find("[data-trigger-command='openAttachmentCustom']");$openAttachmentCustomButton.addClass("disabled").append($('<span class="disabled-tooltip"> (?)</span>')- .attr("title", "Opening attachment externally is available only from the detail page, please first click on the attachment detail first and repeat the action.")+ .attr("title", t('attachments_actions.open_externally_detail_page')));}if (!utils.isElectron()){@@ -97,7 +96,7 @@ export default class AttachmentActionsWidget extends BasicWidget {$openAttachmentCustomButton.addClass("disabled").append($('<span class="disabled-tooltip"> (?)</span>')- .attr("title", "Custom opening of attachments can only be done from the client.")+ .attr("title", t('attachments_actions.open_custom_client_only')));}}@@ -123,29 +122,29 @@ export default class AttachmentActionsWidget extends BasicWidget {}async deleteAttachmentCommand() {- if (!await dialogService.confirm(`Are you sure you want to delete attachment '${this.attachment.title}'?`)) {+ if (!await dialogService.confirm(t('attachments_actions.delete_confirm', { title: this.attachment.title }))) {return;}await server.remove(`attachments/${this.attachmentId}`);- toastService.showMessage(`Attachment '${this.attachment.title}' has been deleted.`);+ toastService.showMessage(t('attachments_actions.delete_success', { title: this.attachment.title }));}async convertAttachmentIntoNoteCommand() {- if (!await dialogService.confirm(`Are you sure you want to convert attachment '${this.attachment.title}' into a separate note?`)) {+ if (!await dialogService.confirm(t('attachments_actions.convert_confirm', { title: this.attachment.title }))) {return;}const {note: newNote} = await server.post(`attachments/${this.attachmentId}/convert-to-note`)- toastService.showMessage(`Attachment '${this.attachment.title}' has been converted to note.`);+ toastService.showMessage(t('attachments_actions.convert_success', { title: this.attachment.title }));await ws.waitForMaxKnownEntityChangeId();await appContext.tabManager.getActiveContext().setNote(newNote.noteId);}async renameAttachmentCommand() {const attachmentTitle = await dialogService.prompt({- title: "Rename attachment",- message: "Please enter new attachment's name",+ title: t('attachments_actions.rename_attachment'),+ message: t('attachments_actions.enter_new_name'),defaultValue: this.attachment.title});diff --git a/src/public/translations/cn/translation.json b/src/public/translations/cn/translation.jsonindex 55752c4ed0..3cbf4f3a0e 100644--- a/src/public/translations/cn/translation.json+++ b/src/public/translations/cn/translation.json@@ -506,5 +506,26 @@"create_given_relation": "如果笔记还没有关系,则创建给定关系","change_target_note": "或更改现有关系的目标笔记","update_relation_target": "更新关系目标"+ },+ "attachments_actions": {+ "open_externally": "用外部程序打开",+ "open_externally_title": "文件将会在外部应用程序中打开,并监视其更改。然后您可以将修改后的版本上传回 Trilium。",+ "open_custom": "自定义打开方式",+ "open_custom_title": "文件将会在外部应用程序中打开,并监视其更改。然后您可以将修改后的版本上传回 Trilium。",+ "download": "下载",+ "rename_attachment": "重命名附件",+ "upload_new_revision": "上传新版本",+ "copy_link_to_clipboard": "复制链接到剪贴板",+ "convert_attachment_into_note": "将附件转换为笔记",+ "delete_attachment": "删除附件",+ "upload_success": "新附件版本已上传。",+ "upload_failed": "新附件版本上传失败。",+ "open_externally_detail_page": "外部打开附件仅在详细页面中可用,请首先点击附件详细信息,然后重复此操作。",+ "open_custom_client_only": "自定义打开附件只能通过客户端完成。",+ "delete_confirm": "您确定要删除附件 '{{title}}' 吗?",+ "delete_success": "附件 '{{title}}' 已被删除。",+ "convert_confirm": "您确定要将附件 '{{title}}' 转换为单独的笔记吗?",+ "convert_success": "附件 '{{title}}' 已转换为笔记。",+ "enter_new_name": "请输入附件的新名称"}}diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.jsonindex 62233356c4..1caa1fef14 100644--- a/src/public/translations/en/translation.json+++ b/src/public/translations/en/translation.json@@ -506,5 +506,27 @@"create_given_relation": "create given relation if note doesn't have one yet","change_target_note": "or change target note of the existing relation","update_relation_target": "Update relation target"+ },+ "attachments_actions": {+ "open_externally": "Open externally",+ "open_externally_title": "File will be open in an external application and watched for changes. You'll then be able to upload the modified version back to Trilium.",+ "open_custom": "Open custom",+ "open_custom_title": "File will be open in an external application and watched for changes. You'll then be able to upload the modified version back to Trilium.",+ "download": "Download",+ "rename_attachment": "Rename attachment",+ "upload_new_revision": "Upload new revision",+ "copy_link_to_clipboard": "Copy link to clipboard",+ "convert_attachment_into_note": "Convert attachment into note",+ "delete_attachment": "Delete attachment",+ "upload_success": "New attachment revision has been uploaded.",+ "upload_failed": "Upload of a new attachment revision failed.",+ "open_externally_detail_page": "Opening attachment externally is available only from the detail page, please first click on the attachment detail first and repeat the action.",+ "open_custom_client_only": "Custom opening of attachments can only be done from the client.",+ "delete_confirm": "Are you sure you want to delete attachment '{{title}}'?",+ "delete_success": "Attachment '{{title}}' has been deleted.",+ "convert_confirm": "Are you sure you want to convert attachment '{{title}}' into a separate note?",+ "convert_success": "Attachment '{{title}}' has been converted to note.",+ "rename_attachment": "Rename attachment",+ "enter_new_name": "Please enter new attachment's name"}}