GoogleTranslateTransformer
allows you to translate text and HTML with the Google Cloud Translation API.
To use it, you should have the google-cloud-translate
python package installed, and a Google Cloud project with the Translation API enabled. This transformer uses the Advanced edition (v3).
Input
This is the document we’ll translateGoogleTranslateTransformer
, you can include the following parameters to configure the requests.
project_id
: Google Cloud Project ID.location
: (Optional) Translate model location.- Default:
global
- Default:
model_id
: (Optional) Translate model ID to use.glossary_id
: (Optional) Translate glossary ID to use.api_endpoint
: (Optional) Regional endpoint to use.
Output
After translating a document, the result will be returned as a new document with thepage_content
translated into the target language.
You can provide the following keyword parameters to the transform_documents()
method:
target_language_code
: ISO 639 language code of the output document.- For supported languages, refer to Language support.
source_language_code
: (Optional) ISO 639 language code of the input document.- If not provided, language will be auto-detected.
mime_type
: (Optional) Media Type of the input text.- Options:
text/plain
(Default),text/html
.
- Options: