Skip to content

Commit 3541c05

Browse files
authored
feature: the internationalization of data management pages (#318)
* feature: complete the internationalization of data management pages * fix: resolve the bug that the Statistics does not change after changed the language * fix: solve the bug of not initializing the lineage graph when only creating a dataset * fix: solve the bug of data quality * fix: fixed display issue of labels on data set cards * feature: Improve the internationalization of dataset pages
1 parent f32c353 commit 3541c05

File tree

17 files changed

+1286
-498
lines changed

17 files changed

+1286
-498
lines changed

backend/services/data-management-service/src/main/java/com/datamate/datamanagement/application/DatasetApplicationService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,10 @@ private void addDatasetToGraph(Dataset dataset, CollectionTaskDetailResponse col
111111
collectionEdge.setDescription(dataset.getDescription());
112112
collectionEdge.setFromNodeId(collectionNode.getId());
113113
collectionEdge.setToNodeId(datasetNode.getId());
114+
lineageService.generateGraph(collectionNode, collectionEdge, datasetNode);
115+
} else {
116+
lineageService.generateGraph(datasetNode, null, null);
114117
}
115-
lineageService.generateGraph(collectionNode, collectionEdge, datasetNode);
116118
}
117119

118120
public DatasetLineage getDatasetLineage(String datasetId) {

frontend/src/components/AddTagPopover.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Button, Input, Popover, theme, Tag, Empty } from "antd";
22
import { PlusOutlined } from "@ant-design/icons";
33
import { useEffect, useMemo, useState } from "react";
4+
import { useTranslation } from "react-i18next";
45

