@@ -50,24 +50,33 @@ class VoiceConfig {
5050
5151/// Configures speech synthesis settings.
5252///
53- /// Allows specifying the desired voice for speech synthesis.
53+ /// Allows specifying the desired voice and language for speech synthesis.
5454class SpeechConfig {
5555 /// Creates a [SpeechConfig] instance.
5656 ///
5757 /// [voiceName] See https://cloud.google.com/text-to-speech/docs/chirp3-hd
5858 /// for names and sound demos.
59- SpeechConfig ({String ? voiceName})
59+ ///
60+ /// [languageCode] The language code (BCP-47) for the speech synthesis,
61+ /// e.g. "en-US", "fr-FR", "de-DE".
62+ SpeechConfig ({String ? voiceName, this .languageCode})
6063 : voiceConfig = voiceName != null
6164 ? VoiceConfig (
6265 prebuiltVoiceConfig: PrebuiltVoiceConfig (voiceName: voiceName))
6366 : null ;
6467
6568 /// The voice config to use for speech synthesis.
6669 final VoiceConfig ? voiceConfig;
70+
71+ /// The language code (BCP-47) for speech synthesis,
72+ /// e.g. "en-US", "fr-FR", "de-DE".
73+ final String ? languageCode;
6774 // ignore: public_member_api_docs
6875 Map <String , Object ?> toJson () => {
6976 if (voiceConfig case final voiceConfig? )
70- 'voice_config' : voiceConfig.toJson ()
77+ 'voice_config' : voiceConfig.toJson (),
78+ if (languageCode case final languageCode? )
79+ 'language_code' : languageCode,
7180 };
7281}
7382
0 commit comments