Skip to content

Build your personal knowledge base with Trilium Notes

add translation for widget: attachment_detail.js

Nrivere7eec0f32841
diff --git a/src/public/app/widgets/attachment_detail.js b/src/public/app/widgets/attachment_detail.js
index 8c034b8cdb..63dc1ff7e2 100644
--- a/src/public/app/widgets/attachment_detail.js
+++ b/src/public/app/widgets/attachment_detail.js
@@ -1,3 +1,4 @@
+import { t } from "../services/i18n.js";
import utils from "../services/utils.js";
import AttachmentActionsWidget from "./buttons/attachments_actions.js";
import BasicWidget from "./basic_widget.js";
@@ -153,19 +154,19 @@ export default class AttachmentDetailWidget extends BasicWidget {
$deletionWarning.show();
if (willBeDeletedInMs >= 60000) {
- $deletionWarning.text(`This attachment will be automatically deleted in ${utils.formatTimeInterval(willBeDeletedInMs)}`);
+ $deletionWarning.text(t('attachment_detail_2.will_be_deleted_in', { time: utils.formatTimeInterval(willBeDeletedInMs) }));
} else {
- $deletionWarning.text(`This attachment will be automatically deleted soon`);
+ $deletionWarning.text(t('attachment_detail_2.will_be_deleted_soon'));
}
- $deletionWarning.append(", because the attachment is not linked in the note's content. To prevent deletion, add the attachment link back into the content or convert the attachment into note.");
+ $deletionWarning.append(t('attachment_detail_2.deletion_reason'));
} else {
this.$wrapper.removeClass("scheduled-for-deletion");
$deletionWarning.hide();
}
this.$wrapper.find('.attachment-details')
- .text(`Role: ${this.attachment.role}, Size: ${utils.formatSize(this.attachment.contentLength)}`);
+ .text(t('attachment_detail_2.role_and_size', { role: this.attachment.role, size: utils.formatSize(this.attachment.contentLength) }));
this.$wrapper.find('.attachment-actions-container').append(this.attachmentActionsWidget.render());
const {$renderedContent} = await contentRenderer.getRenderedContent(this.attachment, { imageHasZoom: this.isFullDetail });
@@ -186,9 +187,9 @@ export default class AttachmentDetailWidget extends BasicWidget {
utils.copyHtmlToClipboard($link[0].outerHTML);
- toastService.showMessage("Attachment link copied to clipboard.");
+ toastService.showMessage(t('attachment_detail_2.link_copied'));
} else {
- throw new Error(`Unrecognized attachment role '${this.attachment.role}'.`);
+ throw new Error(t('attachment_detail_2.unrecognized_role', { role: this.attachment.role }));
}
}
diff --git a/src/public/translations/cn/translation.json b/src/public/translations/cn/translation.json
index 882ce1629d..349c5d3961 100644
--- a/src/public/translations/cn/translation.json
+++ b/src/public/translations/cn/translation.json
@@ -1221,5 +1221,13 @@
},
"api_log": {
"close": "关闭"
+ },
+ "attachment_detail_2": {
+ "will_be_deleted_in": "此附件将在 {{time}} 后自动删除",
+ "will_be_deleted_soon": "该附件将很快被自动删除",
+ "deletion_reason": ",因为该附件未链接在笔记的内容中。为防止被删除,请将附件链接重新添加到内容中或将附件转换为笔记。",
+ "role_and_size": "角色: {{role}}, 大小: {{size}}",
+ "link_copied": "附件链接已复制到剪贴板。",
+ "unrecognized_role": "无法识别的附件角色 '{{role}}'。"
}
}
diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.json
index 8d9eaa5faf..425ea4a264 100644
--- a/src/public/translations/en/translation.json
+++ b/src/public/translations/en/translation.json
@@ -1222,5 +1222,13 @@
},
"api_log": {
"close": "Close"
+ },
+ "attachment_detail_2": {
+ "will_be_deleted_in": "This attachment will be automatically deleted in {time}}",
+ "will_be_deleted_soon": "This attachment will be automatically deleted soon",
+ "deletion_reason": ", because the attachment is not linked in the note's content. To prevent deletion, add the attachment link back into the content or convert the attachment into note.",
+ "role_and_size": "Role: {{role}}, Size: {{size}}",
+ "link_copied": "Attachment link copied to clipboard.",
+ "unrecognized_role": "Unrecognized attachment role '{{role}}'."
}
}