Translates the text you paste in into the languages you list and emails you each one spoken as an audio file.
UsesElevenLabs
Gmail
Google Translate
Say your words in another language
Paste in what you want to say and list the languages you want it in, then run it. Each language is translated in turn, the translation is spoken by an ElevenLabs voice, and you are emailed one message per language with the translated text to read and the spoken version attached as an audio file you can play or hand on.
You end up with one email per language, each stating which language was asked for and which language your original was read as, and carrying both the translation and your original text so anything the voice says can be checked against the words it was given. The audio is always spoken from the translation, never from your original: a language that comes back untranslated is skipped and counted rather than read out in the wrong language. If no audio file is produced, no email goes out for that language, so you never get a message promising an attachment that is not there. One language failing does not stop the rest.
sourceText to blank.Set sourceText to blank.targetLanguages to blank.Set targetLanguages to blank.voiceId to blank.Set voiceId to blank.sendTo to blank.Set sendTo to blank.maxLanguages to 5.Set maxLanguages to 5.sourceText and save it as scriptText.Trim sourceText and save it as scriptText.sendTo and save it as recipient.Trim sendTo and save it as recipient.recipient is a valid email addressIf not recipient is a valid email addressspokenCount to 0.Set spokenCount to 0.failedCount to 0.Set failedCount to 0.skippedNoTranslation to 0.Set skippedNoTranslation to 0.skippedNoAudio to 0.Set skippedNoAudio to 0.language in targetLanguages split by ,:For each language in targetLanguages split by ,:language and save it as languageCode.Trim language and save it as languageCode.languageCode is empty or languageCode is nullIf languageCode is empty or languageCode is nullspokenCount is greater than or equal to maxLanguages multiplied by 1If spokenCount is greater than or equal to maxLanguages multiplied by 1languageErrorIf a step below fails, save the error as languageErrorscriptText into languageCode. Save it as translation.Translate scriptText into languageCode. Save it as translation.translation.translated_text and save it as spokenScript.Trim translation.translated_text and save it as spokenScript.spokenScript is empty or spokenScript is nullIf spokenScript is empty or spokenScript is nullskippedNoTranslation.Add 1 to skippedNoTranslation.voiceId. Save it as speech.Convert text to speech with voice voiceId. Save it as speech.spokenScriptspeech.document_ref and save it as audioRef.Trim speech.document_ref and save it as audioRef.audioRef is empty or audioRef is nullIf audioRef is empty or audioRef is nullskippedNoAudio.Add 1 to skippedNoAudio.translation.detected_source_language and save it as detected.Trim translation.detected_source_language and save it as detected.detected is null or detected is emptyIf detected is null or detected is emptydetected to not reported.Change detected to not reported.messageBody to Language asked for: languageCodeSet messageBody to Language asked for: languageCode
Language the original was read as: detected.messageBody to messageBodyChange messageBody to messageBody
The attached audio speaks this text:
spokenScript.messageBody to messageBodyChange messageBody to messageBody
The text it was translated from:
scriptText.sendTo.Send an email to sendTo.
Subject: Spoken translation (languageCode)messageBodyspokenCount.Add 1 to spokenCount.failedCount.Add 1 to failedCount.languageCode: languageError as text.Show in the output: Could not produce audio for languageCode: languageError as text.spokenCount is 0If spokenCount is 0summary to Languages spoken and emailed: spokenCount as text.Set summary to Languages spoken and emailed: spokenCount as text.summary to summary. Skipped, nothing came back to translate: skippedNoTranslation as text.Change summary to summary. Skipped, nothing came back to translate: skippedNoTranslation as text.summary to summary. Skipped, no audio file was produced: skippedNoAudio as text.Change summary to summary. Skipped, no audio file was produced: skippedNoAudio as text.summary to summary. Failed outright: failedCount as text.Change summary to summary. Failed outright: failedCount as text.summary.Show in the output: summary.