如何更改 Google 语音识别的语言

How to change the language of Google speech recognition

我的代码:

with sr.Microphone() as source:
    audio = r.listen(source)
    try:
        print("You said: " + r.recognize_google(audio) + "in french")
    except sr.UnknownValueError:
        print("Google Speech Recognition could not understand audio")
    except sr.RequestError as e:
        print("Could not request results from Google Speech Recognition service")

我想将收听语言改为法语。我应该怎么做?

这里是the relevant line of documentataion.

尝试r.recognize_google(audio, language="fr-FR")

try:
    voise = r.recognize_google(audio, language="fr-FR")
except sr.UnknownValueError:
    speak('understand')
return voise