mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-23 18:47:15 +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';
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user