mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 22:25:24 +00:00
fix: translate hardcoded toasts and drop em dashes from ui text
This commit is contained in:
1 parent
3c66931245
commit
1b342322dc
17 files changed
+89
-52
No files matched your search
@@ -12,7 +12,7 @@ export class TransferStalledError extends Error {
|
||||
constructor(byteOffset?: number, segmentIndex?: number) {
|
||||
const pos = byteOffset !== undefined ? ` at byte offset ${byteOffset}` : "";
|
||||
const seg = segmentIndex !== undefined ? ` (segment ${segmentIndex})` : "";
|
||||
super(`Transfer stalled — no data moved for 45 seconds${pos}${seg}`);
|
||||
super(`Transfer stalled: no data moved for 45 seconds${pos}${seg}`);
|
||||
this.name = "TransferStalledError";
|
||||
this.byteOffset = byteOffset;
|
||||
this.segmentIndex = segmentIndex;
|
||||
|
||||
@@ -1345,7 +1345,12 @@ function FileManagerContent({
|
||||
Math.round((p.bytesSent / p.totalBytes) * 100),
|
||||
);
|
||||
toast.loading(
|
||||
`Uploading ${file.name} — ${percent}% (chunk ${p.chunkIndex + 1}/${p.totalChunks})`,
|
||||
t("fileManager.uploadingChunk", {
|
||||
name: file.name,
|
||||
percent,
|
||||
chunk: p.chunkIndex + 1,
|
||||
total: p.totalChunks,
|
||||
}),
|
||||
{ id: progressToast, duration: Infinity, cancel },
|
||||
);
|
||||
};
|
||||
|
||||
@@ -216,9 +216,12 @@ export function FileWindow({
|
||||
};
|
||||
const errorData = err?.response?.data;
|
||||
if (errorData?.tooLarge) {
|
||||
toast.error(`File too large: ${errorData.error}`, {
|
||||
duration: 10000,
|
||||
});
|
||||
toast.error(
|
||||
t("fileManager.fileTooLarge", { error: errorData.error }),
|
||||
{
|
||||
duration: 10000,
|
||||
},
|
||||
);
|
||||
} else if (
|
||||
err.message?.includes("connection") ||
|
||||
err.message?.includes("established")
|
||||
|
||||
@@ -102,7 +102,7 @@ function formatByteSize(bytes: number): string {
|
||||
function formatTruncatedDestination(hostLabel: string, path: string): string {
|
||||
const normalized = path.replace(/\\/g, "/").replace(/\/+$/, "") || "/";
|
||||
if (normalized === "/") {
|
||||
return `${hostLabel} — /`;
|
||||
return `${hostLabel}: /`;
|
||||
}
|
||||
|
||||
const segments = normalized.split("/").filter(Boolean);
|
||||
@@ -111,7 +111,7 @@ function formatTruncatedDestination(hostLabel: string, path: string): string {
|
||||
? `/${segments.join("/")}`
|
||||
: `.../${segments.slice(-2).join("/")}`;
|
||||
|
||||
return `${hostLabel} — ${pathPart}`;
|
||||
return `${hostLabel}: ${pathPart}`;
|
||||
}
|
||||
|
||||
function longestCommonPrefix(strings: string[]): string {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useState, useCallback } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { useTranslation } from "@termix/plugin-sdk/frontend";
|
||||
import { downloadSSHFile } from "../api/ssh-file-operations-api";
|
||||
import type { FileItem, SSHHost } from "../host-types";
|
||||
|
||||
@@ -22,6 +23,7 @@ interface DragToDesktopOptions {
|
||||
}
|
||||
|
||||
export function useDragToDesktop({ sshSessionId }: UseDragToDesktopProps) {
|
||||
const { t } = useTranslation();
|
||||
const [state, setState] = useState<DragToDesktopState>({
|
||||
isDragging: false,
|
||||
isDownloading: false,
|
||||
@@ -98,7 +100,7 @@ export function useDragToDesktop({ sshSessionId }: UseDragToDesktopProps) {
|
||||
setState((prev) => ({ ...prev, progress: 100 }));
|
||||
|
||||
if (enableToast) {
|
||||
toast.success(`Dragging ${file.name} to desktop`);
|
||||
toast.success(t("fileManager.dragToDesktop", { name: file.name }));
|
||||
}
|
||||
|
||||
onSuccess?.();
|
||||
@@ -128,7 +130,9 @@ export function useDragToDesktop({ sshSessionId }: UseDragToDesktopProps) {
|
||||
}));
|
||||
|
||||
if (enableToast) {
|
||||
toast.error(`Drag failed: ${errorMessage}`);
|
||||
toast.error(
|
||||
t("fileManager.dragFailedDetail", { error: errorMessage }),
|
||||
);
|
||||
}
|
||||
|
||||
onError?.(errorMessage);
|
||||
@@ -209,7 +213,9 @@ export function useDragToDesktop({ sshSessionId }: UseDragToDesktopProps) {
|
||||
setState((prev) => ({ ...prev, progress: 100 }));
|
||||
|
||||
if (enableToast) {
|
||||
toast.success(`Dragging ${fileList.length} files to desktop`);
|
||||
toast.success(
|
||||
t("fileManager.dragFilesToDesktop", { count: fileList.length }),
|
||||
);
|
||||
}
|
||||
|
||||
onSuccess?.();
|
||||
@@ -238,7 +244,9 @@ export function useDragToDesktop({ sshSessionId }: UseDragToDesktopProps) {
|
||||
}));
|
||||
|
||||
if (enableToast) {
|
||||
toast.error(`Batch drag failed: ${errorMessage}`);
|
||||
toast.error(
|
||||
t("fileManager.dragFailedDetail", { error: errorMessage }),
|
||||
);
|
||||
}
|
||||
|
||||
onError?.(errorMessage);
|
||||
@@ -268,7 +276,7 @@ export function useDragToDesktop({ sshSessionId }: UseDragToDesktopProps) {
|
||||
}
|
||||
|
||||
if (enableToast) {
|
||||
toast.info("Folder drag functionality is under development...");
|
||||
toast.info(t("fileManager.folderDragUnsupported"));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable react-hooks/exhaustive-deps */
|
||||
import { useState, useCallback, useRef } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { useTranslation } from "@termix/plugin-sdk/frontend";
|
||||
import { downloadSSHFile } from "../api/ssh-file-operations-api";
|
||||
import type { FileItem, SSHHost } from "../host-types";
|
||||
|
||||
@@ -23,6 +24,7 @@ interface DragToSystemOptions {
|
||||
}
|
||||
|
||||
export function useDragToSystemDesktop({ sshSessionId }: UseDragToSystemProps) {
|
||||
const { t } = useTranslation();
|
||||
const [state, setState] = useState<DragToSystemState>({
|
||||
isDragging: false,
|
||||
isDownloading: false,
|
||||
@@ -250,7 +252,9 @@ export function useDragToSystemDesktop({ sshSessionId }: UseDragToSystemProps) {
|
||||
}));
|
||||
|
||||
if (enableToast) {
|
||||
toast.error(`Save failed: ${errorMessage}`);
|
||||
toast.error(
|
||||
t("fileManager.saveToDesktopFailed", { error: errorMessage }),
|
||||
);
|
||||
}
|
||||
|
||||
onError?.(errorMessage);
|
||||
|
||||
Reference in new issue
Block a user