Overview of the Cloud Translation API
Cloud Translation API can translate text for more than 100 language pairs. If you don't know the language of your source text, Cloud Translation API can detect it for you. For a list of all of the supported languages, see Supported languages.
As an enterprise organization, you can include translated text in existing internal workflows. For example, you might have a global support team that receives customer cases in many different languages. You can add Cloud Translation API into your workflow to translate those customer cases into the language spoken by your support team members. By using Cloud Translation API, you improve the overall efficiency of your support team because they don't need to manually translate text themselves or rely on others.
Cloud Translation API scales seamlessly and allows unlimited character translations per day. However, there are restrictions on content size for each request and request rates. Additionally, you can use quota limits to manage your budget. For more information, see Quotas and limits.
The Cloud Translation API comes in two different editions, namely a Basic edition and an Advanced edition. For a list of the different features supported by each, see the edition comparison.
Cloud Translation - Basic API
The Basic edition is accessed through v2 client libraries, and requires minimal configuration. It accepts API keys for authenticatation as well as service accounts, and uses the Google pre-trained Neural Machine Translation (NMT) model with no modification. It's a good fit for applications that need to translate casual user-generated content such as chat, social media, or comments.
By default, Cloud Translation API uses the Basic edition, which Google updates on a semi-regular cadence as more training data and better techniques become available.
If you're planning a new project, however, you may want to choose the Advanced edition instead, to take advantage of better security, more features, and the new service improvements that the Advanced edition will continue to make going forward.
Cloud Translation - Advanced API
The Advanced edition is accessed through v3 client libraries and requires service account authentication that's integrated with IAM roles. It offers a choice of models, including the Translation LLM model, the NMT model, and NMT customizations. It also provides features such as glossaries, batch translation, document translation, and more.
The key features of Cloud Translation - Advanced API are:
Access to more models - Pick the right model for you from among state-of-the-art translation models like the Translation LLM, Google's Neural Machine Translation (NMT) model, Adaptive Translation models, or custom NMT models that you or someone else created.
Glossaries - Create a custom dictionary to correctly and consistently translate domain-specific terms.
Batch requests - Make asynchronous requests to translate large amounts of text.
Document Translation - Translate documents, such as PDF files, to preserve the original format and layout.
IAM roles - Secure your translation requests by using Identity and Access Management. Create service accounts and grant them permissions by adding IAM roles. Cloud Translation - Advanced API does not support API keys.
Labels - Add user-defined labels (key-value pairs) to your translation requests to better track usage and get granular billing reports.
Regional endpoint - Exercise control over where the resources for your project are stored and processed.
Glossaries
A glossary is a custom dictionary that Cloud Translation - Advanced API uses to correctly and consistently translate domain-specific terms, named entities, and other kinds of terms that are specific to you. For example, you can use a glossary to specify a specific translation for terms such as "Google Summer of Code," "Gmail confidential mode," or "placement performance report."
You can also use glossaries to prevent certain words, such as borrowed words or product names, from being translated. For information about how to use glossaries, refer to Creating and using glossaries.
Batch requests
Batch translation requests are asynchronous requests that translate input from Cloud Storage buckets. Cloud Translation - Advanced API performs the batch translation as a long-running operation and writes the output to a Cloud Storage bucket that you specify. Inline requests for batch translation are not supported.
For information on making batch requests, refer to Batch requests (Advanced).
Document Translation
Document Translation lets you directly translate existing documents, such as PDF and DOCX files, to a target language. Document Translation preserves the original format so that translated documents have the same layout and format as the original documents. For example, Document Translation keeps paragraph breaks and headings so that your translated content is divided like in the original document.
Cloud Translation - Advanced API features, such as glossaries and AutoML models also work with Document Translation. For example, if you have an existing AutoML model that you use for text translations, you can use that same model for Document Translation. For more information about supported file types and how to translate documents, refer to Translate documents.
Model selection and AutoML models
Cloud Translation - Advanced API model selection lets you dynamically select the right model for your application from among the Translation LLM (which you can also further customize for adaptive translations), Google's NMT model or custom AutoML Translation models, depending on the context and the content that you're translating.
Create a custom model by using AutoML Translation to get more accurate translations for domain-specific terminology. You can then use the resulting model in Cloud Translation - Advanced API to translate text.
For information on using custom models to translate text, refer to Translating text (Advanced).
IAM roles
Cloud Translation - Advanced API integrates with IAM to provide additional security for your translation requests, enable fine-grained access control, and support integration with AutoML Translation.
You must add users and service accounts to one of the following roles to grant those accounts access to Cloud Translation - Advanced API. For information about creating service accounts, refer to Creating and managing service accounts in the IAM documentation.
| Role | Role ID | Description |
|---|---|---|
| Cloud Translation API Viewer | roles/cloudtranslate.viewer |
Can access get and list operations. |
| Cloud Translation API User | roles/cloudtranslate.user |
Includes the permissions of |
| Cloud Translation API Editor | roles/cloudtranslate.editor |
Includes the permissions of |
| Cloud Translation API Admin | roles/cloudtranslate.admin |
Includes the permissions of |
To see a list of permissions that are contained in each role, refer to Understanding roles.
These pre-configured roles address many typical use cases. However, you might need a role that includes a custom set of permissions. For example, you might want to create a role that allows a user to create a glossary in a project, without letting them delete or update existing glossaries in the project. In those cases, you can create an IAM custom role that meets your needs.
For information on managing IAM roles, refer to Granting, changing, and revoking access to resources and Granting roles to service accounts.
Labels
Cloud Translation - Advanced API supports adding user-defined labels (key-value pairs)
to TranslateText, BatchTranslateText and DetectLanguage requests.
Information about a request's usage is forwarded to the billing system where
you can break down your billing charges by filtering on your labels.
For more information about user-defined labels, refer to Reporting usage with labels (Advanced).
Regional endpoint
By default, Cloud Translation - Advanced API stores and processes resources in a global location, which means there is no guarantee that resources remain within a particular location. Instead of using the default global endpoint, you can use a regional endpoint to keep resources within a particular location, such as the European Union. For more information, refer to Specify a regional endpoint.
Edition comparison
The following table shows which features are available in each edition.
| Feature | Basic | Advanced |
|---|---|---|
| Translate with the NMT model | ||
| Translate with the Translation LLM | ||
| Translate with Adaptive Translation models | ||
| Translate with custom models | ||
| Translate multiple strings in a single request | ||
| Batch translations with Cloud Storage | ||
| Translate documents | ||
| Glossary support (control terminology) | ||
| Train custom models | ||
| Language Detection | ||
| Integrated REST API | ||
| Integrated gRPC API | ||
| Service Account | ||
| API Key | ||
| Audit logging | ||
| Supports HTML | ||
| Supports 100+ Languages | ||
| Romanization support | ||
| Transliteration support | ||
| Adaptive Translation | ||
| Multi-regional endpoint support | ||
| VPC Service Controls support |
Refer to Cloud Translation - Advanced API features for more details on Cloud Translation - Advanced API.
Pricing
Cloud Translation API charges you on a monthly basis based on the number of characters that you send. For more information, see Pricing.
Resources and further reading
- To start using the API, get set up and then try the quickstart guide.
- Compare supported models
- Customize the NMT model
- Customize the Translation LLM
- Supported languages
- Supported formats
- Perform adaptive translation
- Migrate to Translation Advanced
- For answers to general questions about Cloud Translation API, refer to the General FAQs page.