56
interface Tag {
67
id: number;
@@ -22,6 +23,7 @@ export default function AddTagPopover({
2223
onCreateAndTag,
2324
}: AddTagPopoverProps) {
2425
const { token } = theme.useToken();
26+
const { t } = useTranslation();
2527
const [showPopover, setShowPopover] = useState(false);
2628

2729
const [newTag, setNewTag] = useState("");
@@ -68,12 +70,12 @@ export default function AddTagPopover({
6870
content={
6971
<div className="space-y-4 w-[300px]">
7072
<h4 className="font-medium border-b pb-2 border-gray-100">
71-
添加标签
73+
{t("tagManagement.addTag")}
7274
</h4>
7375
{/* Available Tags */}
7476
{availableTags?.length ? (
7577
<div className="space-y-2">
76-
<h5 className="text-sm">选择现有标签</h5>
78+
<h5 className="text-sm">{t("tagManagement.selectExistingTags")}</h5>
7779
<div className="max-h-32 overflow-y-auto space-y-1">
7880
{availableTags.map((tag) => (
7981
<span
@@ -91,15 +93,15 @@ export default function AddTagPopover({
9193
</div>
9294
</div>
9395
) : (
94-
<Empty description="没有可用标签,请先创建标签。" />
96+
<Empty description={t("tagManagement.noAvailableTags")} />
9597
)}
9698

9799
{/* Create New Tag */}
98100
<div className="space-y-2 border-t border-gray-100 pt-3">
99-
<h5 className="text-sm">创建新标签</h5>
101+
<h5 className="text-sm">{t("tagManagement.createNewTag")}</h5>
100102
<div className="flex gap-2">
101103
<Input
102-
placeholder="输入新标签名称..."
104+
placeholder={t("tagManagement.newTagNamePlaceholder")}
103105
value={newTag}
104106
onChange={(e) => setNewTag(e.target.value)}
105107
className="h-8 text-sm"
@@ -109,13 +111,13 @@ export default function AddTagPopover({
109111
disabled={!newTag.trim()}
110112
type="primary"
111113
>
112-
添加
114+
{t("tagManagement.createTag")}
113115
</Button>
114116
</div>
115117
</div>
116118

117119
<Button block onClick={() => setShowPopover(false)}>
118-
取消
120+
{t("tagManagement.cancel")}
119121
</Button>
120122
</div>
121123
}
@@ -126,7 +128,7 @@ export default function AddTagPopover({
126128
className="cursor-pointer"
127129
onClick={() => setShowPopover(true)}
128130
>
129-
添加标签
131+
{t("tagManagement.addTag")}
130132
</Tag>
131133
</Popover>
132134
</>

frontend/src/components/CardView.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import ActionDropdown from "./ActionDropdown";
77
import { Database } from "lucide-react";
88

99
interface BadgeItem {
10+
name: string;
1011
label: string;
1112
color?: string;
1213
background?: string;
@@ -84,7 +85,7 @@ const TagsRenderer = ({ tags }: { tags?: Array<string | BadgeItem> }) => {
8485
if (typeof tag === "string") {
8586
tagElement.textContent = tag;
8687
} else {
87-
tagElement.textContent = tag.label;
88+
tagElement.textContent = tag.label ? tag.label : tag.name;
8889
}
8990
tempDiv.appendChild(tagElement);
9091
tagElements.push(tagElement);
@@ -145,7 +146,7 @@ const TagsRenderer = ({ tags }: { tags?: Array<string | BadgeItem> }) => {
145146
: { background: tag.background, color: tag.color }
146147
}
147148
>
148-
{typeof tag === "string" ? tag : tag.label}
149+
{typeof tag === "string" ? tag : (tag.label ? tag.label : tag.name)}
149150
</Tag>
150151
))}
151152
</div>
@@ -164,7 +165,7 @@ const TagsRenderer = ({ tags }: { tags?: Array<string | BadgeItem> }) => {
164165
: { background: tag.background, color: tag.color }
165166
}
166167
>
167-
{typeof tag === "string" ? tag : tag.label}
168+
{typeof tag === "string" ? tag : (tag.label ? tag.label : tag.name)}
168169
</Tag>
169170
))}
170171
{hiddenTags.length > 0 && (
@@ -255,7 +256,7 @@ function CardView<T extends BaseCardDataType>(props: CardViewProps<T>) {
255256
color: item.tags[0].color,
256257
}}
257258
>
258-
{item.tags[0].label}
259+
{item.tags[0].label ? item.tags[0].label : item.tags[0].name}
259260
</Tag>
260261
)}
261262
{item?.status && (

frontend/src/components/business/TagManagement.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Drawer, Input, Button, App } from "antd";
33
import { PlusOutlined } from "@ant-design/icons";
44
import { Edit, Save, TagIcon, X, Trash } from "lucide-react";
55
import { TagItem } from "@/pages/DataManagement/dataset.model";
6+
import { useTranslation } from "react-i18next";
67

78
interface CustomTagProps {
89
isEditable?: boolean;
@@ -105,6 +106,7 @@ const TagManager: React.FC = ({
105106
}) => {
106107
const [showTagManager, setShowTagManager] = useState(false);
107108
const { message } = App.useApp();
109+
const { t } = useTranslation();
108110
const [tags, setTags] = useState<{ id: number; name: string }[]>([]);
109111
const [newTag, setNewTag] = useState("");
110112
const [editingTag, setEditingTag] = useState<string | null>(null);
@@ -117,7 +119,7 @@ const TagManager: React.FC = ({
117119
const { data } = await onFetch?.();
118120
setTags(data || []);
119121
} catch (e) {
120-
message.error("获取标签失败");
122+
message.error(t("tagManagement.messages.fetchFailed"));
121123
}
122124
};
123125

@@ -129,9 +131,9 @@ const TagManager: React.FC = ({
129131
});
130132
fetchTags();
131133
setNewTag("");
132-
message.success("标签添加成功");
134+
message.success(t("tagManagement.messages.addSuccess"));
133135
} catch (error) {
134-
message.error("添加标签失败");
136+
message.error(t("tagManagement.messages.addFailed"));
135137
}
136138
};
137139

@@ -140,19 +142,19 @@ const TagManager: React.FC = ({
140142
try {
141143
await onDelete?.(tag.id);
142144
fetchTags();
143-
message.success("标签删除成功");
145+
message.success(t("tagManagement.messages.deleteSuccess"));
144146
} catch (error) {
145-
message.error("删除标签失败");
147+
message.error(t("tagManagement.messages.deleteFailed"));
146148
}
147149
};
148150

149151
const updateTag = async (oldTag: TagItem, newTag: string) => {
150152
try {
151153
await onUpdate?.({ ...oldTag, name: newTag });
152154
fetchTags();
153-
message.success("标签更新成功");
155+
message.success(t("tagManagement.messages.updateSuccess"));
154156
} catch (error) {
155-
message.error("更新标签失败");
157+
message.error(t("tagManagement.messages.updateFailed"));
156158
}
157159
};
158160

@@ -192,19 +194,19 @@ const TagManager: React.FC = ({
192194
icon={<TagIcon className="w-4 h-4 mr-2" />}
193195
onClick={() => setShowTagManager(true)}
194196
>
195-
标签管理
197+
{t("tagManagement.manageTags")}
196198
</Button>
197199
<Drawer
198200
open={showTagManager}
199201
onClose={() => setShowTagManager(false)}
200-
title="标签管理"
202+
title={t("tagManagement.manageTags")}
201203
width={500}
202204
>
203205
<div className="space-y-4 flex-overflow">
204206
{/* Add New Tag */}
205207
<div className="flex gap-2">
206208
<Input
207-
placeholder="输入标签名称..."
209+
placeholder={t("tagManagement.tagNamePlaceholder")}
208210
value={newTag}
209211
allowClear
210212
onChange={(e) => setNewTag(e.target.value)}
@@ -220,7 +222,7 @@ const TagManager: React.FC = ({
220222
disabled={!newTag.trim()}
221223
icon={<PlusOutlined />}
222224
>
223-
添加
225+
{t("tagManagement.createTag")}
224226
</Button>
225227
</div>
226228

0 commit comments

Comments
 (0)