Translator Speech API: Languages

Note

The new Speech Service and SDK is replacing the Translator Speech API, which will no longer work starting October 15, 2019. For information on switching to the Speech Service, see Migrating from the Translator Speech API to the Speech Service.

Translator Speech continually extends the list of languages supported by its services. Use this API to discover the set of languages currently available for use with the Translator Speech service.

Code samples demonstrating use of the API to get available languages are available from the Microsoft Translator GitHub site.

Implementation notes

GET /languages

A wide set of languages is available to transcribe speech, to translate the transcribed text, and to produce synthesized speech of the translation.

A client uses the scope query parameter to define which sets of languages it is interested in.

  • Speech-to-text: Use query parameter scope=speech to retrieve the set of languages available to transcribe speech into text.
  • Text translation: Use query parameter scope=text to retrieve the set of languages available to translate transcribed text.
  • Text-to-speech: Use query parameter scope=tts to retrieve the set of languages and voices available to synthesize translated text back into speech.

A client can retrieve multiple sets simultaneously by specifying a comma-separated list of choices. For example, scope=speech,text,tts.

A successful response is a JSON object with a property for each requested set.

{
    "speech": {
        //... Set of languages supported for speech-to-text
    },
    "text": {
        //... Set of languages supported for text translation
    },
    "tts": {
        //... Set of languages supported for text-to-speech
    }
}

Since a client can use the scope query parameter to select which sets of supported languages should be returned, an actual response may only include a subset of all properties shown above.

The value provided with each property is as follows.

Speech-to-text (speech)

The value associated with the speech-to-text property, speech, is a dictionary of (key, value) pairs. Each key identifies a language supported for speech-to-text. The key is the identifier that client passes to the API. The value associated with the key is an object with the following properties:

  • name: Display name of the language.
  • language: Language tag of the associated written language. See "Text transaction" below. An example is:
{
    "speech": {
        "en-US": { name: "English", language: "en" }
    }
}

Text translation (text)

The value associated with the text property is also a dictionary where each key identifies a language supported for text translation. The value associated with the key describes the language:

  • name: Display name of the language.
  • dir: Directionality which is rtl for right-to-left languages or ltr for left-to-right languages.

An example is:

{
    "text": {
        "en": { name: "English", dir: "ltr" }
    }
}

Text-to-speech (tts)

The value associated with the text-to-speech property, tts, is also a dictionary where each key identifies a supported voice. Attributes of a voice object are:

  • displayName: Display name for the voice.
  • gender: Gender of the voice (male or female).
  • locale: Language tag of the voice with primary language subtag and region subtag.
  • language: Language tag of the associated written language.
  • languageName: Display name of the language.
  • regionName: Display name of the region for this language.

An example is:

{
    "tts": {
        "en-US-Zira": {
            "displayName": "Zira",
            "gender": "female",
            "locale": "en-US",
            "languageName": "English",
            "regionName": "United States",
            "language": "en"
        }
}

Localization

The service returns all names in the language of the 'Accept-Language' header, for all the languages supported in text translation.

Response class (Status 200)

Object describing the set of supported languages.

ModelExample Value:

Langagues { speech (object, optional), text (object, optional), tts (object, optional) }

Headers

Header Description Type
X-RequestId Value generated by server to identify the request and used for troubleshooting purposes. string

Parameters

Parameter Description Parameter Type Data Type
api-version Version of the API requested by the client. Allowed values are: 1.0. query string
scope Sets of supported languages or voices to return to the client. This parameter is specified as a comma-separated list of keywords. The following keywords are available:
  • speech: Provides the set of languages supported to transcribe speech.
  • tts: Provides the set of voices supported for text-speech conversion.
  • text: Provides the set of languages supported for translating text.
If a value is not specified, the value of scope defaults to text.
query string
X-ClientTraceId A client-generated GUID used to trace a request. To facilitate troubleshooting of issues, clients should provide a new value with each request and log it. header string
Accept-Language Some of the fields in the response are names of languages or regions. Use this parameter to define the language in which names are returned. The language is specified by providing a well-formed BCP 47 language tag. Select a tag from the list of language identifiers returned with the text scope. For unsupported languages, the names are provided in the English language.
For instance, use the value fr to request names in French or use the value zh-Hant to request names in Chinese Traditional.
header string

Response messages

HTTP Status Code Reason
400 Bad request. Check input parameters to ensure they are valid. The response object includes a more detailed description of the error.
429 Too many requests.
500 An error occurred. If the error persists, please report it with client trace identifier (X-ClientTraceId) or request identifier (X-RequestId).
503 Server temporarily unavailable. Please retry the request. If the error persists, please report it with client trace identifier (X-ClientTraceId) or request identifier (X-RequestId).