Skip to content

Latest commit

 

History

History
83 lines (58 loc) · 2.53 KB

translate.rst

File metadata and controls

83 lines (58 loc) · 2.53 KB

Google Cloud Translate Operators

Translate a string or list of strings.

For parameter definition, take a look at :class:`~airflow.contrib.operators.gcp_translate_operator.CloudTranslateTextOperator`

Using the operator

Basic usage of the operator:

.. exampleinclude:: ../../../../airflow/contrib/example_dags/example_gcp_translate.py
      :language: python
      :dedent: 4
      :start-after: [START howto_operator_translate_text]
      :end-before: [END howto_operator_translate_text]

The result of translation is available as dictionary or array of dictionaries accessible via the usual XCom mechanisms of Airflow:

.. exampleinclude:: ../../../../airflow/contrib/example_dags/example_gcp_translate.py
      :language: python
      :dedent: 4
      :start-after: [START howto_operator_translate_access]
      :end-before: [END howto_operator_translate_access]


Templating

.. literalinclude:: ../../../../airflow/contrib/operators/gcp_translate_operator.py
    :language: python
    :dedent: 4
    :start-after: [START translate_template_fields]
    :end-before: [END translate_template_fields]

More information

See Google Cloud Translate documentation.

For further information, look at: