Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions frontend/src/i18n/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,10 @@
}
},
"common": {
"yes": "Yes",
"no": "No",
"cancel": "Cancel",
"refresh": "Refresh",
"settings": {
"title": "Settings"
},
Expand Down Expand Up @@ -1373,6 +1377,8 @@
"descriptionPlaceholder": "Describe the purpose",
"srcDataset": "Source Dataset",
"srcDatasetPlaceholder": "Select source dataset",
"destDatasetName": "Target Dataset Name",
"destDatasetNamePlaceholder": "Enter or select target dataset name",
"destDatasetType": "Target Dataset Type",
"useSourceDataset": "Use Source Dataset",
"useSourceDatasetHint": "Output will be replaced in source dataset",
Expand Down Expand Up @@ -1871,6 +1877,52 @@
"latestVersion": "Latest Version",
"noReleases": "No version release information",
"initialize": "Click to initialize"
},
"examples": {
"copyCode": "Copy Code"
},
"service": {
"notSupported": "Deployment not supported",
"confirmUninstall": "Confirm uninstall service?",
"uninstallConfirm": "The service will stop running after uninstallation. Continue?",
"uninstall": "Uninstall",
"status": {
"running": "Running",
"failed": "Failed",
"standby": "Standby",
"stopped": "Stopped"
},
"notDeployed": "Not deployed",
"clickToDeploy": "Click to deploy",
"deploy": "Deploy",
"notSupportedHint": "This operator does not support deployment",
"deploymentInfo": "Deployment Info",
"deployedAt": "Deployed At",
"version": "Version",
"replicas": "Replicas",
"uninstallService": "Uninstall Service",
"podMonitor": "Pod Monitor",
"noPods": "No Pods",
"createdAt": "Created At",
"cpuUsage": "CPU Usage",
"memoryUsage": "Memory Usage",
"restartCount": "Restart Count",
"viewLogs": "View Logs",
"deploying": "Deploying",
"logs": "Logs",
"copyLogs": "Copy Logs",
"close": "Close"
},
"requirement": {
"systemRequirements": "System Requirements",
"cpuSpec": "CPU Spec",
"noLimit": "No Limit",
"memorySpec": "Memory Spec",
"storage": "Storage",
"gpuSupport": "GPU Support",
"npuSupport": "NPU Support",
"dependencies": "Dependencies",
"parseError": "Failed to parse data"
}
},
"create": {
Expand Down
50 changes: 50 additions & 0 deletions frontend/src/i18n/locales/zh/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,10 @@
}
},
"common": {
"yes": "是",
"no": "否",
"cancel": "取消",
"refresh": "刷新",
"settings": {
"title": "设置"
},
Expand Down Expand Up @@ -1872,6 +1876,52 @@
"latestVersion": "最新版本",
"noReleases": "暂无版本发布信息",
"initialize": "点击初始化"
},
"examples": {
"copyCode": "复制代码"
},
"service": {
"notSupported": "暂不支持部署",
"confirmUninstall": "确认卸载服务?",
"uninstallConfirm": "卸载后服务将停止运行,是否继续?",
"uninstall": "卸载",
"status": {
"running": "运行中",
"failed": "失败",
"standby": "待机",
"stopped": "已停止"
},
"notDeployed": "未部署",
"clickToDeploy": "点击部署",
"deploy": "部署",
"notSupportedHint": "当前算子不支持部署功能",
"deploymentInfo": "部署信息",
"deployedAt": "部署时间",
"version": "版本",
"replicas": "副本数",
"uninstallService": "卸载服务",
"podMonitor": "Pod 监控",
"noPods": "暂无 Pod",
"createdAt": "创建时间",
"cpuUsage": "CPU 使用率",
"memoryUsage": "内存使用率",
"restartCount": "重启次数",
"viewLogs": "查看日志",
"deploying": "部署中",
"logs": "日志",
"copyLogs": "复制日志",
"close": "关闭"
},
"requirement": {
"systemRequirements": "系统规格",
"cpuSpec": "CPU 规格",
"noLimit": "无限制",
"memorySpec": "内存规格",
"storage": "存储",
"gpuSupport": "GPU 支持",
"npuSupport": "NPU 支持",
"dependencies": "依赖项",
"parseError": "数据解析失败"
}
},
"create": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
Switch,
} from "antd";
import { ConfigI, OperatorI } from "@/pages/OperatorMarket/operator.model";
import { useTranslation } from "react-i18next";

