From 584ba246e3c5fc418b5c18e75c1ddd72bd59ebce Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 27 Jul 2024 12:10:59 +0300 Subject: [PATCH] client: Use translations for critical error --- src/public/app/desktop.js | 5 ++-- src/public/translations/en/translation.json | 26 +++++++++++++-------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/public/app/desktop.js b/src/public/app/desktop.js index ec27c9679..669f9d355 100644 --- a/src/public/app/desktop.js +++ b/src/public/app/desktop.js @@ -8,15 +8,16 @@ import macInit from './services/mac_init.js'; import electronContextMenu from "./menus/electron_context_menu.js"; import DesktopLayout from "./layouts/desktop_layout.js"; import glob from "./services/glob.js"; +import { t } from "./services/i18n.js"; bundleService.getWidgetBundlesByParent().then(widgetBundles => { appContext.setLayout(new DesktopLayout(widgetBundles)); appContext.start() .catch((e) => { toastService.showPersistent({ - title: "Critical error", + title: t("toast.critical-error.title"), icon: "alert", - message: `A critical error has occurred which prevents the client application from starting:\n\n${e.message}\n\nThis is most likely caused by a script failing in an unexpected way. Try starting the application in safe mode and addressing the issue.`, + message: t("toast.critical-error.message", { message: e.message }), }); console.error("Critical error occured", e); }); diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.json index 9917fb25d..7983a3c68 100644 --- a/src/public/translations/en/translation.json +++ b/src/public/translations/en/translation.json @@ -1,12 +1,18 @@ { - "about": { - "title": "About TriliumNext Notes", - "homepage": "Homepage:", - "app_version": "App version:", - "db_version": "DB version:", - "sync_version": "Sync version:", - "build_date": "Build date:", - "build_revision": "Build revision:", - "data_directory": "Data directory:" + "about": { + "title": "About TriliumNext Notes", + "homepage": "Homepage:", + "app_version": "App version:", + "db_version": "DB version:", + "sync_version": "Sync version:", + "build_date": "Build date:", + "build_revision": "Build revision:", + "data_directory": "Data directory:" + }, + "toast": { + "critical-error": { + "title": "Critical error", + "message": "A critical error has occurred which prevents the client application from starting:\n\n{{message}}\n\nThis is most likely caused by a script failing in an unexpected way. Try starting the application in safe mode and addressing the issue." } -} \ No newline at end of file + } +}