diff --git a/public/scripts/extensions/tts/index.js b/public/scripts/extensions/tts/index.js index 582474dab..97e133900 100644 --- a/public/scripts/extensions/tts/index.js +++ b/public/scripts/extensions/tts/index.js @@ -130,7 +130,7 @@ async function onTtsVoicesClick() { const voiceIds = await ttsProvider.fetchTtsVoiceIds() for (const voice of voiceIds) { - popupText += `
${voice.name}
` + popupText += `
${voice.lang || ''} ${voice.name}
` popupText += `` } } catch { diff --git a/public/scripts/extensions/tts/style.css b/public/scripts/extensions/tts/style.css index 35bb63131..3785f0b04 100644 --- a/public/scripts/extensions/tts/style.css +++ b/public/scripts/extensions/tts/style.css @@ -25,4 +25,19 @@ display: flex; justify-content: space-between; align-items: center; + gap: 0.5rem; +} + +.voice_preview .voice_name { + text-align: left; + flex: 1; +} + +.voice_preview .voice_lang { + width: 4rem; + text-align: left; +} + +.voice_preview .fa-play { + cursor: pointer; } \ No newline at end of file diff --git a/public/scripts/extensions/tts/system.js b/public/scripts/extensions/tts/system.js index 043a80675..9acef12b3 100644 --- a/public/scripts/extensions/tts/system.js +++ b/public/scripts/extensions/tts/system.js @@ -84,7 +84,10 @@ class SystemTtsProvider { return []; } - return speechSynthesis.getVoices().map(x => ({ name: x.name, voice_id: x.voiceURI, preview_url: '' })); + return speechSynthesis + .getVoices() + .sort((a, b) => a.lang.localeCompare(b.lang) || a.name.localeCompare(b.name)) + .map(x => ({ name: x.name, voice_id: x.voiceURI, preview_url: '', lang: x.lang })); } previewTtsVoice(voiceId) {