Translator - Languages
Gets the set of languages currently supported by other operations of the Translator Text API. Authentication is not required to get language resources.
Response Body
A client uses the scope
query parameter to define which groups of languages it is interested in.
scope=translation
provides languages supported to translate text from one language to another language.scope=transliteration
provides capabilities for converting text in one language from one script to another script.scope=dictionary
provides language pairs for whichDictionary
operations return data.
A client may retrieve several groups simultaneously by specifying a comma-separated list of names. For example, scope=translation,transliteration,dictionary
would return supported languages for all groups.
A successful response is a JSON object with one property for each requested group. The value for each property is as follows.
translation
property The value of thetranslation
property is a dictionary of (key, value) pairs. Each key is a BCP 47 language tag. A key identifies a language for which text can be translated to or translated from. The value associated with the key is a JSON object with properties that describe the languagename-
Display name of the language in the locale requested viaAccept-Language
header.nativeName-
Display name of the language in the locale native for this language.dir-
Directionality, which isrtl
for right-to-left languages orltr
for left-to-right languages.
{
"translation": {
...
"fr": {
"name": "French",
"nativeName": "Français",
"dir": "ltr"
},
...
}
}
transliteration
property The value of thetransliteration
property is a dictionary of (key, value) pairs. Each key is a BCP 47 language tag. A key identifies a language for which text can be converted from one script to another script. The value associated with the key is a JSON object with properties that describe the language and its supported scriptsname-
Display name of the language in the locale requested viaAccept-Language
header.nativeName-
Display name of the language in the locale native for this language.scripts-
List of scripts to convert from. Each element of thescripts
list has properties-code-
Code identifying the script.name-
Display name of the script in the locale requested viaAccept-Language
header.nativeName-
Display name of the language in the locale native for the language.dir-
Directionality, which isrtl
for right-to-left languages orltr
for left-to-right languages.toScripts-
List of scripts available to convert text to. Each element of thetoScripts
list has propertiescode
,name
,nativeName
, anddir
as described earlier.
{
"transliteration": {
...
"ja": {
"name": "Japanese",
"nativeName": "日本語",
"scripts": [
{
"code": "Jpan",
"name": "Japanese",
"nativeName": "日本語",
"dir": "ltr",
"toScripts": [
{
"code": "Latn",
"name": "Latin",
"nativeName": "ラテン語",
"dir": "ltr"
}
]
},
{
"code": "Latn",
"name": "Latin",
"nativeName": "ラテン語",
"dir": "ltr",
"toScripts": [
{
"code": "Jpan",
"name": "Japanese",
"nativeName": "日本語",
"dir": "ltr"
}
]
}
]
},
...
}
}
dictionary
property The value of thedictionary
property is a dictionary of (key, value) pairs. Each key is a BCP 47 language tag. The key identifies a language for which alternative translations and back-translations are available. The value is a JSON object that describes the source language and the target languages with available translations.name-
Display name of the source language in the locale requested viaAccept-Language
header.nativeName-
Display name of the language in the locale native for this language.dir-
Directionality, which isrtl
for right-to-left languages orltr
for left-to-right languages.translations-
List of languages with alterative translations and examples for the query expressed in the source language. Each element of thetranslations
list has propertiesname-
Display name of the target language in the locale requested viaAccept-Language
header.nativeName-
Display name of the target language in the locale native for the target language.dir-
Directionality, which isrtl
for right-to-left languages orltr
for left-to-right languages.code-
Language code identifying the target language.
"es": {
"name": "Spanish",
"nativeName": "Español",
"dir": "ltr",
"translations": [
{
"name": "English",
"nativeName": "English",
"dir": "ltr",
"code": "en"
}
]
},
The structure of the response object will not change without a change in the version of the API. For the same version of the API, the list of available languages may change over time because Microsoft Translator continually extends the list of languages supported by its services.
The list of supported languages will not change frequently. To save network bandwidth and improve responsiveness, a client application should consider caching language resources and the corresponding entity tag (ETag
). Then, the client application can periodically (for example, once every 24 hours) query the service to fetch the latest set of supported languages. Passing the current ETag
value in an If-None-Match
header field will allow the service to optimize the response. If the resource has not been modified, the service will return status code 304 and an empty response body.
Response Header
ETag - Current value of the entity tag for the requested groups of supported languages. To make subsequent requests more efficient, the client may send the ETag
value in an If-None-Match
header field.
X-RequestId - Value generated by the service to identify the request. It is used for troubleshooting purposes.
GET {Endpoint}/Languages?api-version=3.0
GET {Endpoint}/Languages?api-version=3.0&scope={scope}
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
Endpoint
|
path | True |
string |
Supported Cognitive Services endpoints |
api-version
|
query | True |
string |
Version of the API requested by the client. Value must be 3.0. |
scope
|
query |
string[] |
A comma-separated list of names defining the group of languages to return. Allowed group names are- |
Request Header
Name | Required | Type | Description |
---|---|---|---|
Accept-Language |
string |
The language to use for user interface strings. Some of the fields in the response are names of languages or names of regions. Use this parameter to define the language in which these names are returned. The language is specified by providing a well-formed BCP 47 language tag. For instance, use the value |
|
X-ClientTraceId |
string |
A client-generated GUID to uniquely identify the request. Note that you can omit this header if you include the trace ID in the query string using a query parameter named ClientTraceId. |
Responses
Name | Type | Description |
---|---|---|
200 OK |
Success |
|
Other Status Codes |
Error response. |
Security
Ocp-Apim-Subscription-Key
Type:
apiKey
In:
header
Ocp-Apim-Subscription-Key
Type:
apiKey
In:
header
Ocp-Apim-Subscription-Region
Type:
apiKey
In:
header
Examples
Languages success example
Sample request
GET https://api.cognitive.microsofttranslator.com/Languages?api-version=3.0&scope=translation
Sample response
{
"translation": {
"af": {
"name": "Afrikaan",
"nativeName": "Afrikaans",
"dir": "ltr"
},
"ar": {
"name": "Arabic",
"nativeName": "العربية",
"dir": "rtl"
},
"ja": {
"name": "Japanese",
"nativeName": "日本語",
"dir": "ltr"
},
"ko": {
"name": "Korean",
"nativeName": "한국어",
"dir": "ltr"
},
"th": {
"name": "Thai",
"nativeName": "ไทย",
"dir": "ltr"
},
"zh-Hans": {
"name": "Chinese Simplified",
"nativeName": "简体中文",
"dir": "ltr"
},
"zh-Hant": {
"name": "Chinese Traditional",
"nativeName": "繁體中文",
"dir": "ltr"
}
}
}
Definitions
Name | Description |
---|---|
Dictionary | |
Error | |
Error |
|
Language |
|
Languages |
Example of a successful languages request |
Scripts | |
To |
|
Translation | |
translation. |
|
Translations | |
Transliteration | |
transliteration. |
Dictionary
Name | Type | Description |
---|---|---|
languageCode |
Error
Name | Type | Description |
---|---|---|
code |
string |
|
message |
string |
ErrorMessage
Name | Type | Description |
---|---|---|
error |
LanguageCode
Name | Type | Description |
---|---|---|
dir |
string |
|
name |
string |
|
nativeName |
string |
|
translations |
LanguagesResult
Example of a successful languages request
Name | Type | Description |
---|---|---|
dictionary | ||
translation | ||
transliteration |
Scripts
Name | Type | Description |
---|---|---|
code |
string |
|
dir |
string |
|
name |
string |
|
nativeName |
string |
|
toScripts |
ToScripts
Name | Type | Description |
---|---|---|
code |
string |
|
dir |
string |
|
name |
string |
|
nativeName |
string |
Translation
Name | Type | Description |
---|---|---|
languageCode |
translation.LanguageCode
Name | Type | Description |
---|---|---|
dir |
string |
|
name |
string |
|
nativeName |
string |
Translations
Name | Type | Description |
---|---|---|
code |
string |
|
dir |
string |
|
name |
string |
|
nativeName |
string |
Transliteration
Name | Type | Description |
---|---|---|
languageCode |
transliteration.LanguageCode
Name | Type | Description |
---|---|---|
name |
string |
|
nativeName |
string |
|
scripts |
Scripts[] |