interface ParamConfigProps {
operator: OperatorI;
Expand All @@ -25,6 +26,7 @@ const ParamConfig: React.FC<ParamConfigProps> = ({
param,
onParamChange,
}) => {
const { t } = useTranslation();
if (!param) return null;
let defaultVal: any = operator.overrides?.[paramKey] ?? param.defaultVal;
if (param.type === "range") {
Expand Down Expand Up @@ -53,7 +55,7 @@ const ParamConfig: React.FC<ParamConfigProps> = ({
<Input
value={value}
onChange={(e) => updateValue(e.target.value)}
placeholder={`请输入${param.name}`}
placeholder={t("dataCleansing.paramConfig.enterValue", { name: param.name })}
className="w-full"
/>
</Form.Item>
Expand Down Expand Up @@ -202,7 +204,7 @@ const ParamConfig: React.FC<ParamConfigProps> = ({
<InputNumber
value={value}
onChange={(val) => updateValue(val)}
placeholder={`请输入${param.name}`}
placeholder={t("dataCleansing.paramConfig.enterValue", { name: param.name })}
className="w-full"
min={param.min}
max={param.max}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
queryOperatorsUsingPost,
} from "@/pages/OperatorMarket/operator.api";
import {useParams} from "react-router";
import i18n from "@/i18n";

export function useOperatorOperations() {
const { id = "" } = useParams();
Expand Down Expand Up @@ -97,6 +98,16 @@ export function useOperatorOperations() {
initOperators();
}, []);

useEffect(() => {
const handleLanguageChange = () => {
initOperators();
};
i18n.on('languageChanged', handleLanguageChange);
return () => {
i18n.off('languageChanged', handleLanguageChange);
};
}, [i18n]);

const toggleOperator = (operator: OperatorI) => {
const exist = selectedOperators.find((op) => op.id === operator.id);
if (exist) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default function LogsTable({ taskLog: initialLogs, fetchTaskLog, retryCou
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `${taskName}_第${selectedLog}次运行.log`;
a.download = `${taskName}_${t("dataCleansing.logTable.nthRun", { num: selectedLog })}.log`;
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ export default function OperatorPluginCreate() {
</div>
{uploadStep === "configure" && (
<div className="flex justify-end gap-3 mt-8">
<Button onClick={() => setUploadStep("upload")}>重新上传</Button>
<Button onClick={() => setUploadStep("upload")}>{t("operatorMarket.create.actions.reupload")}</Button>
<Button type="primary" onClick={handlePublish}>
{id ? "更新" : "发布"}算子
{id ? t("operatorMarket.create.actions.update") : t("operatorMarket.create.actions.publish")}
</Button>
</div>
)}
Expand Down
11 changes: 11 additions & 0 deletions frontend/src/pages/OperatorMarket/Detail/OperatorPluginDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {Clock, GitBranch} from "lucide-react";
import DetailHeader from "@/components/DetailHeader";
import {Link, useNavigate, useParams} from "react-router";
import { useTranslation } from "react-i18next";
import i18n from "@/i18n";
import Overview from "./components/Overview";
import Requirement from "./components/Requirement";
import Documentation from "./components/Documentation";
Expand Down Expand Up @@ -42,6 +43,16 @@ export default function OperatorPluginDetail() {
fetchOperator();
}, [id]);

useEffect(() => {
const handleLanguageChange = () => {
fetchOperator();
};
i18n.on('languageChanged', handleLanguageChange);
return () => {
i18n.off('languageChanged', handleLanguageChange);
};
}, [i18n, id]);

if (!operator) {
return <div>Loading...</div>;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { copyToClipboard } from "@/utils/unit";
import { Card, Button } from "antd";
import { Copy } from "lucide-react";
import { useTranslation } from "react-i18next";

export default function Examples({ operator }) {
const { t } = useTranslation();

return (
<div className="flex flex-col gap-4">
{operator.examples.map((example, index) => (
Expand All @@ -13,7 +16,7 @@ export default function Examples({ operator }) {
</h3>
<Button size="small" onClick={() => copyToClipboard(example.code)}>
<Copy className="w-4 h-4 mr-2" />
复制代码
{t("operatorMarket.detail.examples.copyCode")}
</Button>
</div>
<div className="bg-gray-900 text-gray-100 p-4 rounded-lg overflow-x-auto">
Expand Down
Loading
Loading