Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToGoogleResponseBody ¶
ToGoogleResponseBody parses the input Lingvanex response and return the JSON response body in Google format.
Types ¶
type LingvanexResponseBody ¶
type LingvanexResponseBody struct { SourceText []string `json:"sourceText"` TranslatedText []string `json:"translatedText"` }
LingvanexResponseBody represents JSON format of Lingvanex response bodies. Translations's size is limited to 1 since multiple translations is not compatible with Google. Format with auto-detect source language:
[ { "detectedLanguage": {"language": "de", "score": 1.0}, "translations": [{"text": "Hallo", "to": "en"}] }, { "detectedLanguage": {"language": "de", "score": 1.0}, "translations": [{"text": "Welt", "to": "en"}] } ]
Format without auto-detect source language:
[ { "translations": [{"text": "Hallo", "to": "en"}] }, { "translations": [{"text": "Welt", "to": "en"}] } ]
score and to are not saved in this struct because we don't need them to convert to a google format response.
Click to show internal directories.
Click to hide internal directories.