Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

feat: Hardcoded error strings internationalized

Tonhoa9b60ce7cba1
diff --git a/src/routes/convert/+page.svelte b/src/routes/convert/+page.svelte
index 1fbda0f8..8da5dadb 100644
--- a/src/routes/convert/+page.svelte
+++ b/src/routes/convert/+page.svelte
@@ -69,7 +69,7 @@
const info: ProbeInfo = await invoke("probe_file", { path });
updateFileProbe(id, info);
} catch (e: any) {
- showToast("error", typeof e === "string" ? e : e.message ?? "Probe failed");
+ showToast("error", typeof e === "string" ? e : e.message ?? $t("convert.probe_failed"));
}
}
@@ -129,7 +129,7 @@
// Wait for this conversion to complete before starting next
await waitForConversion(conversionId);
} catch (e: any) {
- showToast("error", typeof e === "string" ? e : e.message ?? "Conversion failed");
+ showToast("error", typeof e === "string" ? e : e.message ?? $t("convert.conversion_failed"));
}
}
diff --git a/src/routes/downloads/+page.svelte b/src/routes/downloads/+page.svelte
index e78376ce..2778ad2f 100644
--- a/src/routes/downloads/+page.svelte
+++ b/src/routes/downloads/+page.svelte
@@ -52,7 +52,7 @@
try {
await invoke("cancel_course_download", { courseId });
} catch (e: any) {
- const msg = typeof e === "string" ? e : e.message ?? "Error";
+ const msg = typeof e === "string" ? e : e.message ?? $t("common.error");
showToast("error", msg);
}
}
@@ -61,7 +61,7 @@
try {
await invoke("cancel_generic_download", { downloadId: id });
} catch (e: any) {
- const msg = typeof e === "string" ? e : e.message ?? "Error";
+ const msg = typeof e === "string" ? e : e.message ?? $t("common.error");
showToast("error", msg);
}
}
@@ -70,7 +70,7 @@
try {
await invoke("pause_download", { downloadId: id });
} catch (e: any) {
- const msg = typeof e === "string" ? e : e.message ?? "Error";
+ const msg = typeof e === "string" ? e : e.message ?? $t("common.error");
showToast("error", msg);
}
}
@@ -79,7 +79,7 @@
try {
await invoke("resume_download", { downloadId: id });
} catch (e: any) {
- const msg = typeof e === "string" ? e : e.message ?? "Error";
+ const msg = typeof e === "string" ? e : e.message ?? $t("common.error");
showToast("error", msg);
}
}
@@ -88,7 +88,7 @@
try {
await invoke("retry_download", { downloadId: id });
} catch (e: any) {
- const msg = typeof e === "string" ? e : e.message ?? "Error";
+ const msg = typeof e === "string" ? e : e.message ?? $t("common.error");
showToast("error", msg);
}
}
@@ -97,7 +97,7 @@
try {
await invoke("remove_download", { downloadId: id });
} catch (e: any) {
- const msg = typeof e === "string" ? e : e.message ?? "Error";
+ const msg = typeof e === "string" ? e : e.message ?? $t("common.error");
showToast("error", msg);
}
}
@@ -106,7 +106,7 @@
try {
await invoke("clear_finished_downloads");
} catch (e: any) {
- const msg = typeof e === "string" ? e : e.message ?? "Error";
+ const msg = typeof e === "string" ? e : e.message ?? $t("common.error");
showToast("error", msg);
}
}
diff --git a/src/routes/hotmart/+page.svelte b/src/routes/hotmart/+page.svelte
index 6fe97387..c16d41df 100644
--- a/src/routes/hotmart/+page.svelte
+++ b/src/routes/hotmart/+page.svelte
@@ -176,7 +176,7 @@
});
showToast("info", $t("toast.download_preparing"));
} catch (e: any) {
- const msg = typeof e === "string" ? e : e.message ?? "Error";
+ const msg = typeof e === "string" ? e : e.message ?? $t("common.error");
showToast("error", msg);
}
}
diff --git a/src/routes/telegram/+page.svelte b/src/routes/telegram/+page.svelte
index 9faf82ef..98c91581 100644
--- a/src/routes/telegram/+page.svelte
+++ b/src/routes/telegram/+page.svelte
@@ -378,7 +378,7 @@
}
hasMore = items.length >= 100;
} catch (e: any) {
- const msg = typeof e === "string" ? e : e.message ?? "Error";
+ const msg = typeof e === "string" ? e : e.message ?? $t("common.error");
showToast("error", msg);
} finally {
loadingMore = false;
@@ -485,7 +485,7 @@
});
showToast("info", $t("toast.download_started", { name: item.file_name }));
} catch (e: any) {
- const msg = typeof e === "string" ? e : e.message ?? "Error";
+ const msg = typeof e === "string" ? e : e.message ?? $t("common.error");
showToast("error", msg);
downloadingIds = new Set([...downloadingIds].filter((id) => id !== item.message_id));
}
@@ -519,7 +519,7 @@
});
activeBatchId = batchId;
} catch (e: any) {
- const msg = typeof e === "string" ? e : e.message ?? "Error";
+ const msg = typeof e === "string" ? e : e.message ?? $t("common.error");
showToast("error", msg);
batchStatus = new Map();
batchTotal = 0;
diff --git a/src/routes/udemy/+page.svelte b/src/routes/udemy/+page.svelte
index 5c58cf65..f2d3b738 100644
--- a/src/routes/udemy/+page.svelte
+++ b/src/routes/udemy/+page.svelte
@@ -214,7 +214,7 @@
});
showToast("info", $t("toast.download_preparing"));
} catch (e: any) {
- const msg = typeof e === "string" ? e : e.message ?? "Error";
+ const msg = typeof e === "string" ? e : e.message ?? $t("common.error");
showToast("error", msg);
}
}