From c2a8f4f4a3821f3ea3836435edad09fe9a168729 Mon Sep 17 00:00:00 2001 From: Nriver <6752679+Nriver@users.noreply.github.com> Date: Mon, 5 Aug 2024 10:32:48 +0800 Subject: [PATCH] add translation for ribbon widgets: file_properties.js --- .../widgets/ribbon_widgets/file_properties.js | 28 +++++++++---------- src/public/translations/cn/translation.json | 12 ++++++++ src/public/translations/en/translation.json | 12 ++++++++ 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/public/app/widgets/ribbon_widgets/file_properties.js b/src/public/app/widgets/ribbon_widgets/file_properties.js index 1d543cef5..bdab79a25 100644 --- a/src/public/app/widgets/ribbon_widgets/file_properties.js +++ b/src/public/app/widgets/ribbon_widgets/file_properties.js @@ -4,6 +4,7 @@ import toastService from "../../services/toast.js"; import openService from "../../services/open.js"; import utils from "../../services/utils.js"; import protectedSessionHolder from "../../services/protected_session_holder.js"; +import { t } from "../../services/i18n.js"; const TPL = `
@@ -27,26 +28,26 @@ const TPL = ` - + - + - + - +
Note ID:${t("file_properties.note_id")}: Original file name:${t("file_properties.original_file_name")}:
File type:${t("file_properties.file_type")}: File size:${t("file_properties.file_size")}:
- +   - +   - +
@@ -72,7 +73,7 @@ export default class FilePropertiesWidget extends NoteContextAwareWidget { return { show: this.isEnabled(), activate: true, - title: 'File', + title: t("file_properties.title"), icon: 'bx bx-file' }; } @@ -103,12 +104,11 @@ export default class FilePropertiesWidget extends NoteContextAwareWidget { const result = await server.upload(`notes/${this.noteId}/file`, fileToUpload); if (result.uploaded) { - toastService.showMessage("New file revision has been uploaded."); + toastService.showMessage(t("file_properties.upload_success")); this.refresh(); - } - else { - toastService.showError("Upload of a new file revision failed."); + } else { + toastService.showError(t("file_properties.upload_failed")); } }); } @@ -126,7 +126,7 @@ export default class FilePropertiesWidget extends NoteContextAwareWidget { // open doesn't work for protected notes since it works through a browser which isn't in protected session this.$openButton.toggle(!note.isProtected); - this.$downloadButton.toggle(!note.isProtected || protectedSessionHolder.isProtectedSessionAvailable()) - this.$uploadNewRevisionButton.toggle(!note.isProtected || protectedSessionHolder.isProtectedSessionAvailable()) + this.$downloadButton.toggle(!note.isProtected || protectedSessionHolder.isProtectedSessionAvailable()); + this.$uploadNewRevisionButton.toggle(!note.isProtected || protectedSessionHolder.isProtectedSessionAvailable()); } } diff --git a/src/public/translations/cn/translation.json b/src/public/translations/cn/translation.json index cf6e6499d..3b9e07459 100644 --- a/src/public/translations/cn/translation.json +++ b/src/public/translations/cn/translation.json @@ -677,5 +677,17 @@ "no_edited_notes_found": "今天还没有编辑过的笔记...", "title": "编辑过的笔记", "deleted": "(已删除)" + }, + "file_properties": { + "note_id": "笔记 ID", + "original_file_name": "原始文件名", + "file_type": "文件类型", + "file_size": "文件大小", + "download": "下载", + "open": "打开", + "upload_new_revision": "上传新修改", + "upload_success": "新文件修改已上传。", + "upload_failed": "新文件修改上传失败。", + "title": "文件" } } diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.json index 12d26e888..83f4f86d6 100644 --- a/src/public/translations/en/translation.json +++ b/src/public/translations/en/translation.json @@ -678,5 +678,17 @@ "no_edited_notes_found": "No edited notes on this day yet ...", "title": "Edited Notes", "deleted": "(deleted)" + }, + "file_properties": { + "note_id": "Note ID", + "original_file_name": "Original file name", + "file_type": "File type", + "file_size": "File size", + "download": "Download", + "open": "Open", + "upload_new_revision": "Upload new revision", + "upload_success": "New file revision has been uploaded.", + "upload_failed": "Upload of a new file revision failed.", + "title": "File" } }