
First blank: speech_recognition_language
Second blank: add_target_language
speech_translation_config = speechsdk.translation.SpeechTranslationConfig(
subscription=os.environ.get( ' SPEECH_KEY ' ),
region=os.environ.get( ' SPEECH_REGION ' )
)
# Source (recognition) language: English (US)
speech_translation_config.speech_recognition_language = " en-US "
# Target translation language: Italian
speech_translation_config.add_target_language( " it " )
audio_config = speechsdk.audio.AudioConfig(use_default_microphone= True )
recognizer = speechsdk.translation.TranslationRecognizer(
translation_config=speech_translation_config,
audio_config=audio_config
)
Comprehensive Detailed Explanation along with All References available from Microsoft Azure AI Solution at the end of the explanation
To translate speech, configure a SpeechTranslationConfig with (1) the recognition language of the input audio and (2) one or more target languages for translation. In Python, you set the input language with the speech_recognition_language property (e.g., " en-US " ), and you add a target with add_target_language( " < locale > " ) (e.g., " it " for Italian). This exactly matches the SDK guidance and examples for speech translation. Microsoft Learn
speech_recognition_language specifies the locale used by the recognizer to understand the spoken input.
add_target_language( " it " ) adds Italian as a translation output language.
Microsoft References
How to translate speech with the Speech SDK (Python examples show translation_config.speech_recognition_language = from_language and translation_config.add_target_language(...) ). Microsoft Learn
SpeechTranslationConfig (Python) reference — add_target_language(language: str) . Microsoft Lea rn
Recognize speech (property usage for speech_recognition_language ). Microsoft Learn
Language support for Speech service (locales and codes for recognition/translation)
Submit