mirror of
https://github.com/cloudreve/frontend.git
synced 2025-12-26 04:02:47 +00:00
i18n: task queue
This commit is contained in:
parent
0238e065f3
commit
1522bcc954
|
|
@ -400,6 +400,25 @@
|
|||
"createdAt": "Created at",
|
||||
"action": "Action",
|
||||
"listEmpty": "No records.",
|
||||
"createNewAccount": "Create new account"
|
||||
"createNewAccount": "Create new account",
|
||||
"taskType": "Task type",
|
||||
"taskStatus": "Status",
|
||||
"lastProgress": "Last progress",
|
||||
"errorDetails": "Error details",
|
||||
"queueing": "Queueing",
|
||||
"processing": "Processing",
|
||||
"failed": "Failed",
|
||||
"canceled": "Canceled",
|
||||
"finished": "Finished",
|
||||
"fileTransfer": "File transfer",
|
||||
"importFiles": "Import external files",
|
||||
"transferProgress": "{{num}} files done",
|
||||
"waiting": "Pending",
|
||||
"compressing": "Compressing",
|
||||
"decompressing": "Decompressing",
|
||||
"downloading": "Downloading",
|
||||
"transferring": "Transferring",
|
||||
"indexing": "Indexing",
|
||||
"listing": "Inserting"
|
||||
}
|
||||
}
|
||||
|
|
@ -390,6 +390,25 @@
|
|||
"createdAt": "创建日期",
|
||||
"action": "操作",
|
||||
"listEmpty": "没有记录",
|
||||
"createNewAccount": "创建新账号"
|
||||
"createNewAccount": "创建新账号",
|
||||
"taskType": "任务类型",
|
||||
"taskStatus": "状态",
|
||||
"lastProgress": "最后进度",
|
||||
"errorDetails": "错误信息",
|
||||
"queueing": "排队中",
|
||||
"processing": "处理中",
|
||||
"failed": "失败",
|
||||
"canceled": "取消",
|
||||
"finished": "已完成",
|
||||
"fileTransfer": "文件中转",
|
||||
"importFiles": "导入外部目录",
|
||||
"transferProgress": "已完成 {{num}} 个文件",
|
||||
"waiting": "等待中",
|
||||
"compressing": "压缩中",
|
||||
"decompressing": "解压缩中",
|
||||
"downloading": "下载中",
|
||||
"transferring": "转存中",
|
||||
"indexing": "索引中",
|
||||
"listing": "插入中"
|
||||
}
|
||||
}
|
||||
|
|
@ -34,6 +34,7 @@ import { hex2bin, sizeToString } from "../../utils";
|
|||
import TypeIcon from "../FileManager/TypeIcon";
|
||||
import SelectFileDialog from "../Modals/SelectFile";
|
||||
import { useHistory } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
const ExpansionPanel = withStyles({
|
||||
root: {
|
||||
maxWidth: "100%",
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import Pagination from "@material-ui/lab/Pagination";
|
|||
import { formatLocalTime } from "../../utils/datetime";
|
||||
import { toggleSnackbar } from "../../redux/explorer";
|
||||
import Nothing from "../Placeholder/Nothing";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
layout: {
|
||||
|
|
@ -49,6 +50,7 @@ const useStyles = makeStyles((theme) => ({
|
|||
}));
|
||||
|
||||
export default function Tasks() {
|
||||
const { t } = useTranslation();
|
||||
const [tasks, setTasks] = useState([]);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [page, setPage] = useState(1);
|
||||
|
|
@ -84,7 +86,7 @@ export default function Tasks() {
|
|||
const res = JSON.parse(error);
|
||||
return `${res.msg}: ${res.error}`;
|
||||
} catch (e) {
|
||||
return "未知";
|
||||
return t("uploader.unknownStatus");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -93,23 +95,27 @@ export default function Tasks() {
|
|||
return (
|
||||
<div className={classes.layout}>
|
||||
<Typography color="textSecondary" variant="h4">
|
||||
任务队列
|
||||
{t("navbar.taskQueue")}
|
||||
</Typography>
|
||||
<Paper elevation={3} className={classes.content}>
|
||||
<Table className={classes.table} aria-label="simple table">
|
||||
<TableHead>
|
||||
<TableRow>
|
||||
<TableCell nowrap="nowrap">创建于</TableCell>
|
||||
<TableCell nowrap="nowrap" align="right">
|
||||
任务类型
|
||||
<TableCell nowrap="nowrap">
|
||||
{t("setting.createdAt")}
|
||||
</TableCell>
|
||||
<TableCell nowrap="nowrap" align="right">
|
||||
状态
|
||||
{t("setting.taskType")}
|
||||
</TableCell>
|
||||
<TableCell nowrap="nowrap" align="right">
|
||||
最后进度
|
||||
{t("setting.taskStatus")}
|
||||
</TableCell>
|
||||
<TableCell nowrap="nowrap" align="right">
|
||||
{t("setting.lastProgress")}
|
||||
</TableCell>
|
||||
<TableCell nowrap="nowrap">
|
||||
{t("setting.errorDetails")}
|
||||
</TableCell>
|
||||
<TableCell nowrap="nowrap">错误信息</TableCell>
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
|
|
@ -138,7 +144,9 @@ export default function Tasks() {
|
|||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
{tasks.length === 0 && <Nothing primary={"没有记录"} />}
|
||||
{tasks.length === 0 && (
|
||||
<Nothing primary={t("setting.listEmpty")} />
|
||||
)}
|
||||
<div className={classes.footer}>
|
||||
<Pagination
|
||||
count={Math.ceil(total / 10)}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import i18next from "./i18n";
|
||||
|
||||
export const imgPreviewSuffix = [
|
||||
"bmp",
|
||||
"png",
|
||||
|
|
@ -17,7 +19,7 @@ export const msDocPreviewSuffix = [
|
|||
"xls",
|
||||
];
|
||||
export const subtitleSuffix = ["ass", "srt", "vrr"];
|
||||
export const audioPreviewSuffix = ["mp3", "ogg", "wav", "flac","m4a"];
|
||||
export const audioPreviewSuffix = ["mp3", "ogg", "wav", "flac", "m4a"];
|
||||
export const videoPreviewSuffix = ["mp4", "mkv", "webm", "avi", "m3u8", "mov"];
|
||||
export const pdfPreviewSuffix = ["pdf"];
|
||||
export const editSuffix = ["md", "txt"];
|
||||
|
|
@ -116,29 +118,42 @@ export const encodingRequired = (name: any) => {
|
|||
return suffix === "zip";
|
||||
};
|
||||
|
||||
const taskStatus = ["排队中", "处理中", "失败", "取消", "已完成"];
|
||||
const taskType = ["压缩", "解压缩", "文件中转", "导入外部目录"];
|
||||
const taskStatus = [
|
||||
"setting.queueing",
|
||||
"setting.processing",
|
||||
"setting.failed",
|
||||
"setting.canceled",
|
||||
"setting.finished",
|
||||
];
|
||||
const taskType = [
|
||||
"fileManager.compress",
|
||||
"fileManager.decompress",
|
||||
"setting.fileTransfer",
|
||||
"setting.importFiles",
|
||||
];
|
||||
const taskProgress = [
|
||||
"等待中",
|
||||
"压缩中",
|
||||
"解压缩中",
|
||||
"下载中",
|
||||
"转存中",
|
||||
"索引中",
|
||||
"插入中",
|
||||
"setting.waiting",
|
||||
"setting.compressing",
|
||||
"setting.decompressing",
|
||||
"setting.downloading",
|
||||
"setting.transferring",
|
||||
"setting.indexing",
|
||||
"setting.listing",
|
||||
];
|
||||
|
||||
export const getTaskStatus = (status: any) => {
|
||||
return taskStatus[status];
|
||||
return i18next.t(taskStatus[status]);
|
||||
};
|
||||
|
||||
export const getTaskType = (status: any) => {
|
||||
return taskType[status];
|
||||
return i18next.t(taskType[status]);
|
||||
};
|
||||
|
||||
export const getTaskProgress = (type: any, status: any) => {
|
||||
if (type === 2) {
|
||||
return "已完成 " + (status + 1) + " 个文件";
|
||||
return i18next.t("setting.transferProgress", {
|
||||
num: status,
|
||||
});
|
||||
}
|
||||
return taskProgress[status];
|
||||
return i18next.t(taskProgress[status]);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue