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

@@ -132,11 +132,19 @@ const PropertyRow = ({
onClick?: () => void
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 (
<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
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"
text={value}
tooltip={tooltip || (typeof value === 'string' ? value : JSON.stringify(value, null, 2))}