Skip to main content
Google Translate is a multilingual neural machine translation service developed by Google to translate text, documents and websites from one language into another. The 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 translate
When initializing the GoogleTranslateTransformer, you can include the following parameters to configure the requests.
  • project_id: Google Cloud Project ID.
  • location: (Optional) Translate model location.
    • Default: global
  • 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 the page_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.
  • 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.