From 0732419c33519c3214f1b0eeb94c2b754fc1cb1c Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 13 Dec 2021 15:49:28 +0000 Subject: [PATCH] Tidying --- desktop_client.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/desktop_client.py b/desktop_client.py index 054f8b835..915cdfe31 100644 --- a/desktop_client.py +++ b/desktop_client.py @@ -324,15 +324,16 @@ def _speakerPicospeaker(pitch: int, rate: int, systemLanguage: str, """TTS using picospeaker """ speakerLang = 'en-GB' - if systemLanguage: - if systemLanguage.startswith('fr'): - speakerLang = 'fr-FR' - elif systemLanguage.startswith('es'): - speakerLang = 'es-ES' - elif systemLanguage.startswith('de'): - speakerLang = 'de-DE' - elif systemLanguage.startswith('it'): - speakerLang = 'it-IT' + supportedLanguages = { + "fr": "fr-FR", + "es": "es-ES", + "de": "de-DE", + "it": "it-IT" + } + for lang, speakerStr in supportedLanguages.items(): + if systemLanguage.startswith(lang): + speakerLang = speakerStr + break sayText = str(sayText).replace('"', "'") speakerCmd = 'picospeaker ' + \ '-l ' + speakerLang + \