Skip to content

Commit

Permalink
Vietnamese language support on web
Browse files Browse the repository at this point in the history
  • Loading branch information
isthaison committed Nov 20, 2024
1 parent c55231b commit 1521fa2
Show file tree
Hide file tree
Showing 5 changed files with 1,056 additions and 3 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
Loading

0 comments on commit 1521fa2

Please sign in to comment.