Detects the language of text within a request.
HTTP request
POST https://translation.googleapis.com/language/translate/v2/detect
The URL uses Google API HTTP annotation syntax.
Query parameters
Parameters | |
---|---|
q |
Required The input text upon which to perform language detection. Repeat this parameter to perform language detection on multiple text inputs. |
key |
A valid API key to handle requests for this API. If you are using OAuth 2.0 service account credentials (recommended), do not supply this parameter. |
Response body
If successful, the response body contains data with the following structure:
JSON representation | |
---|---|
{
"data": {
object( |
Fields | |
---|---|
data |
The list of language detection responses. This list will contain a language detection response for each query (q) sent in the language detection request. |
Authorization
Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/cloud-translation
https://www.googleapis.com/auth/cloud-platform
For more information, see the Auth Guide.
DetectLanguageResponseList
A response list contains a list of separate language detection responses.
JSON representation | |
---|---|
{ "detections": [ array ], } |
Fields | |
---|---|
detections[] |
Language detection results for each input text piece. The detections ListValue includes the following values:
We recommend not basing any decisions or thresholds on the
For example: "detections": [ [{ "language": "en", "isReliable": false, "confidence": 0.9882 }], [{ "language": "pl", "isReliable": false, "confidence": 0.5683 }] ] |