fix: Bug when the source language is English

This commit is contained in:
Vincent Young 2023-02-18 20:14:02 +08:00
parent 7f0919c4c9
commit 0532327aed

14
main.go
View File

@ -21,9 +21,9 @@ type Lang struct {
} }
type CommonJobParams struct { type CommonJobParams struct {
WasSpoken bool `json:"wasSpoken"` WasSpoken bool `json:"wasSpoken"`
TranscribeAS string `json:"transcribe_as"` TranscribeAS string `json:"transcribe_as"`
RegionalVariant string `json:"regionalVariant"` // RegionalVariant string `json:"regionalVariant"`
} }
type Params struct { type Params struct {
@ -57,9 +57,9 @@ func init_data(source_lang string, target_lang string) *PostData {
TargetLang: target_lang, TargetLang: target_lang,
}, },
CommonJobParams: CommonJobParams{ CommonJobParams: CommonJobParams{
WasSpoken: false, WasSpoken: false,
TranscribeAS: "", TranscribeAS: "",
RegionalVariant: "en-US", // RegionalVariant: "en-US",
}, },
}, },
} }
@ -131,7 +131,7 @@ func main() {
post_data := init_data(source_lang, target_lang) post_data := init_data(source_lang, target_lang)
text := Text{ text := Text{
Text: translate_text, Text: translate_text,
RequestAlternatives: 0, RequestAlternatives: 3,
} }
// set id // set id
post_data.ID = id post_data.ID = id