add translation for ribbon widgets: file_properties.js

This commit is contained in:
Nriver 2024-08-05 10:32:48 +08:00
parent 4270ab416e
commit c2a8f4f4a3
3 changed files with 38 additions and 14 deletions

View File

@ -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 = `
<div class="file-properties-widget">
@ -27,26 +28,26 @@ const TPL = `
<table class="file-table">
<tr>
<th>Note ID:</th>
<th>${t("file_properties.note_id")}:</th>
<td class="file-note-id"></td>
<th>Original file name:</th>
<th>${t("file_properties.original_file_name")}:</th>
<td class="file-filename"></td>
</tr>
<tr>
<th>File type:</th>
<th>${t("file_properties.file_type")}:</th>
<td class="file-filetype"></td>
<th>File size:</th>
<th>${t("file_properties.file_size")}:</th>
<td class="file-filesize"></td>
</tr>
<tr>
<td colspan="4">
<div class="file-buttons">
<button class="file-download btn btn-sm btn-primary" type="button">Download</button>
<button class="file-download btn btn-sm btn-primary" type="button">${t("file_properties.download")}</button>
&nbsp;
<button class="file-open btn btn-sm btn-primary" type="button">Open</button>
<button class="file-open btn btn-sm btn-primary" type="button">${t("file_properties.open")}</button>
&nbsp;
<button class="file-upload-new-revision btn btn-sm btn-primary">Upload new revision</button>
<button class="file-upload-new-revision btn btn-sm btn-primary">${t("file_properties.upload_new_revision")}</button>
<input type="file" class="file-upload-new-revision-input" style="display: none">
</div>
@ -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());
}
}

View File

@ -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": "文件"
}
}

View File

@ -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"
}
}