yangdx commited on
Commit
4d610b4
·
1 Parent(s): a53ee46

Add fallback support for translation missing

Browse files
lightrag_webui/src/components/graph/Legend.tsx CHANGED
@@ -4,23 +4,6 @@ import { useGraphStore } from '@/stores/graph'
4
  import { Card } from '@/components/ui/Card'
5
  import { ScrollArea } from '@/components/ui/ScrollArea'
6
 
7
- // Predefined node types list
8
- const PREDEFINED_TYPES = [
9
- 'person',
10
- 'category',
11
- 'geo',
12
- 'location',
13
- 'organization',
14
- 'event',
15
- 'equipment',
16
- 'weapon',
17
- 'animal',
18
- 'unknown',
19
- 'object',
20
- 'group',
21
- 'technology',
22
- ]
23
-
24
  interface LegendProps {
25
  className?: string
26
  }
@@ -45,9 +28,7 @@ const Legend: React.FC<LegendProps> = ({ className }) => {
45
  style={{ backgroundColor: color }}
46
  />
47
  <span className="text-xs truncate" title={type}>
48
- {PREDEFINED_TYPES.includes(type.toLowerCase())
49
- ? t(`graphPanel.nodeTypes.${type.toLowerCase()}`)
50
- : type}
51
  </span>
52
  </div>
53
  ))}
 
4
  import { Card } from '@/components/ui/Card'
5
  import { ScrollArea } from '@/components/ui/ScrollArea'
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  interface LegendProps {
8
  className?: string
9
  }
 
28
  style={{ backgroundColor: color }}
29
  />
30
  <span className="text-xs truncate" title={type}>
31
+ {t(`graphPanel.nodeTypes.${type.toLowerCase()}`, type)}
 
 
32
  </span>
33
  </div>
34
  ))}
lightrag_webui/src/i18n.ts CHANGED
@@ -29,11 +29,14 @@ i18n
29
  fr: { translation: fr },
30
  ar: { translation: ar }
31
  },
32
- lng: getStoredLanguage(), // 使用存储的语言设置
33
  fallbackLng: 'en',
34
  interpolation: {
35
  escapeValue: false
36
- }
 
 
 
37
  })
38
 
39
  // Subscribe to language changes
 
29
  fr: { translation: fr },
30
  ar: { translation: ar }
31
  },
32
+ lng: getStoredLanguage(), // Use stored language settings
33
  fallbackLng: 'en',
34
  interpolation: {
35
  escapeValue: false
36
+ },
37
+ // Configuration to handle missing translations
38
+ returnEmptyString: false,
39
+ returnNull: false,
40
  })
41
 
42
  // Subscribe to language changes