Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.
Rust downloadmanagerguihacktoberfesthomebrewlightweightlinuxlinux-distributionlocal-firstmacosmacos-packagemedia-toolboxopen-sourcerustsveltetauritrendingtrending-repositorieswindowswindows-desktopytdlp
feat: add logging functionality and translations for log actions in multiple languages
Tonho1edd0ae20d5a
diff --git a/src/lib/error-translate.ts b/src/lib/error-translate.tsindex d57dfdae..d1c2a909 100644--- a/src/lib/error-translate.ts+++ b/src/lib/error-translate.ts@@ -40,11 +40,23 @@ const BACKEND_ERROR_MAP: Record<string, string> = {*/export function translateBackendError(msg: string,- t: (key: string) => string+ t: (key: string) => string,+ tWithValues?: (key: string, opts: { values: Record<string, string | number> }) => string): string {if (!msg) return t("common.unknown_error");- // Strip prefix added in downloads.rs ("Failed to get formats: ...")+ if (msg.startsWith("PathTooLong|")) {+ const parts = msg.split("|");+ const limit = Number(parts[1] ?? 0);+ const current = Number(parts[2] ?? 0);+ if (tWithValues) {+ return tWithValues("errors.path_too_long", {+ values: { limit, current },+ });+ }+ return t("errors.path_too_long");+ }+const stripped = msg.replace(/^Failed to get formats:\s*/, "").trim();const key = BACKEND_ERROR_MAP[stripped];diff --git a/src/lib/i18n/el.json b/src/lib/i18n/el.jsonindex 111212a6..0761d6d0 100644--- a/src/lib/i18n/el.json+++ b/src/lib/i18n/el.json@@ -43,7 +43,15 @@"open_folder": "Εμφάνιση στο φάκελο","stop": "Διακοπή","confirm_remove": "Αφαίρεση αυτής της λήψης;",- "stats_line": "{{count}} λήψεις · {{size}} αποθηκευμένα"+ "stats_line": "{{count}} λήψεις · {{size}} αποθηκευμένα",+ "log": {+ "show": "Εμφάνιση αρχείου καταγραφής",+ "hide": "Απόκρυψη αρχείου καταγραφής",+ "copy": "Αντιγραφή",+ "copied": "Το αρχείο καταγραφής αντιγράφηκε",+ "copy_failed": "Αποτυχία αντιγραφής αρχείου καταγραφής",+ "empty": "Δεν υπάρχουν ακόμη γραμμές"+ }},"toast": {"download_preparing": "Προετοιμασία λήψης...",diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.jsonindex 8d9e4e80..705d80f2 100644--- a/src/lib/i18n/en.json+++ b/src/lib/i18n/en.json@@ -43,7 +43,15 @@"open_folder": "Show in folder","stop": "Stop","confirm_remove": "Remove this download?",- "stats_line": "{{count}} downloads · {{size}} saved"+ "stats_line": "{{count}} downloads · {{size}} saved",+ "log": {+ "show": "Show log",+ "hide": "Hide log",+ "copy": "Copy",+ "copied": "Log copied to clipboard",+ "copy_failed": "Couldn't copy log",+ "empty": "No log lines yet"+ }},"toast": {"download_preparing": "Preparing download...",diff --git a/src/lib/i18n/fr.json b/src/lib/i18n/fr.jsonindex 23dc02d7..8611644a 100644--- a/src/lib/i18n/fr.json+++ b/src/lib/i18n/fr.json@@ -43,7 +43,15 @@"open_folder": "Afficher dans le dossier","stop": "Arrêter","confirm_remove": "Supprimer ce téléchargement ?",- "stats_line": "{{count}} téléchargements · {{size}} enregistrés"+ "stats_line": "{{count}} téléchargements · {{size}} enregistrés",+ "log": {+ "show": "Afficher le journal",+ "hide": "Masquer le journal",+ "copy": "Copier",+ "copied": "Journal copié",+ "copy_failed": "Impossible de copier le journal",+ "empty": "Aucune ligne dans le journal pour l'instant"+ }},"toast": {"download_preparing": "Préparation du téléchargement...",diff --git a/src/lib/i18n/it.json b/src/lib/i18n/it.jsonindex a971a967..b9024298 100644--- a/src/lib/i18n/it.json+++ b/src/lib/i18n/it.json@@ -43,7 +43,15 @@"open_folder": "Mostra nella cartella","stop": "Ferma","confirm_remove": "Rimuovere questo download?",- "stats_line": "{{count}} download · {{size}} salvati"+ "stats_line": "{{count}} download · {{size}} salvati",+ "log": {+ "show": "Mostra log",+ "hide": "Nascondi log",+ "copy": "Copia",+ "copied": "Log copiato",+ "copy_failed": "Impossibile copiare il log",+ "empty": "Nessuna riga di log ancora"+ }},"toast": {"download_preparing": "Preparazione download...",diff --git a/src/lib/i18n/ja.json b/src/lib/i18n/ja.jsonindex 04700979..288d3a64 100644--- a/src/lib/i18n/ja.json+++ b/src/lib/i18n/ja.json@@ -43,7 +43,15 @@"open_folder": "フォルダーで表示","stop": "停止","confirm_remove": "このダウンロードを削除しますか?",- "stats_line": "{{count}} 件のダウンロード · {{size}} 保存済み"+ "stats_line": "{{count}} 件のダウンロード · {{size}} 保存済み",+ "log": {+ "show": "ログを表示",+ "hide": "ログを非表示",+ "copy": "コピー",+ "copied": "ログをコピーしました",+ "copy_failed": "ログをコピーできませんでした",+ "empty": "まだログがありません"+ }},"toast": {"download_preparing": "ダウンロードを準備中...",diff --git a/src/lib/i18n/keys.ts b/src/lib/i18n/keys.tsindex 766e0bc6..8e54e6c5 100644--- a/src/lib/i18n/keys.ts+++ b/src/lib/i18n/keys.ts@@ -158,6 +158,12 @@ export type TranslationKeys =| 'downloads.clear_finished'| 'downloads.confirm_remove'| 'downloads.empty'+ | 'downloads.log.copied'+ | 'downloads.log.copy'+ | 'downloads.log.copy_failed'+ | 'downloads.log.empty'+ | 'downloads.log.hide'+ | 'downloads.log.show'| 'downloads.module_progress'| 'downloads.open_folder'| 'downloads.page_progress'diff --git a/src/lib/i18n/pt.json b/src/lib/i18n/pt.jsonindex 406ee8a0..a982d404 100644--- a/src/lib/i18n/pt.json+++ b/src/lib/i18n/pt.json@@ -43,7 +43,15 @@"open_folder": "Abrir pasta","stop": "Parar","confirm_remove": "Remover este download?",- "stats_line": "{{count}} downloads · {{size}} salvos"+ "stats_line": "{{count}} downloads · {{size}} salvos",+ "log": {+ "show": "Ver log",+ "hide": "Ocultar log",+ "copy": "Copiar",+ "copied": "Log copiado",+ "copy_failed": "Não foi possível copiar o log",+ "empty": "Nenhuma linha no log ainda"+ }},"toast": {"download_preparing": "Preparando download...",diff --git a/src/lib/i18n/zh-TW.json b/src/lib/i18n/zh-TW.jsonindex 4438eddc..93340040 100644--- a/src/lib/i18n/zh-TW.json+++ b/src/lib/i18n/zh-TW.json@@ -41,7 +41,15 @@"clear_finished": "清除已完成項目","show_more": "顯示另外 {{count}} 項","open_folder": "在資料夾中顯示",- "stop": "停止"+ "stop": "停止",+ "log": {+ "show": "顯示日誌",+ "hide": "隱藏日誌",+ "copy": "複製",+ "copied": "日誌已複製",+ "copy_failed": "無法複製日誌",+ "empty": "尚無日誌"+ }},"toast": {"download_preparing": "正在準備下載...",diff --git a/src/lib/i18n/zh.json b/src/lib/i18n/zh.jsonindex 2d844afb..c4909fad 100644--- a/src/lib/i18n/zh.json+++ b/src/lib/i18n/zh.json@@ -43,7 +43,15 @@"open_folder": "在文件夹中显示","stop": "停止","confirm_remove": "移除此下载?",- "stats_line": "{{count}} 次下载 · 已保存 {{size}}"+ "stats_line": "{{count}} 次下载 · 已保存 {{size}}",+ "log": {+ "show": "显示日志",+ "hide": "隐藏日志",+ "copy": "复制",+ "copied": "日志已复制",+ "copy_failed": "无法复制日志",+ "empty": "暂无日志"+ }},"toast": {"download_preparing": "正在准备下载...",@@ -310,7 +318,16 @@"terms": "条款","project": "项目","roadmap": "路线图",- "changelog": "更新日志"+ "changelog": "更新日志",+ "debug": "调试信息"+ },+ "debug": {+ "title": "调试信息",+ "description": "用于粘贴到错误报告中的环境详情。不包含任何敏感信息。",+ "copy_button": "复制到剪贴板",+ "copied_short": "已复制",+ "copied": "调试信息已复制到剪贴板",+ "copy_failed": "无法复制到剪贴板"},"description": "你的媒体下载器。开源且免费。","terms_title": "使用条款",@@ -464,7 +481,8 @@"ffmpeg_missing": "未找到 FFmpeg — 请在设置中安装","unsupported_url": "不支持的 URL — 请检查链接","page_access_failed": "无法访问该页面 — 请检查链接和连接",- "no_formats": "此链接未找到视频格式"+ "no_formats": "此链接未找到视频格式",+ "path_too_long": "下载文件夹路径过长 ({{current}}/{{limit}} 字符)。请选择更短的文件夹。"},"debug": {"title": "活动日志",