Cloud Translation용 커넥터

워크플로 내에서 Cloud Translation에 액세스하는 데 사용되는 기본 제공 함수를 정의하는 Workflows 커넥터입니다.

더 살펴보기

이 코드 샘플이 포함된 자세한 문서는 다음을 참조하세요.

코드 샘플

YAML

# This workflow demonstrates how to use the Cloud Translate connector:
# Translate text from English to French
# Create and delete a glossary (see https://cloud.google.com/translate/docs/advanced/glossary)
# Expected output: "SUCCESS"
- init:
    assign:
      - project_id: ${sys.get_env("GOOGLE_CLOUD_PROJECT_ID")}
      - location_id: "us-central1"
      - glossary_id: "example-glossary-id"
- list_supported_translation:
    call: googleapis.translate.v2.languages.list
    args:
      target: "fr"
- basic_translate:
    call: googleapis.translate.v2.translations.translate
    args:
      q: "hello world"
      target: "fr"
      format: "text"
      source: "en"
- create_glossary:
    call: googleapis.translate.v3.projects.locations.glossaries.create
    args:
      parent: ${"projects/" + project_id + "/locations/" + location_id}
      body:
        name: ${"projects/" + project_id + "/locations/" + location_id + "/glossaries/" + glossary_id}
        inputConfig:
          gcsSource:
            inputUri: "gs://translate-glossary-source/glossary.csv"
        languagePair:
          sourceLanguageCode: "en-US"
          targetLanguageCode: "fr-CA"
- list_glossaries:
    call: googleapis.translate.v3.projects.locations.glossaries.list
    args:
      parent: ${"projects/" + project_id + "/locations/" + location_id}
- delete_glossary:
    call: googleapis.translate.v3.projects.locations.glossaries.delete
    args:
      name: ${"projects/" + project_id + "/locations/" + location_id + "/glossaries/" + glossary_id}
- the_end:
    return: "SUCCESS"

다음 단계

다른 Google Cloud 제품의 코드 샘플을 검색하고 필터링하려면 Google Cloud 샘플 브라우저를 참조하세요.