- 最后一步,为此存储策略命名:
+ {t("nameThePolicy")}
- 存储策略名
+ {t("policyName")}
setActiveStep(2)}
>
- 上一步
+ {t("back")}
{" "}
@@ -779,10 +782,10 @@ export default function LocalGuide(props) {
<>
@@ -791,7 +794,7 @@ export default function LocalGuide(props) {
className={classes.button}
onClick={() => history.push("/admin/policy")}
>
- 返回存储策略列表
+ {t("backToList")}
>
diff --git a/src/component/Admin/Policy/Policy.js b/src/component/Admin/Policy/Policy.js
index 1840616..f0a78f6 100644
--- a/src/component/Admin/Policy/Policy.js
+++ b/src/component/Admin/Policy/Policy.js
@@ -18,10 +18,10 @@ import React, { useCallback, useEffect, useState } from "react";
import { useDispatch } from "react-redux";
import { useHistory, useLocation } from "react-router";
import { toggleSnackbar } from "../../../redux/explorer";
-import { policyTypeMap } from "../../../config";
import API from "../../../middleware/Api";
import { sizeToString } from "../../../utils";
import AddPolicy from "../Dialogs/AddPolicy";
+import { useTranslation } from "react-i18next";
const useStyles = makeStyles((theme) => ({
root: {
@@ -47,24 +47,24 @@ const useStyles = makeStyles((theme) => ({
}));
const columns = [
- { id: "#", label: "#", minWidth: 50 },
- { id: "name", label: "名称", minWidth: 170 },
- { id: "type", label: "类型", minWidth: 170 },
+ { id: "#", label: "sharp", minWidth: 50 },
+ { id: "name", label: "name", minWidth: 170 },
+ { id: "type", label: "type", minWidth: 170 },
{
id: "count",
- label: "下属文件数",
+ label: "childFiles",
minWidth: 50,
align: "right",
},
{
id: "size",
- label: "数据量",
+ label: "totalSize",
minWidth: 100,
align: "right",
},
{
id: "action",
- label: "操作",
+ label: "actions",
minWidth: 170,
align: "right",
},
@@ -75,6 +75,7 @@ function useQuery() {
}
export default function Policy() {
+ const { t } = useTranslation("dashboard", { keyPrefix: "policy" });
const classes = useStyles();
// const [loading, setLoading] = useState(false);
// const [tab, setTab] = useState(0);
@@ -109,7 +110,7 @@ export default function Policy() {
useEffect(() => {
if (query.get("code") === "0") {
- ToggleSnackbar("top", "right", "授权成功", "success");
+ ToggleSnackbar("top", "right", t("authSuccess"), "success");
} else if (query.get("msg") && query.get("msg") !== "") {
ToggleSnackbar(
"top",
@@ -145,7 +146,7 @@ export default function Policy() {
API.delete("/admin/policy/" + id)
.then(() => {
loadList();
- ToggleSnackbar("top", "right", "存储策略已删除", "success");
+ ToggleSnackbar("top", "right", t("policyDeleted"), "success");
})
.catch((error) => {
ToggleSnackbar("top", "right", error.message, "error");
@@ -163,7 +164,7 @@ export default function Policy() {
onClick={() => setAddDialog(true)}
variant={"contained"}
>
- 添加存储策略
+ {t("newStoragePolicy")}
@@ -204,7 +211,7 @@ export default function Policy() {
align={column.align}
style={{ minWidth: column.minWidth }}
>
- {column.label}
+ {t(column.label)}
))}
@@ -214,11 +221,7 @@ export default function Policy() {