Skip to content

Commit af7b5ab

Browse files
authored
implement internationalization of data ratio page (#321)
* feature: implement internationalization of data ratio page * fix: text datasets should not be prompted when uploading pdf, doc, or docx documents * fix: fixed the display of the creation time of the matching task on the matching page * fix: fixed the abnormal icon display on the matching task details page * feature: implement internationalization of data ratio page * fix: fixed an issue with the matching task details page
1 parent 747d47e commit af7b5ab

File tree

13 files changed

+565
-241
lines changed

13 files changed

+565
-241
lines changed

frontend/src/i18n/locales/en/common.json

Lines changed: 147 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,153 @@
590590
"failed": "Failed",
591591
"completed": "Completed",
592592
"draft": "Draft",
593-
"pending": "Ready"
593+
"pending": "Ready",
594+
"paused": "Paused"
595+
}
596+
}
597+
},
598+
"ratioTask": {
599+
"home": {
600+
"title": "Ratio Tasks",
601+
"createTask": "Create Ratio Task",
602+
"filters": {
603+
"statusFilter": "Status Filter",
604+
"allStatus": "All Status",
605+
"pending": "Pending",
606+
"running": "Running",
607+
"success": "Completed",
608+
"failed": "Failed",
609+
"paused": "Paused"
610+
},
611+
"columns": {
612+
"taskName": "Task Name",
613+
"status": "Status",
614+
"targetCount": "Target Count",
615+
"targetDataset": "Target Dataset",
616+
"createdAt": "Created At",
617+
"actions": "Actions"
618+
},
619+
"messages": {
620+
"deleteSuccess": "Task deleted successfully",
621+
"deleteFailed": "Task deletion failed, please try again later"
622+
},
623+
"confirm": {
624+
"deleteTitle": "Confirm delete this task?",
625+
"deleteDesc": "This task cannot be recovered after deletion. Please proceed with caution.",
626+
"okText": "Delete",
627+
"cancelText": "Cancel"
628+
},
629+
"searchPlaceholder": "Search task name..."
630+
},
631+
"create": {
632+
"title": "Create Ratio Task",
633+
"cancel": "Cancel",
634+
"submit": "Create",
635+
"basicInfo": {
636+
"nameLabel": "Task Name",
637+
"namePlaceholder": "Enter ratio task name",
638+
"nameRequired": "Please enter ratio task name",
639+
"totalTargetLabel": "Target Total Count",
640+
"totalTargetPlaceholder": "Target total count",
641+
"totalTargetRequired": "Please enter target total count",
642+
"descriptionLabel": "Task Description",
643+
"descriptionPlaceholder": "Describe the purpose and requirements of the ratio task"
644+
},
645+
"selectDataset": {
646+
"title": "Select Dataset",
647+
"selectedCount": "Selected: {{current}}/{{total}}",
648+
"clearSelection": "Clear Selection",
649+
"searchPlaceholder": "Search dataset",
650+
"loading": "Loading datasets...",
651+
"noLabelDist": "No label distribution detected",
652+
"loadingLabelDist": "Loading label distribution..."
653+
},
654+
"ratioConfig": {
655+
"title": "Ratio Configuration",
656+
"configuredCount": "Configured: {{configured}}/{{total}}",
657+
"averageDistribute": "Average Distribution",
658+
"selectDatasetFirst": "Please select dataset first",
659+
"totalRatioCount": "Total ratio count:",
660+
"targetCount": "Target count:",
661+
"label": "Label",
662+
"labelValue": "Label Value",
663+
"labelUpdateTime": "Label Update Time",
664+
"quantity": "Quantity",
665+
"actions": "Actions",
666+
"selectLabel": "Select label",
667+
"selectLabelValue": "Select label value",
668+
"dateStart": "Start Time",
669+
"dateEnd": "End Time",
670+
"delete": "Delete",
671+
"emptyText": "No ratio items yet, please add",
672+
"addRatioItem": "Add Ratio Item",
673+
"itemSuffix": " items"
674+
},
675+
"messages": {
676+
"configRequired": "Please configure ratio items",
677+
"createSuccess": "Ratio task created successfully",
678+
"createFailed": "Ratio task creation failed, please try again"
679+
}
680+
},
681+
"detail": {
682+
"homeLink": "Home",
683+
"detailTitle": "Ratio Task Detail",
684+
"tabs": {
685+
"overview": "Overview"
686+
},
687+
"labels": {
688+
"id": "ID",
689+
"name": "Name",
690+
"targetCount": "Target Count",
691+
"targetDataset": "Target Dataset",
692+
"status": "Status",
693+
"createdBy": "Creator",
694+
"createdAt": "Created At",
695+
"updatedAt": "Updated At",
696+
"description": "Description",
697+
"basicInfo": "Basic Information"
698+
},
699+
"messages": {
700+
"refreshSuccess": "Task data refreshed successfully",
701+
"deleteSuccess": "Ratio task deleted successfully",
702+
"taskStarted": "Task started",
703+
"taskStopped": "Task stopped"
704+
},
705+
"operations": {
706+
"refresh": "Refresh",
707+
"delete": "Delete"
708+
},
709+
"confirm": {
710+
"deleteTitle": "Confirm delete this ratio task?",
711+
"deleteDesc": "This task cannot be recovered after deletion. Please proceed with caution.",
712+
"okText": "Delete",
713+
"cancelText": "Cancel"
714+
},
715+
"metrics": {
716+
"totalData": "Total Data Volume",
717+
"ratioSuccessRate": "Ratio Success Rate",
718+
"processSpeed": "Processing Speed",
719+
"activeUsers": "Active Users"
720+
},
721+
"chart": {
722+
"ratioTrendTitle": "Ratio Trend Analysis",
723+
"successRateCurve": "Success Rate Curve",
724+
"ratioRate": "Ratio Rate",
725+
"successCount": "Success Count",
726+
"failCount": "Fail Count",
727+
"monthJan": "Jan",
728+
"monthFeb": "Feb",
729+
"monthMar": "Mar",
730+
"monthApr": "Apr",
731+
"monthMay": "May",
732+
"monthJun": "Jun"
733+
},
734+
"ratioDisplay": {
735+
"title": "Dataset Ratio Information",
736+
"datasetUserBehavior": "User Behavior Dataset",
737+
"datasetTransaction": "Transaction Record Dataset",
738+
"datasetProduct": "Product Info Dataset",
739+
"datasetReview": "Review Feedback Dataset"
594740
}
595741
}
596742
},

