diff --git a/web/app/components/app/configuration/features/chat-group/text-to-speech/index.tsx b/web/app/components/app/configuration/features/chat-group/text-to-speech/index.tsx index 24d3e0e64a..596122e57d 100644 --- a/web/app/components/app/configuration/features/chat-group/text-to-speech/index.tsx +++ b/web/app/components/app/configuration/features/chat-group/text-to-speech/index.tsx @@ -9,6 +9,7 @@ import { Speaker } from '@/app/components/base/icons/src/vender/solid/mediaAndDe import ConfigContext from '@/context/debug-configuration' import { languages } from '@/utils/language' import { fetchAppVoices } from '@/service/apps' +import AudioBtn from '@/app/components/base/audio-btn' const TextToSpeech: FC = () => { const { t } = useTranslation() @@ -20,19 +21,28 @@ const TextToSpeech: FC = () => { const matched = pathname.match(/\/app\/([^/]+)/) const appId = (matched?.length && matched[1]) ? matched[1] : '' const language = textToSpeechConfig.language + const languageInfo = languages.find(i => i.value === textToSpeechConfig.language) + const voiceItems = useSWR({ appId, language }, fetchAppVoices).data const voiceItem = voiceItems?.find(item => item.value === textToSpeechConfig.voice) + return ( +
{t('appDebug.feature.textToSpeech.title')}
} headerIcon={} headerRight={ -
- {languages.find(i => i.value === textToSpeechConfig.language)?.name} - {voiceItem?.name ?? t('appDebug.voice.defaultDisplay')} +
+ {languageInfo && (`${languageInfo?.name} - `)}{voiceItem?.name ?? t('appDebug.voice.defaultDisplay')} + { languageInfo?.example && ( + + )}
} noBodySpacing diff --git a/web/app/components/base/audio-btn/index.tsx b/web/app/components/base/audio-btn/index.tsx index eaaca72594..c10755d3a1 100644 --- a/web/app/components/base/audio-btn/index.tsx +++ b/web/app/components/base/audio-btn/index.tsx @@ -10,11 +10,13 @@ import { textToAudio } from '@/service/share' type AudioBtnProps = { value: string className?: string + isAudition?: boolean } const AudioBtn = ({ value, className, + isAudition, }: AudioBtnProps) => { const audioRef = useRef(null) const [isPlaying, setIsPlaying] = useState(false) @@ -97,10 +99,10 @@ const AudioBtn = ({ className='z-10' >
-
+
diff --git a/web/i18n/lang/common.en.ts b/web/i18n/lang/common.en.ts index 8001bbd276..e40a37b256 100644 --- a/web/i18n/lang/common.en.ts +++ b/web/i18n/lang/common.en.ts @@ -53,6 +53,7 @@ const translation = { koKR: 'Korean', ptBR: 'Portuguese', ruRU: 'Russian', + ukUA: 'Ukrainian', }, }, unit: { diff --git a/web/i18n/lang/common.pt.ts b/web/i18n/lang/common.pt.ts index 8566331df8..0c5fef090c 100644 --- a/web/i18n/lang/common.pt.ts +++ b/web/i18n/lang/common.pt.ts @@ -22,6 +22,7 @@ const translation = { itIT: 'italiano', thTH: 'tailandês', idID: 'indonésio', + ukUA: 'ucraniana', }, }, provider: { diff --git a/web/i18n/lang/common.zh.ts b/web/i18n/lang/common.zh.ts index c0d6d40e57..04f331cf89 100644 --- a/web/i18n/lang/common.zh.ts +++ b/web/i18n/lang/common.zh.ts @@ -53,6 +53,7 @@ const translation = { koKR: '韩语', ptBR: '葡萄牙语', ruRU: '俄语', + ukUA: '乌克兰语', }, }, unit: { diff --git a/web/utils/language.ts b/web/utils/language.ts index b241b72248..7488229280 100644 --- a/web/utils/language.ts +++ b/web/utils/language.ts @@ -1,6 +1,7 @@ export type Item = { value: number | string name: string + example: string } export const LanguagesSupported = ['en-US', 'zh-Hans', 'pt-BR', 'es-ES', 'fr-FR', 'de-DE', 'ja-JP', 'ko-KR', 'ru-RU', 'it-IT', 'th-TH', 'id-ID', 'uk-UA'] @@ -10,54 +11,67 @@ export const languages = [ { value: 'en-US', name: 'English(United States)', + example: 'Hello, Dify!', }, { value: 'zh-Hans', name: '简体中文', + example: '你好,Dify!', }, { value: 'pt-BR', name: 'Português(Brasil)', + example: 'Olá, Dify!', }, { value: 'es-ES', name: 'Español(España)', + example: 'Saluton, Dify!', }, { value: 'fr-FR', name: 'Français(France)', + example: 'Bonjour, Dify!', }, { value: 'de-DE', name: 'Deutsch(Deutschland)', + example: 'Hallo, Dify!', }, { value: 'ja-JP', name: '日本語(日本)', + example: 'こんにちは、Dify!', }, { value: 'ko-KR', name: '한국어(대한민국)', + example: '안녕, Dify!', }, { value: 'ru-RU', name: 'Русский(Россия)', + example: ' Привет, Dify!', }, { value: 'it-IT', name: 'Italiano(Italia)', + example: 'Ciao, Dify!', }, { value: 'th-TH', name: 'ไทย(ประเทศไทย)', + example: 'สวัสดี Dify!', }, { value: 'id-ID', name: 'Bahasa Indonesia', + example: 'Saluto, Dify!', }, { value: 'uk-UA', name: 'Українська(Україна)', + example: 'Привет, Dify!', }, ]