How to use the gtts.gTTS.LANGUAGES function in gTTS

To help you get started, we’ve selected a few gTTS examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NaomiProject / Naomi / plugins / tts / google-tts / google.py View on Github external
def __init__(self, *args, **kwargs):
        plugin.TTSPlugin.__init__(self, *args, **kwargs)
        try:
            orig_language = self.profile['language']
        except:
            orig_language = 'en-US'

        language = orig_language.lower()

        if language not in gtts.gTTS.LANGUAGES:
            language = language.split('-')[0]

        if language not in gtts.gTTS.LANGUAGES:
            raise ValueError("Language '%s' ('%s') not supported" %
                             (language, orig_language))

        self.language = language
github pndurette / gTTS / bin / gtts-cli.py View on Github external
def languages():
    """Sorted pretty printed string of supported languages"""
    return ", ".join(sorted("{}: '{}'".format(gTTS.LANGUAGES[k], k) for k in gTTS.LANGUAGES))
github grigi / talkey / talkey / engines / google.py View on Github external
def _get_languages(self):
        voices = gtts.gTTS.LANGUAGES.keys()
        langs = {}
        for voice in voices:
            lang = voice[:2]
            langs.setdefault(lang, {'default': voice, 'voices': {}})
            langs[lang]['voices'][voice] = {}
        return langs
github joaoricardo000 / whatsapp-bot-seed / src / utils / media_sender.py View on Github external
def send(self, jid, text, lang=None):
        if not (lang and lang in gTTS.LANGUAGES):
            lang = "en"
        try:
            file_path = self.tts_record(text, lang)
            self.send_by_path(jid, file_path)
        except Exception as e:
            logging.exception(e)
            self._on_error(jid)