frontend/src/i18n/locales/zh/common.json

Lines changed: 147 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,153 @@
589589
"failed": "错误",
590590
"completed": "成功",
591591
"draft": "草稿",
592-
"pending": "就绪"
592+
"pending": "就绪",
593+
"paused": "已暂停"
594+
}
595+
}
596+
},
597+
"ratioTask": {
598+
"home": {
599+
"title": "配比任务",
600+
"createTask": "创建配比任务",
601+
"filters": {
602+
"statusFilter": "状态筛选",
603+
"allStatus": "全部状态",
604+
"pending": "等待中",
605+
"running": "运行中",
606+
"success": "已完成",
607+
"failed": "失败",
608+
"paused": "已暂停"
609+
},
610+
"columns": {
611+
"taskName": "任务名称",
612+
"status": "状态",
613+
"targetCount": "目标数量",
614+
"targetDataset": "目标数据集",
615+
"createdAt": "创建时间",
616+
"actions": "操作"
617+
},
618+
"messages": {
619+
"deleteSuccess": "任务删除成功",
620+
"deleteFailed": "任务删除失败,请稍后重试"
621+
},
622+
"confirm": {
623+
"deleteTitle": "确认删除该任务?",
624+
"deleteDesc": "删除后该任务将无法恢复,请谨慎操作。",
625+
"okText": "删除",
626+
"cancelText": "取消"
627+
},
628+
"searchPlaceholder": "搜索任务名称..."
629+
},
630+
"create": {
631+
"title": "创建配比任务",
632+
"cancel": "取消",
633+
"submit": "创建",
634+
"basicInfo": {
635+
"nameLabel": "任务名称",
636+
"namePlaceholder": "输入配比任务名称",
637+
"nameRequired": "请输入配比任务名称",
638+
"totalTargetLabel": "目标总数量",
639+
"totalTargetPlaceholder": "目标总数量",
640+
"totalTargetRequired": "请输入目标总数量",
641+
"descriptionLabel": "任务描述",
642+
"descriptionPlaceholder": "描述配比任务的目的和要求"
643+
},
644+
"selectDataset": {
645+
"title": "选择数据集",
646+
"selectedCount": "已选择: {{current}}/{{total}}",
647+
"clearSelection": "清空选择",
648+
"searchPlaceholder": "搜索数据集",
649+
"loading": "正在加载数据集...",
650+
"noLabelDist": "未检测到标签分布",
651+
"loadingLabelDist": "加载标签分布..."
652+
},
653+
"ratioConfig": {
654+
"title": "配比配置",
655+
"configuredCount": "已配置:{{configured}}/{{total}}条",
656+
"averageDistribute": "平均分配",
657+
"selectDatasetFirst": "请先选择数据集",
658+
"totalRatioCount": "总配比数量:",
659+
"targetCount": "目标数量:",
660+
"label": "标签",
661+
"labelValue": "标签值",
662+
"labelUpdateTime": "标签更新时间",
663+
"quantity": "数量",
664+
"actions": "操作",
665+
"selectLabel": "选择标签",
666+
"selectLabelValue": "选择标签值",
667+
"dateStart": "开始时间",
668+
"dateEnd": "结束时间",
669+
"delete": "删除",
670+
"emptyText": "暂无配比项,请添加",
671+
"addRatioItem": "添加配比项",
672+
"itemSuffix": ""
673+
},
674+
"messages": {
675+
"configRequired": "请配置配比项",
676+
"createSuccess": "配比任务创建成功",
677+
"createFailed": "配比任务创建失败,请重试"
678+
}
679+
},
680+
"detail": {
681+
"homeLink": "首页",
682+
"detailTitle": "配比任务详情",
683+
"tabs": {
684+
"overview": "概览"
685+
},
686+
"labels": {
687+
"id": "ID",
688+
"name": "名称",
689+
"targetCount": "目标数量",
690+
"targetDataset": "目标数据集",
691+
"status": "状态",
692+
"createdBy": "创建者",
693+
"createdAt": "创建时间",
694+
"updatedAt": "更新时间",
695+
"description": "描述",
696+
"basicInfo": "基本信息"
697+
},
698+
"messages": {
699+
"refreshSuccess": "任务数据刷新成功",
700+
"deleteSuccess": "配比任务删除成功",
701+
"taskStarted": "任务已启动",
702+
"taskStopped": "任务已停止"
703+
},
704+
"operations": {
705+
"refresh": "刷新",
706+
"delete": "删除"
707+
},
708+
"confirm": {
709+
"deleteTitle": "确认删除该配比任务?",
710+
"deleteDesc": "删除后该任务将无法恢复,请谨慎操作。",
711+
"okText": "删除",
712+
"cancelText": "取消"
713+
},
714+
"metrics": {
715+
"totalData": "总数据量",
716+
"ratioSuccessRate": "配比成功率",
717+
"processSpeed": "处理速度",
718+
"activeUsers": "活跃用户"
719+
},
720+
"chart": {
721+
"ratioTrendTitle": "配比趋势分析",
722+
"successRateCurve": "成功率曲线",
723+
"ratioRate": "配比率",
724+
"successCount": "成功数",
725+
"failCount": "失败数",
726+
"monthJan": "一月",
727+
"monthFeb": "二月",
728+
"monthMar": "三月",
729+
"monthApr": "四月",
730+
"monthMay": "五月",
731+
"monthJun": "六月"
732+
},
733+
"ratioDisplay": {
734+
"title": "数据集配比信息",
735+
"datasetUserBehavior": "用户行为数据集",
736+
"datasetTransaction": "交易记录数据集",
737+
"datasetProduct": "产品信息数据集",
738+
"datasetReview": "评价反馈数据集"
593739
}
594740
}
595741
},

