Understanding Target Languages
Target languages represent the destination in language transformation processes. When you translate content, the target language is the language into which your content will be converted. Having accurate information about available target languages is fundamental to ensuring your application correctly delivers content to your diverse user base.How to Use This Endpoint
To retrieve the list of supported target languages, simply send aGET
request to this endpoint. No parameters are required, as the response will include all available target languages. The system will respond with an array containing detailed information about each language.
Understanding Language Identifiers
The language identifiers returned by this endpoint are crucial for other API operations. When you make requests to endpoints like/translate
, youβll need to specify the target language using the id
value. This creates a consistent system for language identification across the entire API.
Hereβs how the language identifiers connect different parts of the API ecosystem:
- Fetch available languages using the
/target-languages
endpoint. - Present choices to your users in a meaningful way using the
language
property. - Submit requests to other endpoints using the
id
property as the language identifier.
Relationship with Source Languages
Itβs important to understand the distinction between target languages (provided by this endpoint) and source languages (provided by the/source-languages
endpoint):
- Target languages are languages that your content can be translated into.
- Source languages are languages that your content starts in.
Best Practices
When working with the/target-languages
endpoint, consider these recommendations:
- Cache the results: Since language lists change infrequently, store the response locally and refresh it periodically (e.g., once a day) rather than making a request every time a user interacts with your application.
- Sort languages appropriately: In user interfaces, consider sorting languages alphabetically or by relevance to your user base.
- Use appropriate identifiers: Always use the
id
field when making API requests, rather than the language name or short name. - Provide search functionality: For applications with many language options, implement search or filtering to help users quickly find their desired language.
- Display language variants clearly: When presenting language options to users, ensure variants of languages (e.g., Brazilian Portuguese vs. European Portuguese) are clearly distinguished.
Authorizations
The x-api-key
is a custom header required for authenticating requests to our API. Include this header in your request with the appropriate API key value to securely access our endpoints. You can find your API key(s) in the 'API' section of our studio website.
Response
Successful Response
The response is of type LanguageItem Β· object[]
.