Skip to content

Commit

Permalink
Vietnamese language support on web (infiniflow#3549)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

_Briefly describe what this PR aims to solve. Include background context
that will help reviewers understand the purpose of the PR._

### Type of change

- [X] New Feature (non-breaking change which adds functionality)
  • Loading branch information
isthaison authored Nov 21, 2024
1 parent ee50f78 commit cc5960b
Show file tree
Hide file tree
Showing 10 changed files with 1,064 additions and 4 deletions.
2 changes: 2 additions & 0 deletions web/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import { App, ConfigProvider, ConfigProviderProps } from 'antd';
import enUS from 'antd/locale/en_US';
import vi_VN from 'antd/locale/vi_VN';
import zhCN from 'antd/locale/zh_CN';
import zh_HK from 'antd/locale/zh_HK';
import dayjs from 'dayjs';
Expand All @@ -27,6 +28,7 @@ const AntLanguageMap = {
en: enUS,
zh: zhCN,
'zh-TRADITIONAL': zh_HK,
vi: vi_VN,
};

const queryClient = new QueryClient();
Expand Down
3 changes: 3 additions & 0 deletions web/src/constants/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const LanguageList = [
'Traditional Chinese',
'Indonesia',
'Spanish',
'Vietnamese',
];

export const LanguageMap = {
Expand All @@ -53,6 +54,7 @@ export const LanguageMap = {
'Traditional Chinese': '繁體中文',
Indonesia: 'Indonesia',
Spanish: 'Español',
Vietnamese: 'Tiếng việt',
};

export const LanguageTranslationMap = {
Expand All @@ -61,6 +63,7 @@ export const LanguageTranslationMap = {
'Traditional Chinese': 'zh-TRADITIONAL',
Indonesia: 'id',
Spanish: 'es',
Vietnamese: 'vi',
};

export const FileMimeTypeMap = {
Expand Down
5 changes: 4 additions & 1 deletion web/src/locales/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ import { initReactI18next } from 'react-i18next';
import translation_en from './en';
import translation_es from './es';
import translation_id from './id';
import translation_vi from './vi';
import translation_zh from './zh';
import translation_zh_traditional from './zh-traditional';

const resources = {
en: translation_en,
zh: translation_zh,
'zh-TRADITIONAL': translation_zh_traditional,
id: translation_id,
es: translation_es,
vi: translation_vi,
};

i18n
Expand All @@ -22,7 +25,7 @@ i18n
detection: {
lookupLocalStorage: 'lng',
},
supportedLngs: ['en', 'zh', 'zh-TRADITIONAL', 'id', 'es'],
supportedLngs: ['en', 'zh', 'zh-TRADITIONAL', 'id', 'es', 'vi'],
resources,
fallbackLng: 'en',
interpolation: {
Expand Down
1 change: 1 addition & 0 deletions web/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ The above is the content you need to summarize.`,
multiTurnTip:
'In multi-round conversations, the query to the knowledge base is optimized. The large model will be called to consume additional tokens.',
howUseId: 'How to use chat ID?',
description: 'Description of assistant',
},
setting: {
profile: 'Profile',
Expand Down
1,046 changes: 1,046 additions & 0 deletions web/src/locales/vi.ts

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions web/src/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ export default {
multiTurnTip:
'在多轮对话的中,对去知识库查询的问题进行优化。会调用大模型额外消耗token。',
howUseId: '如何使用聊天ID?',
description: '助理描述',
},
setting: {
profile: '概要',
Expand Down
4 changes: 2 additions & 2 deletions web/src/pages/404.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ const NoFoundPage = () => {
<Result
status="404"
title="404"
subTitle="页面未找到,请输入正确的地址。"
subTitle="Page not found, please enter a correct address."
extra={
<Button type="primary" onClick={() => history.push('/')}>
返回主页
Business
</Button>
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ const AssistantSetting = ({ show, form }: ISegmentedContentProps) => {
>
<Input placeholder={t('namePlaceholder')} />
</Form.Item>
<Form.Item name={'description'} label={t('description')}>
<Input placeholder={t('descriptionPlaceholder')} />
</Form.Item>
<Form.Item
name="icon"
label={t('assistantAvatar')}
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/login/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const Login = () => {

if (title === 'login') {
const code = await login({
email: params.email,
email: `${params.email}`.trim(),
password: rsaPassWord,
});
if (code === 0) {
Expand Down
1 change: 1 addition & 0 deletions web/src/pages/user-setting/setting-system/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const IconMap = {
es: 'es',
doc_store: 'storage',
redis: 'redis',
storage: 'minio',
database: 'database',
};

Expand Down

0 comments on commit cc5960b

Please sign in to comment.