mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-09 20:50:58 +00:00
chore: add more language supports
This commit is contained in:
@@ -27,6 +27,9 @@ export const extractI18nObject = (i18nObject: I18nObject): string => {
|
||||
if (language === 'zh_Hans' && i18nObject.zh_Hans) return i18nObject.zh_Hans;
|
||||
if (language === 'zh_Hant' && i18nObject.zh_Hant) return i18nObject.zh_Hant;
|
||||
if (language === 'ja_JP' && i18nObject.ja_JP) return i18nObject.ja_JP;
|
||||
if (language === 'th_TH' && i18nObject.th_TH) return i18nObject.th_TH;
|
||||
if (language === 'vi_VN' && i18nObject.vi_VN) return i18nObject.vi_VN;
|
||||
if (language === 'es_ES' && i18nObject.es_ES) return i18nObject.es_ES;
|
||||
return (
|
||||
i18nObject.en_US ||
|
||||
i18nObject.zh_Hans ||
|
||||
@@ -49,6 +52,12 @@ export const getAPILanguageCode = (): string => {
|
||||
if (language === 'en-US') return 'en';
|
||||
// ja-JP -> ja_JP
|
||||
if (language === 'ja-JP') return 'ja_JP';
|
||||
// th-TH -> th_TH
|
||||
if (language === 'th-TH') return 'th_TH';
|
||||
// vi-VN -> vi_VN
|
||||
if (language === 'vi-VN') return 'vi_VN';
|
||||
// es-ES -> es_ES
|
||||
if (language === 'es-ES') return 'es_ES';
|
||||
// 默认返回 en
|
||||
return 'en';
|
||||
};
|
||||
|
||||
@@ -8,6 +8,9 @@ import enUS from './locales/en-US';
|
||||
import zhHans from './locales/zh-Hans';
|
||||
import zhHant from './locales/zh-Hant';
|
||||
import jaJP from './locales/ja-JP';
|
||||
import thTH from './locales/th-TH';
|
||||
import viVN from './locales/vi-VN';
|
||||
import esES from './locales/es-ES';
|
||||
|
||||
i18n
|
||||
.use(LanguageDetector)
|
||||
@@ -26,6 +29,15 @@ i18n
|
||||
'ja-JP': {
|
||||
translation: jaJP,
|
||||
},
|
||||
'th-TH': {
|
||||
translation: thTH,
|
||||
},
|
||||
'vi-VN': {
|
||||
translation: viVN,
|
||||
},
|
||||
'es-ES': {
|
||||
translation: esES,
|
||||
},
|
||||
},
|
||||
fallbackLng: 'zh-Hans',
|
||||
debug: process.env.NODE_ENV === 'development',
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user