Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Refactor: Translate figure 'Fig.' to Chinese (#18852)

Wang Qi968380c2a142
diff --git a/web/src/components/markdown-content/index.tsx b/web/src/components/markdown-content/index.tsx
index 1b486a6b17..408e6abc44 100644
--- a/web/src/components/markdown-content/index.tsx
+++ b/web/src/components/markdown-content/index.tsx
@@ -321,7 +321,7 @@ const MarkdownContent = ({
<HoverCard key={i}>
<HoverCardTrigger>
<bdi className="text-text-secondary bg-bg-card rounded-2xl px-1 mx-1 text-nowrap inline-block">
- Fig. {chunkIndex + 1}
+ {t('common.figure')} {chunkIndex + 1}
</bdi>
</HoverCardTrigger>
<HoverCardContent className="max-w-3xl">
@@ -333,7 +333,7 @@ const MarkdownContent = ({
return replacedText;
},
- [getPopoverContent],
+ [getPopoverContent, t],
);
const dir = getDirAttribute(content.replace(citationMarkerReg, ''));
diff --git a/web/src/components/next-markdown-content/index.tsx b/web/src/components/next-markdown-content/index.tsx
index 8ca02a0808..68a5b5304f 100644
--- a/web/src/components/next-markdown-content/index.tsx
+++ b/web/src/components/next-markdown-content/index.tsx
@@ -370,7 +370,7 @@ function MarkdownContent({
<HoverCard key={i}>
<HoverCardTrigger>
<bdi className="text-text-secondary bg-bg-card rounded-2xl px-1 mx-1 text-nowrap inline-block">
- Fig. {chunkIndex + 1}
+ {t('common.figure')} {chunkIndex + 1}
</bdi>
</HoverCardTrigger>
<HoverCardContent className="max-w-3xl">
@@ -382,7 +382,7 @@ function MarkdownContent({
return replacedText;
},
- [renderPopoverContent],
+ [renderPopoverContent, t],
);
const dir = getDirAttribute(content.replace(citationMarkerReg, ''));
diff --git a/web/src/components/next-message-item/reference-image-list.tsx b/web/src/components/next-message-item/reference-image-list.tsx
index 29157d0f5c..0c5dacc8a0 100644
--- a/web/src/components/next-message-item/reference-image-list.tsx
+++ b/web/src/components/next-message-item/reference-image-list.tsx
@@ -26,6 +26,7 @@ import { IReferenceChunk } from '@/interfaces/database/chat';
import { isPlainObject } from 'lodash';
import { RotateCw, ZoomIn, ZoomOut } from 'lucide-react';
import { useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
import { PhotoProvider, PhotoView } from 'react-photo-view';
import { extractNumbersFromMessageContent } from './utils';
@@ -52,13 +53,14 @@ const getButtonVisibilityClass = (imageCount: number) => {
function ImagePhotoView({ id, index }: ImageItem) {
const src = useDocumentImageUrl(id);
+ const { t } = useTranslation();
return (
<PhotoView src={src}>
<Image
id={id}
className="h-40 w-full"
- label={`Fig. ${(index + 1).toString()}`}
+ label={`${t('common.figure')} ${(index + 1).toString()}`}
/>
</PhotoView>
);
diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts
index c12633c0b4..f8ecfee013 100644
--- a/web/src/locales/en.ts
+++ b/web/src/locales/en.ts
@@ -54,6 +54,7 @@ export default {
viewLess: 'View less',
comingSoon: 'Coming soon',
download: 'Download',
+ figure: 'Fig.',
close: 'Close',
preview: 'Preview',
move: 'Move',
diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts
index 027f445b95..77e701979f 100644
--- a/web/src/locales/zh.ts
+++ b/web/src/locales/zh.ts
@@ -43,6 +43,7 @@ export default {
viewLess: '收起',
comingSoon: '即将推出',
download: '下载',
+ figure: '图',
close: '关闭',
preview: '预览',
move: '移动',
diff --git a/web/src/pages/next-search/markdown-content/index.tsx b/web/src/pages/next-search/markdown-content/index.tsx
index 4671ef2cbc..fc8e0956d3 100644
--- a/web/src/pages/next-search/markdown-content/index.tsx
+++ b/web/src/pages/next-search/markdown-content/index.tsx
@@ -254,7 +254,7 @@ const MarkdownContent = ({
<Popover>
<PopoverTrigger>
<span className="text-text-secondary bg-bg-card rounded-2xl px-1 mx-1 text-nowrap">
- Fig. {chunkIndex + 1}
+ {t('common.figure')} {chunkIndex + 1}
</span>
</PopoverTrigger>
<PopoverContent className="!w-fit">
@@ -266,7 +266,7 @@ const MarkdownContent = ({
return replacedText;
},
- [getPopoverContent],
+ [getPopoverContent, t],
);
const dir = getDirAttribute(content.replace(citationMarkerReg, ''));