Translate common property names to Chinese

This commit is contained in:
yangdx
2025-03-14 01:56:10 +08:00
parent 496a208bf9
commit c9c9f3d911
5 changed files with 42 additions and 20 deletions

View File

@@ -8,7 +8,7 @@
<link rel="icon" type="image/svg+xml" href="./logo.png" /> <link rel="icon" type="image/svg+xml" href="./logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Lightrag</title> <title>Lightrag</title>
<script type="module" crossorigin src="./assets/index-CKDgttI2.js"></script> <script type="module" crossorigin src="./assets/index-B6Hxnq21.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-ban2VJxS.css"> <link rel="stylesheet" crossorigin href="./assets/index-ban2VJxS.css">
</head> </head>
<body> <body>

View File

@@ -132,11 +132,19 @@ const PropertyRow = ({
onClick?: () => void onClick?: () => void
tooltip?: string tooltip?: string
}) => { }) => {
const { t } = useTranslation()
const getPropertyNameTranslation = (name: string) => {
const translationKey = `graphPanel.propertiesView.node.propertyNames.${name}`
const translation = t(translationKey)
return translation === translationKey ? name : translation
}
return ( return (
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<label className="text-primary/60 tracking-wide">{name}</label>: <label className="text-primary/60 tracking-wide whitespace-nowrap">{getPropertyNameTranslation(name)}</label>:
<Text <Text
className="hover:bg-primary/20 rounded p-1 text-ellipsis" className="hover:bg-primary/20 rounded p-1 overflow-hidden text-ellipsis"
tooltipClassName="max-w-80" tooltipClassName="max-w-80"
text={value} text={value}
tooltip={tooltip || (typeof value === 'string' ? value : JSON.stringify(value, null, 2))} tooltip={tooltip || (typeof value === 'string' ? value : JSON.stringify(value, null, 2))}

View File

@@ -150,7 +150,14 @@
"labels": "Labels", "labels": "Labels",
"degree": "Degree", "degree": "Degree",
"properties": "Properties", "properties": "Properties",
"relationships": "Relationships" "relationships": "Relationships",
"propertyNames": {
"description": "Description",
"entity_id": "Name",
"entity_type": "Type",
"source_id": "SrcID",
"Neighbour": "Neigh"
}
}, },
"edge": { "edge": {
"title": "Relationship", "title": "Relationship",

View File

@@ -147,7 +147,14 @@
"labels": "标签", "labels": "标签",
"degree": "度数", "degree": "度数",
"properties": "属性", "properties": "属性",
"relationships": "关系" "relationships": "关系",
"propertyNames": {
"description": "描述",
"entity_id": "名称",
"entity_type": "类型",
"source_id": "信源ID",
"Neighbour": "邻接"
}
}, },
"edge": { "edge": {
"title": "关系", "title": "关系",