diff --git a/src/components/Settings/Speech/Speech.component.js b/src/components/Settings/Speech/Speech.component.js index 1c6d99a4c..0e2e74a52 100644 --- a/src/components/Settings/Speech/Speech.component.js +++ b/src/components/Settings/Speech/Speech.component.js @@ -50,13 +50,16 @@ const styles = theme => ({ }); const getVoiceLabel = voice => { + const isSerbianVoice = voice.lang?.startsWith('sr'); if (!voice) { return undefined; } if (voice.name === 'srpski Crna Gora') { return voice.voiceURI; } - return isCordova() ? voice.name + ' - ' + voice.voiceURI : voice.name; + return isCordova() && !isSerbianVoice + ? voice.name + ' - ' + voice.voiceURI + : voice.name; }; const Speech = ({ diff --git a/src/providers/SpeechProvider/SpeechProvider.actions.js b/src/providers/SpeechProvider/SpeechProvider.actions.js index 403a5f2c6..3c8666a52 100644 --- a/src/providers/SpeechProvider/SpeechProvider.actions.js +++ b/src/providers/SpeechProvider/SpeechProvider.actions.js @@ -160,6 +160,18 @@ export function getVoices() { let voices = []; dispatch(requestVoices()); try { + const localizeSerbianVoicesNames = (voiceName, voiceLang) => { + if (voiceLang?.startsWith('sr')) { + const getNativeNameOfDialect = lang => { + if (lang === 'sr-ME') return 'Crnogorski jezik'; + if (lang === 'sr-SP') return 'Српски језик'; + if (lang === 'sr-RS') return 'Srpski jezik'; + }; + return `${voiceName} - ${getNativeNameOfDialect(voiceLang)}`; + } + return voiceName; + }; + const pvoices = await tts.getVoices(); // some TTS engines do return invalid voices, so we filter them const regex = new RegExp('^[a-zA-Z]{2,}-$', 'g'); @@ -184,6 +196,7 @@ export function getVoices() { } else if (DisplayName) { voice.name = `${DisplayName} (${voice.lang}) - ${Gender}`; } + voice.name = localizeSerbianVoicesNames(voice.name, voice.lang); return voice; } );