frontend/src/pages/DataManagement/Detail/components/ImportConfiguration.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ const DATASET_TYPE_SAFE_SUFFIXES: Record<DatasetType, string[]> = {
2222
".html",
2323
".htm",
2424
".log",
25+
".pdf",
26+
".doc",
27+
".docx",
2528
],
2629
[DatasetType.IMAGE]: [
2730
".jpg",

frontend/src/pages/RatioTask/Create/CreateRatioTask.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ import { ArrowLeft, ChevronRight } from "lucide-react";
44
import { createRatioTaskUsingPost } from "@/pages/RatioTask/ratio.api.ts";
55
import type { Dataset } from "@/pages/DataManagement/dataset.model.ts";
66
import { useNavigate } from "react-router";
7+
import { useTranslation } from "react-i18next";
78
import SelectDataset from "@/pages/RatioTask/Create/components/SelectDataset.tsx";
89
import BasicInformation from "@/pages/RatioTask/Create/components/BasicInformation.tsx";
910
import RatioConfig from "@/pages/RatioTask/Create/components/RatioConfig.tsx";
1011
import {formatDate} from "@/utils/unit.ts";
1112

1213
export default function CreateRatioTask() {
1314
const navigate = useNavigate();
15+
const { t } = useTranslation();
1416
const [form] = Form.useForm();
1517
// 配比任务相关状态
1618
const [ratioTaskForm, setRatioTaskForm] = useState({
@@ -33,7 +35,7 @@ export default function CreateRatioTask() {
3335
try {
3436
const values = await form.validateFields();
3537
if (!ratioTaskForm.ratioConfigs.length) {
36-
message.error("请配置配比项");
38+
message.error(t("ratioTask.create.messages.configRequired"));
3739
return;
3840
}
3941
const totals = String(values.totalTargetCount);
@@ -53,10 +55,10 @@ export default function CreateRatioTask() {
5355
totals,
5456
config,
5557
});
56-
message.success("配比任务创建成功");
58+
message.success(t("ratioTask.create.messages.createSuccess"));
5759
navigate("/data/synthesis/ratio-task");
5860
} catch {
59-
message.error("配比任务创建失败,请重试");
61+
message.error(t("ratioTask.create.messages.createFailed"));
6062
} finally {
6163
setCreating(false);
6264
}
@@ -77,7 +79,7 @@ export default function CreateRatioTask() {
7779
>
7880
<ArrowLeft className="w-4 h-4 mr-1" />
7981
</Button>
80-
<h1 className="text-xl font-bold bg-clip-text">创建配比任务</h1>
82+
<h1 className="text-xl font-bold bg-clip-text">{t("ratioTask.create.title")}</h1>
8183
</div>
8284
</div>
8385
<div className="h-full flex-overflow-auto border-card">
@@ -138,7 +140,7 @@ export default function CreateRatioTask() {
138140
</div>
139141
<div className="flex justify-end gap-2 p-6">
140142
<Button onClick={() => navigate("/data/synthesis/ratio-task")}>
141-
取消
143+
{t("ratioTask.create.cancel")}
142144
</Button>
143145
<Button
144146
type="primary"
@@ -148,7 +150,7 @@ export default function CreateRatioTask() {
148150
!ratioTaskForm.name || ratioTaskForm.ratioConfigs.length === 0
149151
}
150152
>
151-
创建
153+
{t("ratioTask.create.submit")}
152154
</Button>
153155
</div>
154156
</div>

0 commit comments

Comments
 (0)