From 688be9408598c089e4aeae0c8949324b9c0b30e0 Mon Sep 17 00:00:00 2001 From: yangdx Date: Sun, 6 Apr 2025 23:42:03 +0800 Subject: [PATCH] Add i18n translation --- .../src/components/graph/Legend.tsx | 19 ++++++++++++++++++- lightrag_webui/src/locales/ar.json | 13 +++++++++++++ lightrag_webui/src/locales/en.json | 13 +++++++++++++ lightrag_webui/src/locales/fr.json | 13 +++++++++++++ lightrag_webui/src/locales/zh.json | 13 +++++++++++++ 5 files changed, 70 insertions(+), 1 deletion(-) diff --git a/lightrag_webui/src/components/graph/Legend.tsx b/lightrag_webui/src/components/graph/Legend.tsx index b0b59de8..a8b7a556 100644 --- a/lightrag_webui/src/components/graph/Legend.tsx +++ b/lightrag_webui/src/components/graph/Legend.tsx @@ -4,6 +4,21 @@ import { useGraphStore } from '@/stores/graph' import { Card } from '@/components/ui/Card' import { ScrollArea } from '@/components/ui/ScrollArea' +// Predefined node types list +const PREDEFINED_TYPES = [ + 'person', + 'category', + 'geo', + 'location', + 'organization', + 'event', + 'equipment', + 'weapon', + 'animal', + 'unknown', + 'technology' +] + interface LegendProps { className?: string } @@ -28,7 +43,9 @@ const Legend: React.FC = ({ className }) => { style={{ backgroundColor: color }} /> - {type} + {PREDEFINED_TYPES.includes(type.toLowerCase()) + ? t(`graphPanel.nodeTypes.${type.toLowerCase()}`) + : type} ))} diff --git a/lightrag_webui/src/locales/ar.json b/lightrag_webui/src/locales/ar.json index 906fe58a..0e121534 100644 --- a/lightrag_webui/src/locales/ar.json +++ b/lightrag_webui/src/locales/ar.json @@ -143,6 +143,19 @@ "title": "إعدادات خادم LightRAG" }, "legend": "المفتاح", + "nodeTypes": { + "person": "شخص", + "category": "فئة", + "geo": "كيان جغرافي", + "location": "موقع", + "organization": "منظمة", + "event": "حدث", + "equipment": "معدات", + "weapon": "سلاح", + "animal": "حيوان", + "unknown": "غير معروف", + "technology": "العلوم" + }, "sideBar": { "settings": { "settings": "الإعدادات", diff --git a/lightrag_webui/src/locales/en.json b/lightrag_webui/src/locales/en.json index 2e296a4d..588d1982 100644 --- a/lightrag_webui/src/locales/en.json +++ b/lightrag_webui/src/locales/en.json @@ -143,6 +143,19 @@ "title": "LightRAG Server Settings" }, "legend": "Legend", + "nodeTypes": { + "person": "Person", + "category": "Category", + "geo": "Geographic", + "location": "Location", + "organization": "Organization", + "event": "Event", + "equipment": "Equipment", + "weapon": "Weapon", + "animal": "Animal", + "unknown": "Unknown", + "technology": "Technology" + }, "sideBar": { "settings": { "settings": "Settings", diff --git a/lightrag_webui/src/locales/fr.json b/lightrag_webui/src/locales/fr.json index b2067d70..155592d2 100644 --- a/lightrag_webui/src/locales/fr.json +++ b/lightrag_webui/src/locales/fr.json @@ -143,6 +143,19 @@ "title": "Paramètres du Serveur LightRAG" }, "legend": "Légende", + "nodeTypes": { + "person": "Personne", + "category": "Catégorie", + "geo": "Géographique", + "location": "Emplacement", + "organization": "Organisation", + "event": "Événement", + "equipment": "Équipement", + "weapon": "Arme", + "animal": "Animal", + "unknown": "Inconnu", + "technology": "Technologie" + }, "sideBar": { "settings": { "settings": "Paramètres", diff --git a/lightrag_webui/src/locales/zh.json b/lightrag_webui/src/locales/zh.json index 931fb659..c75b129e 100644 --- a/lightrag_webui/src/locales/zh.json +++ b/lightrag_webui/src/locales/zh.json @@ -143,6 +143,19 @@ "title": "LightRAG 服务器设置" }, "legend": "图例", + "nodeTypes": { + "person": "人物", + "category": "类别", + "geo": "地理名称", + "location": "位置", + "organization": "组织机构", + "event": "事件", + "equipment": "装备", + "weapon": "武器", + "animal": "动物", + "unknown": "未知", + "technology": "技术" + }, "sideBar": { "settings": { "settings": "设置",