Skip to content

Build your personal knowledge base with Trilium Notes

add translation for ribbon widgets: image_properties.js

Nriver6743eb8d1b6b
diff --git a/src/public/app/widgets/ribbon_widgets/image_properties.js b/src/public/app/widgets/ribbon_widgets/image_properties.js
index 18bfdd651e..7ac67a8100 100644
--- a/src/public/app/widgets/ribbon_widgets/image_properties.js
+++ b/src/public/app/widgets/ribbon_widgets/image_properties.js
@@ -3,34 +3,35 @@ import NoteContextAwareWidget from "../note_context_aware_widget.js";
import toastService from "../../services/toast.js";
import openService from "../../services/open.js";
import utils from "../../services/utils.js";
+import { t } from "../../services/i18n.js";
const TPL = `
<div class="image-properties">
<div style="display: flex; justify-content: space-evenly; margin: 10px;">
<span>
- <strong>Original file name:</strong>
+ <strong>${t("image_properties.original_file_name")}:</strong>
<span class="image-filename"></span>
</span>
<span>
- <strong>File type:</strong>
+ <strong>${t("image_properties.file_type")}:</strong>
<span class="image-filetype"></span>
</span>
<span>
- <strong>File size:</strong>
+ <strong>${t("image_properties.file_size")}:</strong>
<span class="image-filesize"></span>
</span>
</div>
<div class="no-print" style="display: flex; justify-content: space-evenly; margin: 10px;">
- <button class="image-download btn btn-sm btn-primary" type="button">Download</button>
+ <button class="image-download btn btn-sm btn-primary" type="button">${t("image_properties.download")}</button>
- <button class="image-open btn btn-sm btn-primary" type="button">Open</button>
+ <button class="image-open btn btn-sm btn-primary" type="button">${t("image_properties.open")}</button>
- <button class="image-copy-reference-to-clipboard btn btn-sm btn-primary" type="button">Copy reference to clipboard</button>
+ <button class="image-copy-reference-to-clipboard btn btn-sm btn-primary" type="button">${t("image_properties.copy_reference_to_clipboard")}</button>
- <button class="image-upload-new-revision btn btn-sm btn-primary" type="button">Upload new revision</button>
+ <button class="image-upload-new-revision btn btn-sm btn-primary" type="button">${t("image_properties.upload_new_revision")}</button>
</div>
<input type="file" class="image-upload-new-revision-input" style="display: none">
@@ -53,7 +54,7 @@ export default class ImagePropertiesWidget extends NoteContextAwareWidget {
return {
show: this.isEnabled(),
activate: true,
- title: 'Image',
+ title: t("image_properties.title"),
icon: 'bx bx-image'
};
}
@@ -89,14 +90,13 @@ export default class ImagePropertiesWidget extends NoteContextAwareWidget {
const result = await server.upload(`images/${this.noteId}`, fileToUpload);
if (result.uploaded) {
- toastService.showMessage("New image revision has been uploaded.");
+ toastService.showMessage(t("image_properties.upload_success"));
await utils.clearBrowserCache();
this.refresh();
- }
- else {
- toastService.showError(`Upload of a new image revision failed: ${result.message}`);
+ } else {
+ toastService.showError(t("image_properties.upload_failed", { message: result.message }));
}
});
}
diff --git a/src/public/translations/cn/translation.json b/src/public/translations/cn/translation.json
index 3b9e07459b..a5884f76e6 100644
--- a/src/public/translations/cn/translation.json
+++ b/src/public/translations/cn/translation.json
@@ -685,9 +685,21 @@
"file_size": "文件大小",
"download": "下载",
"open": "打开",
- "upload_new_revision": "上传新修改",
- "upload_success": "新文件修改已上传。",
- "upload_failed": "新文件修改上传失败。",
+ "upload_new_revision": "上传新版本",
+ "upload_success": "新文件版本已上传。",
+ "upload_failed": "新文件版本上传失败。",
"title": "文件"
+ },
+ "image_properties": {
+ "original_file_name": "原始文件名",
+ "file_type": "文件类型",
+ "file_size": "文件大小",
+ "download": "下载",
+ "open": "打开",
+ "copy_reference_to_clipboard": "复制引用到剪贴板",
+ "upload_new_revision": "上传新版本",
+ "upload_success": "新图像版本已上传。",
+ "upload_failed": "新图像版本上传失败:{{message}}",
+ "title": "图像"
}
}
diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.json
index 83f4f86d67..391fed053b 100644
--- a/src/public/translations/en/translation.json
+++ b/src/public/translations/en/translation.json
@@ -690,5 +690,17 @@
"upload_success": "New file revision has been uploaded.",
"upload_failed": "Upload of a new file revision failed.",
"title": "File"
+ },
+ "image_properties": {
+ "original_file_name": "Original file name",
+ "file_type": "File type",
+ "file_size": "File size",
+ "download": "Download",
+ "open": "Open",
+ "copy_reference_to_clipboard": "Copy reference to clipboard",
+ "upload_new_revision": "Upload new revision",
+ "upload_success": "New image revision has been uploaded.",
+ "upload_failed": "Upload of a new image revision failed: {{message}}",
+ "title": "Image"
}
}