Skip to content

Build your personal knowledge base with Trilium Notes

add translation for backend_log.js and 5 advanced options

Nriverfcf4b5783869
diff --git a/src/public/app/widgets/type_widgets/content/backend_log.js b/src/public/app/widgets/type_widgets/content/backend_log.js
index 2799ff6b24..83e5e1d449 100644
--- a/src/public/app/widgets/type_widgets/content/backend_log.js
+++ b/src/public/app/widgets/type_widgets/content/backend_log.js
@@ -1,5 +1,6 @@
import NoteContextAwareWidget from "../../note_context_aware_widget.js";
import server from "../../../services/server.js";
+import { t } from "../../../services/i18n.js";
const TPL = `<div style="height: 100%; display: flex; flex-direction: column;">
<style>
@@ -13,7 +14,7 @@ const TPL = `<div style="height: 100%; display: flex; flex-direction: column;">
<textarea class="backend-log-textarea" readonly="readonly"></textarea>
<div style="display: flex; justify-content: space-around; margin-top: 10px;">
- <button class="refresh-backend-log-button btn btn-primary">Refresh</button>
+ <button class="refresh-backend-log-button btn btn-primary">${t("backend_log.refresh")}</button>
</div>
</div>`;
diff --git a/src/public/app/widgets/type_widgets/options/advanced/consistency_checks.js b/src/public/app/widgets/type_widgets/options/advanced/consistency_checks.js
index 617de4fcd0..1c4689c692 100644
--- a/src/public/app/widgets/type_widgets/options/advanced/consistency_checks.js
+++ b/src/public/app/widgets/type_widgets/options/advanced/consistency_checks.js
@@ -1,12 +1,13 @@
import OptionsWidget from "../options_widget.js";
import toastService from "../../../../services/toast.js";
import server from "../../../../services/server.js";
+import { t } from "../../../../services/i18n.js";
const TPL = `
<div class="options-section">
- <h4>Consistency Checks</h4>
+ <h4>${t("consistency_checks.title")}</h4>
- <button class="find-and-fix-consistency-issues-button btn">Find and fix consistency issues</button>
+ <button class="find-and-fix-consistency-issues-button btn">${t("consistency_checks.find_and_fix_button")}</button>
</div>`;
export default class ConsistencyChecksOptions extends OptionsWidget {
@@ -14,11 +15,11 @@ export default class ConsistencyChecksOptions extends OptionsWidget {
this.$widget = $(TPL);
this.$findAndFixConsistencyIssuesButton = this.$widget.find(".find-and-fix-consistency-issues-button");
this.$findAndFixConsistencyIssuesButton.on('click', async () => {
- toastService.showMessage("Finding and fixing consistency issues...");
+ toastService.showMessage(t("consistency_checks.finding_and_fixing_message"));
await server.post('database/find-and-fix-consistency-issues');
- toastService.showMessage("Consistency issues should be fixed.");
+ toastService.showMessage(t("consistency_checks.issues_fixed_message"));
});
}
}
diff --git a/src/public/app/widgets/type_widgets/options/advanced/database_anonymization.js b/src/public/app/widgets/type_widgets/options/advanced/database_anonymization.js
index 9bdcce843e..74632abc90 100644
--- a/src/public/app/widgets/type_widgets/options/advanced/database_anonymization.js
+++ b/src/public/app/widgets/type_widgets/options/advanced/database_anonymization.js
@@ -1,27 +1,27 @@
import OptionsWidget from "../options_widget.js";
import toastService from "../../../../services/toast.js";
import server from "../../../../services/server.js";
+import { t } from "../../../../services/i18n.js";
const TPL = `
<div class="options-section">
- <h4>Database Anonymization</h4>
+ <h4>${t("database_anonymization.title")}</h4>
- <h5>Full Anonymization</h5>
+ <h5>${t("database_anonymization.full_anonymization")}</h5>
- <p>This action will create a new copy of the database and anonymize it (remove all note content and leave only structure and some non-sensitive metadata)
- for sharing online for debugging purposes without fear of leaking your personal data.</p>
+ <p>${t("database_anonymization.full_anonymization_description")}</p>
- <button class="anonymize-full-button btn">Save fully anonymized database</button>
+ <button class="anonymize-full-button btn">${t("database_anonymization.save_fully_anonymized_database")}</button>
- <h5>Light Anonymization</h5>
+ <h5>${t("database_anonymization.light_anonymization")}</h5>
- <p>This action will create a new copy of the database and do a light anonymization on it — specifically only content of all notes will be removed, but titles and attributes will remain. Additionally, custom JS frontend/backend script notes and custom widgets will remain. This provides more context to debug the issues.</p>
+ <p>${t("database_anonymization.light_anonymization_description")}</p>
- <p>You can decide yourself if you want to provide a fully or lightly anonymized database. Even fully anonymized DB is very useful, however in some cases lightly anonymized database can speed up the process of bug identification and fixing.</p>
+ <p>${t("database_anonymization.choose_anonymization")}</p>
- <button class="anonymize-light-button btn">Save lightly anonymized database</button>
+ <button class="anonymize-light-button btn">${t("database_anonymization.save_lightly_anonymized_database")}</button>
- <h5>Existing anonymized databases</h5>
+ <h5>${t("database_anonymization.existing_anonymized_databases")}</h5>
<ul class="existing-anonymized-databases"></ul>
</div>`;
@@ -32,30 +32,30 @@ export default class DatabaseAnonymizationOptions extends OptionsWidget {
this.$anonymizeFullButton = this.$widget.find(".anonymize-full-button");
this.$anonymizeLightButton = this.$widget.find(".anonymize-light-button");
this.$anonymizeFullButton.on('click', async () => {
- toastService.showMessage("Creating fully anonymized database...");
+ toastService.showMessage(t("database_anonymization.creating_fully_anonymized_database"));
const resp = await server.post('database/anonymize/full');
if (!resp.success) {
- toastService.showError("Could not create anonymized database, check backend logs for details");
+ toastService.showError(t("database_anonymization.error_creating_anonymized_database"));
}
else {
- toastService.showMessage(`Created fully anonymized database in ${resp.anonymizedFilePath}`, 10000);
+ toastService.showMessage(t("database_anonymization.successfully_created_fully_anonymized_database", { anonymizedFilePath: resp.anonymizedFilePath }), 10000);
}
this.refresh();
});
this.$anonymizeLightButton.on('click', async () => {
- toastService.showMessage("Creating lightly anonymized database...");
+ toastService.showMessage(t("database_anonymization.creating_lightly_anonymized_database"));
const resp = await server.post('database/anonymize/light');
if (!resp.success) {
- toastService.showError("Could not create anonymized database, check backend logs for details");
+ toastService.showError(t("database_anonymization.error_creating_anonymized_database"));
}
else {
- toastService.showMessage(`Created lightly anonymized database in ${resp.anonymizedFilePath}`, 10000);
+ toastService.showMessage(t("database_anonymization.successfully_created_lightly_anonymized_database", { anonymizedFilePath: resp.anonymizedFilePath }), 10000);
}
this.refresh();
@@ -69,7 +69,7 @@ export default class DatabaseAnonymizationOptions extends OptionsWidget {
this.$existingAnonymizedDatabases.empty();
if (!anonymizedDatabases.length) {
- anonymizedDatabases = [{filePath: "no anonymized database yet"}];
+ anonymizedDatabases = [{filePath: t("database_anonymization.no_anonymized_database_yet")}];
}
for (const {filePath} of anonymizedDatabases) {
diff --git a/src/public/app/widgets/type_widgets/options/advanced/database_integrity_check.js b/src/public/app/widgets/type_widgets/options/advanced/database_integrity_check.js
index 16321a159f..cb906a17c4 100644
--- a/src/public/app/widgets/type_widgets/options/advanced/database_integrity_check.js
+++ b/src/public/app/widgets/type_widgets/options/advanced/database_integrity_check.js
@@ -1,14 +1,15 @@
import OptionsWidget from "../options_widget.js";
import toastService from "../../../../services/toast.js";
import server from "../../../../services/server.js";
+import { t } from "../../../../services/i18n.js";
const TPL = `
<div class="options-section">
- <h4>Database Integrity Check</h4>
+ <h4>${t("database_integrity_check.title")}</h4>
- <p>This will check that the database is not corrupted on the SQLite level. It might take some time, depending on the DB size.</p>
+ <p>${t("database_integrity_check.description")}</p>
- <button class="check-integrity-button btn">Check database integrity</button>
+ <button class="check-integrity-button btn">${t("database_integrity_check.check_button")}</button>
</div>`;
export default class DatabaseIntegrityCheckOptions extends OptionsWidget {
@@ -16,15 +17,15 @@ export default class DatabaseIntegrityCheckOptions extends OptionsWidget {
this.$widget = $(TPL);
this.$checkIntegrityButton = this.$widget.find(".check-integrity-button");
this.$checkIntegrityButton.on('click', async () => {
- toastService.showMessage("Checking database integrity...");
+ toastService.showMessage(t("database_integrity_check.checking_integrity"));
const {results} = await server.get('database/check-integrity');
if (results.length === 1 && results[0].integrity_check === "ok") {
- toastService.showMessage("Integrity check succeeded - no problems found.");
+ toastService.showMessage(t("database_integrity_check.integrity_check_succeeded"));
}
else {
- toastService.showMessage(`Integrity check failed: ${JSON.stringify(results, null, 2)}`, 15000);
+ toastService.showMessage(t("database_integrity_check.integrity_check_failed", { results: JSON.stringify(results, null, 2) }), 15000);
}
});
}
diff --git a/src/public/app/widgets/type_widgets/options/advanced/sync.js b/src/public/app/widgets/type_widgets/options/advanced/sync.js
index 457d7e34e7..e4bc32b5d3 100644
--- a/src/public/app/widgets/type_widgets/options/advanced/sync.js
+++ b/src/public/app/widgets/type_widgets/options/advanced/sync.js
@@ -1,13 +1,14 @@
import OptionsWidget from "../options_widget.js";
import server from "../../../../services/server.js";
import toastService from "../../../../services/toast.js";
+import { t } from "../../../../services/i18n.js";
const TPL = `
<div class="options-section">
- <h4>Sync</h4>
- <button class="force-full-sync-button btn">Force full sync</button>
+ <h4>${t("sync.title")}</h4>
+ <button class="force-full-sync-button btn">${t("sync.force_full_sync_button")}</button>
- <button class="fill-entity-changes-button btn">Fill entity changes records</button>
+ <button class="fill-entity-changes-button btn">${t("sync.fill_entity_changes_button")}</button>
</div>`;
export default class AdvancedSyncOptions extends OptionsWidget {
@@ -18,15 +19,15 @@ export default class AdvancedSyncOptions extends OptionsWidget {
this.$forceFullSyncButton.on('click', async () => {
await server.post('sync/force-full-sync');
- toastService.showMessage("Full sync triggered");
+ toastService.showMessage(t("sync.full_sync_triggered"));
});
this.$fillEntityChangesButton.on('click', async () => {
- toastService.showMessage("Filling entity changes rows...");
+ toastService.showMessage(t("sync.filling_entity_changes"));
await server.post('sync/fill-entity-changes');
- toastService.showMessage("Sync rows filled successfully");
+ toastService.showMessage(t("sync.sync_rows_filled_successfully"));
});
}
diff --git a/src/public/app/widgets/type_widgets/options/advanced/vacuum_database.js b/src/public/app/widgets/type_widgets/options/advanced/vacuum_database.js
index bdd8ed49cb..622e8ab1b9 100644
--- a/src/public/app/widgets/type_widgets/options/advanced/vacuum_database.js
+++ b/src/public/app/widgets/type_widgets/options/advanced/vacuum_database.js
@@ -1,14 +1,15 @@
import OptionsWidget from "../options_widget.js";
import toastService from "../../../../services/toast.js";
import server from "../../../../services/server.js";
+import { t } from "../../../../services/i18n.js";
const TPL = `
<div class="options-section">
- <h4>Vacuum Database</h4>
+ <h4>${t("vacuum_database.title")}</h4>
- <p>This will rebuild the database which will typically result in a smaller database file. No data will be actually changed.</p>
+ <p>${t("vacuum_database.description")}</p>
- <button class="vacuum-database-button btn">Vacuum database</button>
+ <button class="vacuum-database-button btn">${t("vacuum_database.button_text")}</button>
</div>`;
export default class VacuumDatabaseOptions extends OptionsWidget {
@@ -16,11 +17,11 @@ export default class VacuumDatabaseOptions extends OptionsWidget {
this.$widget = $(TPL);
this.$vacuumDatabaseButton = this.$widget.find(".vacuum-database-button");
this.$vacuumDatabaseButton.on('click', async () => {
- toastService.showMessage("Vacuuming database...");
+ toastService.showMessage(t("vacuum_database.vacuuming_database"));
await server.post('database/vacuum-database');
- toastService.showMessage("Database has been vacuumed");
+ toastService.showMessage(t("vacuum_database.database_vacuumed"));
});
}
}
diff --git a/src/public/translations/cn/translation.json b/src/public/translations/cn/translation.json
index 47882d3e70..f7d903689c 100644
--- a/src/public/translations/cn/translation.json
+++ b/src/public/translations/cn/translation.json
@@ -926,5 +926,54 @@
"create_label": "首先,请创建一个带有您要嵌入的 URL 地址的标签,例如 #webViewSrc=\"https://www.bing.com\"",
"disclaimer": "实验性功能免责声明",
"experimental_note": "网页视图是一种实验性的笔记类型,将来可能会被移除或大幅更改。网页视图只在桌面端有效。"
+ },
+ "backend_log": {
+ "refresh": "刷新"
+ },
+ "consistency_checks": {
+ "title": "检查一致性",
+ "find_and_fix_button": "查找并修复一致性问题",
+ "finding_and_fixing_message": "正在查找并修复一致性问题...",
+ "issues_fixed_message": "一致性问题应该已被修复。"
+ },
+ "database_anonymization": {
+ "title": "数据库匿名化",
+ "full_anonymization": "完全匿名化",
+ "full_anonymization_description": "此操作将创建一个新的数据库副本并进行匿名化处理(删除所有笔记内容,仅保留结构和一些非敏感元数据),用来分享到网上做调试而不用担心泄漏你的个人资料。",
+ "save_fully_anonymized_database": "保存完全匿名化的数据库",
+ "light_anonymization": "轻度匿名化",
+ "light_anonymization_description": "此操作将创建一个新的数据库副本,并对其进行轻度匿名化处理——仅删除所有笔记的内容,但保留标题和属性。此外,自定义JS前端/后端脚本笔记和自定义小部件将保留。这提供了更多上下文以调试问题。",
+ "choose_anonymization": "您可以自行决定是提供完全匿名化还是轻度匿名化的数据库。即使是完全匿名化的数据库也非常有用,但在某些情况下,轻度匿名化的数据库可以加快错误识别和修复的过程。",
+ "save_lightly_anonymized_database": "保存轻度匿名化的数据库",
+ "existing_anonymized_databases": "现有的匿名化数据库",
+ "creating_fully_anonymized_database": "正在创建完全匿名化的数据库...",
+ "creating_lightly_anonymized_database": "正在创建轻度匿名化的数据库...",
+ "error_creating_anonymized_database": "无法创建匿名化数据库,请检查后端日志以获取详细信息",
+ "successfully_created_fully_anonymized_database": "成功创建完全匿名化的数据库,路径为{{anonymizedFilePath}}",
+ "successfully_created_lightly_anonymized_database": "成功创建轻度匿名化的数据库,路径为{{anonymizedFilePath}}",
+ "no_anonymized_database_yet": "尚无匿名化数据库"
+ },
+ "database_integrity_check": {
+ "title": "数据库完整性检查",
+ "description": "检查SQLite数据库是否损坏。根据数据库的大小,可能会需要一些时间。",
+ "check_button": "检查数据库完整性",
+ "checking_integrity": "正在检查数据库完整性...",
+ "integrity_check_succeeded": "完整性检查成功 - 未发现问题。",
+ "integrity_check_failed": "完整性检查失败: {{results}}"
+ },
+ "sync": {
+ "title": "同步",
+ "force_full_sync_button": "强制全量同步",
+ "fill_entity_changes_button": "填充实体变更记录",
+ "full_sync_triggered": "全量同步已触发",
+ "filling_entity_changes": "正在填充实体变更行...",
+ "sync_rows_filled_successfully": "同步行填充成功"
+ },
+ "vacuum_database": {
+ "title": "数据库清理",
+ "description": "这会重建数据库,通常会减少占用空间,不会删除数据。",
+ "button_text": "清理数据库",
+ "vacuuming_database": "正在清理数据库...",
+ "database_vacuumed": "数据库已清理"
}
}
diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.json
index a79cbf843b..2154987077 100644
--- a/src/public/translations/en/translation.json
+++ b/src/public/translations/en/translation.json
@@ -927,5 +927,54 @@
"create_label": "To start, please create a label with a URL address you want to embed, e.g. #webViewSrc=\"https://www.google.com\"",
"disclaimer": "Disclaimer on the experimental status",
"experimental_note": "Web View is an experimental note type, and it might be removed or substantially changed in the future. Web View works also only in the desktop build."
+ },
+ "backend_log": {
+ "refresh": "Refresh"
+ },
+ "consistency_checks": {
+ "title": "Consistency Checks",
+ "find_and_fix_button": "Find and fix consistency issues",
+ "finding_and_fixing_message": "Finding and fixing consistency issues...",
+ "issues_fixed_message": "Consistency issues should be fixed."
+ },
+ "database_anonymization": {
+ "title": "Database Anonymization",
+ "full_anonymization": "Full Anonymization",
+ "full_anonymization_description": "This action will create a new copy of the database and anonymize it (remove all note content and leave only structure and some non-sensitive metadata) for sharing online for debugging purposes without fear of leaking your personal data.",
+ "save_fully_anonymized_database": "Save fully anonymized database",
+ "light_anonymization": "Light Anonymization",
+ "light_anonymization_description": "This action will create a new copy of the database and do a light anonymization on it — specifically only content of all notes will be removed, but titles and attributes will remain. Additionally, custom JS frontend/backend script notes and custom widgets will remain. This provides more context to debug the issues.",
+ "choose_anonymization": "You can decide yourself if you want to provide a fully or lightly anonymized database. Even fully anonymized DB is very useful, however in some cases lightly anonymized database can speed up the process of bug identification and fixing.",
+ "save_lightly_anonymized_database": "Save lightly anonymized database",
+ "existing_anonymized_databases": "Existing anonymized databases",
+ "creating_fully_anonymized_database": "Creating fully anonymized database...",
+ "creating_lightly_anonymized_database": "Creating lightly anonymized database...",
+ "error_creating_anonymized_database": "Could not create anonymized database, check backend logs for details",
+ "successfully_created_fully_anonymized_database": "Created fully anonymized database in {{anonymizedFilePath}}",
+ "successfully_created_lightly_anonymized_database": "Created lightly anonymized database in {{anonymizedFilePath}}",
+ "no_anonymized_database_yet": "no anonymized database yet"
+ },
+ "database_integrity_check": {
+ "title": "Database Integrity Check",
+ "description": "This will check that the database is not corrupted on the SQLite level. It might take some time, depending on the DB size.",
+ "check_button": "Check database integrity",
+ "checking_integrity": "Checking database integrity...",
+ "integrity_check_succeeded": "Integrity check succeeded - no problems found.",
+ "integrity_check_failed": "Integrity check failed: {{results}}"
+ },
+ "sync": {
+ "title": "Sync",
+ "force_full_sync_button": "Force full sync",
+ "fill_entity_changes_button": "Fill entity changes records",
+ "full_sync_triggered": "Full sync triggered",
+ "filling_entity_changes": "Filling entity changes rows...",
+ "sync_rows_filled_successfully": "Sync rows filled successfully"
+ },
+ "vacuum_database": {
+ "title": "Vacuum Database",
+ "description": "This will rebuild the database which will typically result in a smaller database file. No data will be actually changed.",
+ "button_text": "Vacuum database",
+ "vacuuming_database": "Vacuuming database...",
+ "database_vacuumed": "Database has been vacuumed"
}
}