Class v3.TranslationServiceClient (8.5.0)

Provides natural language translation operations. v3

Package

@google-cloud/translate

Constructors

(constructor)(opts, gaxInstance)

constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);

Construct an instance of TranslationServiceClient.

Parameters
Name Description
opts ClientOptions
gaxInstance typeof gax | typeof fallback

: loaded instance of google-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new TranslationServiceClient({fallback: true}, gax); ```

Properties

apiEndpoint

get apiEndpoint(): string;

The DNS address for this API service.

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath.

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

iamClient

iamClient: IamClient;

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };

locationsClient

locationsClient: LocationsClient;

operationsClient

operationsClient: gax.OperationsClient;

pathTemplates

pathTemplates: {
        [name: string]: gax.PathTemplate;
    };

port

static get port(): number;

The port for this API service.

scopes

static get scopes(): string[];

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

static get servicePath(): string;

The DNS address for this API service.

translationServiceStub

translationServiceStub?: Promise<{
        [name: string]: Function;
    }>;

universeDomain

get universeDomain(): string;

warn

warn: (code: string, message: string, warnType?: string) => void;

Methods

adaptiveMtDatasetPath(project, location, dataset)

adaptiveMtDatasetPath(project: string, location: string, dataset: string): string;

Return a fully-qualified adaptiveMtDataset resource name string.

Parameters
Name Description
project string
location string
dataset string
Returns
Type Description
string

{string} Resource name string.

adaptiveMtFilePath(project, location, dataset, file)

adaptiveMtFilePath(project: string, location: string, dataset: string, file: string): string;

Return a fully-qualified adaptiveMtFile resource name string.

Parameters
Name Description
project string
location string
dataset string
file string
Returns
Type Description
string

{string} Resource name string.

adaptiveMtSentencePath(project, location, dataset, file, sentence)

adaptiveMtSentencePath(project: string, location: string, dataset: string, file: string, sentence: string): string;

Return a fully-qualified adaptiveMtSentence resource name string.

Parameters
Name Description
project string
location string
dataset string
file string
sentence string
Returns
Type Description
string

{string} Resource name string.

adaptiveMtTranslate(request, options)

adaptiveMtTranslate(request?: protos.google.cloud.translation.v3.IAdaptiveMtTranslateRequest, options?: CallOptions): Promise<[
        protos.google.cloud.translation.v3.IAdaptiveMtTranslateResponse,
        (protos.google.cloud.translation.v3.IAdaptiveMtTranslateRequest | undefined),
        {} | undefined
    ]>;

Translate text using Adaptive MT.

Parameters
Name Description
request IAdaptiveMtTranslateRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.translation.v3.IAdaptiveMtTranslateResponse, (protos.google.cloud.translation.v3.IAdaptiveMtTranslateRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing AdaptiveMtTranslateResponse. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Location to make a regional call.
   *  Format: `projects/{project-number-or-id}/locations/{location-id}`.
   */
  // const parent = 'abc123'
  /**
   *  Required. The resource name for the dataset to use for adaptive MT.
   *  `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}`
   */
  // const dataset = 'abc123'
  /**
   *  Required. The content of the input in string format.
   */
  // const content = ['abc','def']
  /**
   *  Configuration for caller provided reference sentences.
   */
  // const referenceSentenceConfig = {}
  /**
   *  Optional. Glossary to be applied. The glossary must be
   *  within the same region (have the same location-id) as the model, otherwise
   *  an INVALID_ARGUMENT (400) error is returned.
   */
  // const glossaryConfig = {}

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callAdaptiveMtTranslate() {
    // Construct request
    const request = {
      parent,
      dataset,
      content,
    };

    // Run request
    const response = await translationClient.adaptiveMtTranslate(request);
    console.log(response);
  }

  callAdaptiveMtTranslate();

adaptiveMtTranslate(request, options, callback)

adaptiveMtTranslate(request: protos.google.cloud.translation.v3.IAdaptiveMtTranslateRequest, options: CallOptions, callback: Callback<protos.google.cloud.translation.v3.IAdaptiveMtTranslateResponse, protos.google.cloud.translation.v3.IAdaptiveMtTranslateRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IAdaptiveMtTranslateRequest
options CallOptions
callback Callback<protos.google.cloud.translation.v3.IAdaptiveMtTranslateResponse, protos.google.cloud.translation.v3.IAdaptiveMtTranslateRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

adaptiveMtTranslate(request, callback)

adaptiveMtTranslate(request: protos.google.cloud.translation.v3.IAdaptiveMtTranslateRequest, callback: Callback<protos.google.cloud.translation.v3.IAdaptiveMtTranslateResponse, protos.google.cloud.translation.v3.IAdaptiveMtTranslateRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IAdaptiveMtTranslateRequest
callback Callback<protos.google.cloud.translation.v3.IAdaptiveMtTranslateResponse, protos.google.cloud.translation.v3.IAdaptiveMtTranslateRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

batchTranslateDocument(request, options)

batchTranslateDocument(request?: protos.google.cloud.translation.v3.IBatchTranslateDocumentRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.translation.v3.IBatchTranslateDocumentResponse, protos.google.cloud.translation.v3.IBatchTranslateDocumentMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Translates a large volume of document in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location.

This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.

Parameters
Name Description
request IBatchTranslateDocumentRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.cloud.translation.v3.IBatchTranslateDocumentResponse, protos.google.cloud.translation.v3.IBatchTranslateDocumentMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Location to make a regional call.
   *  Format: `projects/{project-number-or-id}/locations/{location-id}`.
   *  The `global` location is not supported for batch translation.
   *  Only AutoML Translation models or glossaries within the same region (have
   *  the same location-id) can be used, otherwise an INVALID_ARGUMENT (400)
   *  error is returned.
   */
  // const parent = 'abc123'
  /**
   *  Required. The ISO-639 language code of the input document if known, for
   *  example, "en-US" or "sr-Latn". Supported language codes are listed in
   *  Language Support (https://cloud.google.com/translate/docs/languages).
   */
  // const sourceLanguageCode = 'abc123'
  /**
   *  Required. The ISO-639 language code to use for translation of the input
   *  document. Specify up to 10 language codes here.
   */
  // const targetLanguageCodes = ['abc','def']
  /**
   *  Required. Input configurations.
   *  The total number of files matched should be <= 100.="" *="" the="" total="" content="" size="" to="" translate="" should="" be=""><= 100m="" unicode="" codepoints.="" *="" the="" files="" must="" use="" utf-8="" encoding.="" */="" const="" inputconfigs="[1,2,3,4]" *="" *="" required.="" output="" configuration.="" *="" if="" 2="" input="" configs="" match="" to="" the="" same="" file="" (that="" is,="" same="" input="" path),="" *="" we="" don't="" generate="" output="" for="" duplicate="" inputs.="" */="" const="" outputconfig="{}" *="" *="" optional.="" the="" models="" to="" use="" for="" translation.="" map's="" key="" is="" target="" language="" *="" code.="" map's="" value="" is="" the="" model="" name.="" value="" can="" be="" a="" built-in="" general="" model,="" *="" or="" an="" automl="" translation="" model.="" *="" the="" value="" format="" depends="" on="" model="" type:="" *="" -="" automl="" translation="" models:="" *="" `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`="" *="" -="" general="" (built-in)="" models:="" *="" `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,="" *="" if="" the="" map="" is="" empty="" or="" a="" specific="" model="" is="" *="" not="" requested="" for="" a="" language="" pair,="" then="" default="" google="" model="" (nmt)="" is="" used.="" */="" const="" models="[1,2,3,4]" *="" *="" optional.="" glossaries="" to="" be="" applied.="" it's="" keyed="" by="" target="" language="" code.="" */="" const="" glossaries="[1,2,3,4]" *="" *="" optional.="" the="" file="" format="" conversion="" map="" that="" is="" applied="" to="" all="" input="" *="" files.="" the="" map="" key="" is="" the="" original="" mime_type.="" the="" map="" value="" is="" the="" target="" *="" mime_type="" of="" translated="" documents.="" *="" supported="" file="" format="" conversion="" includes:="" *="" -="" `application/pdf`="" to="" *="" `application/vnd.openxmlformats-officedocument.wordprocessingml.document`="" *="" if="" nothing="" specified,="" output="" files="" will="" be="" in="" the="" same="" format="" as="" the="" *="" original="" file.="" */="" const="" formatconversions="[1,2,3,4]" *="" *="" optional.="" this="" flag="" is="" to="" support="" user="" customized="" attribution.="" *="" if="" not="" provided,="" the="" default="" is="" `machine="" translated="" by="" google`.="" *="" customized="" attribution="" should="" follow="" rules="" in="" *="" https://cloud.google.com/translate/attribution#attribution_and_logos="" */="" const="" customizedattribution='abc123' *="" *="" optional.="" if="" true,="" use="" the="" text="" removal="" server="" to="" remove="" the="" shadow="" text="" on="" *="" background="" image="" for="" native="" pdf="" translation.="" *="" shadow="" removal="" feature="" can="" only="" be="" enabled="" when="" *="" is_translate_native_pdf_only:="" false="" &&="" pdf_native_only:="" false="" */="" const="" enableshadowremovalnativepdf="true" *="" *="" optional.="" if="" true,="" enable="" auto="" rotation="" correction="" in="" dvs.="" */="" const="" enablerotationcorrection="true" imports="" the="" translation="" library="" const="" {translationserviceclient}="require('@google-cloud/translate').v3;" instantiates="" a="" client="" const="" translationclient="new" translationserviceclient();="" async="" function="" callbatchtranslatedocument()="" {="" construct="" request="" const="" request="{" parent,="" sourcelanguagecode,="" targetlanguagecodes,="" inputconfigs,="" outputconfig,="" };="" run="" request="" const="" [operation]="await" translationclient.batchtranslatedocument(request);="" const="" [response]="await" operation.promise();="" console.log(response);="" }="" callbatchtranslatedocument();="">

batchTranslateDocument(request, options, callback)

batchTranslateDocument(request: protos.google.cloud.translation.v3.IBatchTranslateDocumentRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.translation.v3.IBatchTranslateDocumentResponse, protos.google.cloud.translation.v3.IBatchTranslateDocumentMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IBatchTranslateDocumentRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.translation.v3.IBatchTranslateDocumentResponse, protos.google.cloud.translation.v3.IBatchTranslateDocumentMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

batchTranslateDocument(request, callback)

batchTranslateDocument(request: protos.google.cloud.translation.v3.IBatchTranslateDocumentRequest, callback: Callback<LROperation<protos.google.cloud.translation.v3.IBatchTranslateDocumentResponse, protos.google.cloud.translation.v3.IBatchTranslateDocumentMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IBatchTranslateDocumentRequest
callback Callback<LROperation<protos.google.cloud.translation.v3.IBatchTranslateDocumentResponse, protos.google.cloud.translation.v3.IBatchTranslateDocumentMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

batchTranslateText(request, options)

batchTranslateText(request?: protos.google.cloud.translation.v3.IBatchTranslateTextRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.translation.v3.IBatchTranslateResponse, protos.google.cloud.translation.v3.IBatchTranslateMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Translates a large volume of text in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location.

This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.

Parameters
Name Description
request IBatchTranslateTextRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.cloud.translation.v3.IBatchTranslateResponse, protos.google.cloud.translation.v3.IBatchTranslateMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Location to make a call. Must refer to a caller's project.
   *  Format: `projects/{project-number-or-id}/locations/{location-id}`.
   *  The `global` location is not supported for batch translation.
   *  Only AutoML Translation models or glossaries within the same region (have
   *  the same location-id) can be used, otherwise an INVALID_ARGUMENT (400)
   *  error is returned.
   */
  // const parent = 'abc123'
  /**
   *  Required. Source language code.
   */
  // const sourceLanguageCode = 'abc123'
  /**
   *  Required. Specify up to 10 language codes here.
   */
  // const targetLanguageCodes = ['abc','def']
  /**
   *  Optional. The models to use for translation. Map's key is target language
   *  code. Map's value is model name. Value can be a built-in general model,
   *  or an AutoML Translation model.
   *  The value format depends on model type:
   *  - AutoML Translation models:
   *    `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
   *  - General (built-in) models:
   *    `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
   *  If the map is empty or a specific model is
   *  not requested for a language pair, then default google model (nmt) is used.
   */
  // const models = [1,2,3,4]
  /**
   *  Required. Input configurations.
   *  The total number of files matched should be <= 100.="" *="" the="" total="" content="" size="" should="" be=""><= 100m="" unicode="" codepoints.="" *="" the="" files="" must="" use="" utf-8="" encoding.="" */="" const="" inputconfigs="[1,2,3,4]" *="" *="" required.="" output="" configuration.="" *="" if="" 2="" input="" configs="" match="" to="" the="" same="" file="" (that="" is,="" same="" input="" path),="" *="" we="" don't="" generate="" output="" for="" duplicate="" inputs.="" */="" const="" outputconfig="{}" *="" *="" optional.="" glossaries="" to="" be="" applied="" for="" translation.="" *="" it's="" keyed="" by="" target="" language="" code.="" */="" const="" glossaries="[1,2,3,4]" *="" *="" optional.="" the="" labels="" with="" user-defined="" metadata="" for="" the="" request.="" *="" label="" keys="" and="" values="" can="" be="" no="" longer="" than="" 63="" characters="" *="" (unicode="" codepoints),="" can="" only="" contain="" lowercase="" letters,="" numeric="" *="" characters,="" underscores="" and="" dashes.="" international="" characters="" are="" allowed.="" *="" label="" values="" are="" optional.="" label="" keys="" must="" start="" with="" a="" letter.="" *="" see="" https://cloud.google.com/translate/docs/advanced/labels="" for="" more="" *="" information.="" */="" const="" labels="[1,2,3,4]" imports="" the="" translation="" library="" const="" {translationserviceclient}="require('@google-cloud/translate').v3;" instantiates="" a="" client="" const="" translationclient="new" translationserviceclient();="" async="" function="" callbatchtranslatetext()="" {="" construct="" request="" const="" request="{" parent,="" sourcelanguagecode,="" targetlanguagecodes,="" inputconfigs,="" outputconfig,="" };="" run="" request="" const="" [operation]="await" translationclient.batchtranslatetext(request);="" const="" [response]="await" operation.promise();="" console.log(response);="" }="" callbatchtranslatetext();="">

batchTranslateText(request, options, callback)

batchTranslateText(request: protos.google.cloud.translation.v3.IBatchTranslateTextRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.translation.v3.IBatchTranslateResponse, protos.google.cloud.translation.v3.IBatchTranslateMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IBatchTranslateTextRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.translation.v3.IBatchTranslateResponse, protos.google.cloud.translation.v3.IBatchTranslateMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

batchTranslateText(request, callback)

batchTranslateText(request: protos.google.cloud.translation.v3.IBatchTranslateTextRequest, callback: Callback<LROperation<protos.google.cloud.translation.v3.IBatchTranslateResponse, protos.google.cloud.translation.v3.IBatchTranslateMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IBatchTranslateTextRequest
callback Callback<LROperation<protos.google.cloud.translation.v3.IBatchTranslateResponse, protos.google.cloud.translation.v3.IBatchTranslateMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

cancelOperation(request, options, callback)

cancelOperation(request: protos.google.longrunning.CancelOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, {} | undefined | null>, callback?: Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>): Promise<protos.google.protobuf.Empty>;

Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an value with a of 1, corresponding to Code.CANCELLED.

Parameters
Name Description
request CancelOperationRequest

The request object that will be sent.

options CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, {} | undefined | null>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>

The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.

Returns
Type Description
Promise<protos.google.protobuf.Empty>
Example

const client = longrunning.operationsClient();
await client.cancelOperation({name: ''});

checkBatchTranslateDocumentProgress(name)

checkBatchTranslateDocumentProgress(name: string): Promise<LROperation<protos.google.cloud.translation.v3.BatchTranslateDocumentResponse, protos.google.cloud.translation.v3.BatchTranslateDocumentMetadata>>;

Check the status of the long running operation returned by batchTranslateDocument().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.translation.v3.BatchTranslateDocumentResponse, protos.google.cloud.translation.v3.BatchTranslateDocumentMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Location to make a regional call.
   *  Format: `projects/{project-number-or-id}/locations/{location-id}`.
   *  The `global` location is not supported for batch translation.
   *  Only AutoML Translation models or glossaries within the same region (have
   *  the same location-id) can be used, otherwise an INVALID_ARGUMENT (400)
   *  error is returned.
   */
  // const parent = 'abc123'
  /**
   *  Required. The ISO-639 language code of the input document if known, for
   *  example, "en-US" or "sr-Latn". Supported language codes are listed in
   *  Language Support (https://cloud.google.com/translate/docs/languages).
   */
  // const sourceLanguageCode = 'abc123'
  /**
   *  Required. The ISO-639 language code to use for translation of the input
   *  document. Specify up to 10 language codes here.
   */
  // const targetLanguageCodes = ['abc','def']
  /**
   *  Required. Input configurations.
   *  The total number of files matched should be <= 100.="" *="" the="" total="" content="" size="" to="" translate="" should="" be=""><= 100m="" unicode="" codepoints.="" *="" the="" files="" must="" use="" utf-8="" encoding.="" */="" const="" inputconfigs="[1,2,3,4]" *="" *="" required.="" output="" configuration.="" *="" if="" 2="" input="" configs="" match="" to="" the="" same="" file="" (that="" is,="" same="" input="" path),="" *="" we="" don't="" generate="" output="" for="" duplicate="" inputs.="" */="" const="" outputconfig="{}" *="" *="" optional.="" the="" models="" to="" use="" for="" translation.="" map's="" key="" is="" target="" language="" *="" code.="" map's="" value="" is="" the="" model="" name.="" value="" can="" be="" a="" built-in="" general="" model,="" *="" or="" an="" automl="" translation="" model.="" *="" the="" value="" format="" depends="" on="" model="" type:="" *="" -="" automl="" translation="" models:="" *="" `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`="" *="" -="" general="" (built-in)="" models:="" *="" `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,="" *="" if="" the="" map="" is="" empty="" or="" a="" specific="" model="" is="" *="" not="" requested="" for="" a="" language="" pair,="" then="" default="" google="" model="" (nmt)="" is="" used.="" */="" const="" models="[1,2,3,4]" *="" *="" optional.="" glossaries="" to="" be="" applied.="" it's="" keyed="" by="" target="" language="" code.="" */="" const="" glossaries="[1,2,3,4]" *="" *="" optional.="" the="" file="" format="" conversion="" map="" that="" is="" applied="" to="" all="" input="" *="" files.="" the="" map="" key="" is="" the="" original="" mime_type.="" the="" map="" value="" is="" the="" target="" *="" mime_type="" of="" translated="" documents.="" *="" supported="" file="" format="" conversion="" includes:="" *="" -="" `application/pdf`="" to="" *="" `application/vnd.openxmlformats-officedocument.wordprocessingml.document`="" *="" if="" nothing="" specified,="" output="" files="" will="" be="" in="" the="" same="" format="" as="" the="" *="" original="" file.="" */="" const="" formatconversions="[1,2,3,4]" *="" *="" optional.="" this="" flag="" is="" to="" support="" user="" customized="" attribution.="" *="" if="" not="" provided,="" the="" default="" is="" `machine="" translated="" by="" google`.="" *="" customized="" attribution="" should="" follow="" rules="" in="" *="" https://cloud.google.com/translate/attribution#attribution_and_logos="" */="" const="" customizedattribution='abc123' *="" *="" optional.="" if="" true,="" use="" the="" text="" removal="" server="" to="" remove="" the="" shadow="" text="" on="" *="" background="" image="" for="" native="" pdf="" translation.="" *="" shadow="" removal="" feature="" can="" only="" be="" enabled="" when="" *="" is_translate_native_pdf_only:="" false="" &&="" pdf_native_only:="" false="" */="" const="" enableshadowremovalnativepdf="true" *="" *="" optional.="" if="" true,="" enable="" auto="" rotation="" correction="" in="" dvs.="" */="" const="" enablerotationcorrection="true" imports="" the="" translation="" library="" const="" {translationserviceclient}="require('@google-cloud/translate').v3;" instantiates="" a="" client="" const="" translationclient="new" translationserviceclient();="" async="" function="" callbatchtranslatedocument()="" {="" construct="" request="" const="" request="{" parent,="" sourcelanguagecode,="" targetlanguagecodes,="" inputconfigs,="" outputconfig,="" };="" run="" request="" const="" [operation]="await" translationclient.batchtranslatedocument(request);="" const="" [response]="await" operation.promise();="" console.log(response);="" }="" callbatchtranslatedocument();="">

checkBatchTranslateTextProgress(name)

checkBatchTranslateTextProgress(name: string): Promise<LROperation<protos.google.cloud.translation.v3.BatchTranslateResponse, protos.google.cloud.translation.v3.BatchTranslateMetadata>>;

Check the status of the long running operation returned by batchTranslateText().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.translation.v3.BatchTranslateResponse, protos.google.cloud.translation.v3.BatchTranslateMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Location to make a call. Must refer to a caller's project.
   *  Format: `projects/{project-number-or-id}/locations/{location-id}`.
   *  The `global` location is not supported for batch translation.
   *  Only AutoML Translation models or glossaries within the same region (have
   *  the same location-id) can be used, otherwise an INVALID_ARGUMENT (400)
   *  error is returned.
   */
  // const parent = 'abc123'
  /**
   *  Required. Source language code.
   */
  // const sourceLanguageCode = 'abc123'
  /**
   *  Required. Specify up to 10 language codes here.
   */
  // const targetLanguageCodes = ['abc','def']
  /**
   *  Optional. The models to use for translation. Map's key is target language
   *  code. Map's value is model name. Value can be a built-in general model,
   *  or an AutoML Translation model.
   *  The value format depends on model type:
   *  - AutoML Translation models:
   *    `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
   *  - General (built-in) models:
   *    `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
   *  If the map is empty or a specific model is
   *  not requested for a language pair, then default google model (nmt) is used.
   */
  // const models = [1,2,3,4]
  /**
   *  Required. Input configurations.
   *  The total number of files matched should be <= 100.="" *="" the="" total="" content="" size="" should="" be=""><= 100m="" unicode="" codepoints.="" *="" the="" files="" must="" use="" utf-8="" encoding.="" */="" const="" inputconfigs="[1,2,3,4]" *="" *="" required.="" output="" configuration.="" *="" if="" 2="" input="" configs="" match="" to="" the="" same="" file="" (that="" is,="" same="" input="" path),="" *="" we="" don't="" generate="" output="" for="" duplicate="" inputs.="" */="" const="" outputconfig="{}" *="" *="" optional.="" glossaries="" to="" be="" applied="" for="" translation.="" *="" it's="" keyed="" by="" target="" language="" code.="" */="" const="" glossaries="[1,2,3,4]" *="" *="" optional.="" the="" labels="" with="" user-defined="" metadata="" for="" the="" request.="" *="" label="" keys="" and="" values="" can="" be="" no="" longer="" than="" 63="" characters="" *="" (unicode="" codepoints),="" can="" only="" contain="" lowercase="" letters,="" numeric="" *="" characters,="" underscores="" and="" dashes.="" international="" characters="" are="" allowed.="" *="" label="" values="" are="" optional.="" label="" keys="" must="" start="" with="" a="" letter.="" *="" see="" https://cloud.google.com/translate/docs/advanced/labels="" for="" more="" *="" information.="" */="" const="" labels="[1,2,3,4]" imports="" the="" translation="" library="" const="" {translationserviceclient}="require('@google-cloud/translate').v3;" instantiates="" a="" client="" const="" translationclient="new" translationserviceclient();="" async="" function="" callbatchtranslatetext()="" {="" construct="" request="" const="" request="{" parent,="" sourcelanguagecode,="" targetlanguagecodes,="" inputconfigs,="" outputconfig,="" };="" run="" request="" const="" [operation]="await" translationclient.batchtranslatetext(request);="" const="" [response]="await" operation.promise();="" console.log(response);="" }="" callbatchtranslatetext();="">

checkCreateDatasetProgress(name)

checkCreateDatasetProgress(name: string): Promise<LROperation<protos.google.cloud.translation.v3.Dataset, protos.google.cloud.translation.v3.CreateDatasetMetadata>>;

Check the status of the long running operation returned by createDataset().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.translation.v3.Dataset, protos.google.cloud.translation.v3.CreateDatasetMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The project name.
   */
  // const parent = 'abc123'
  /**
   *  Required. The Dataset to create.
   */
  // const dataset = {}

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callCreateDataset() {
    // Construct request
    const request = {
      parent,
      dataset,
    };

    // Run request
    const [operation] = await translationClient.createDataset(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callCreateDataset();

checkCreateGlossaryProgress(name)

checkCreateGlossaryProgress(name: string): Promise<LROperation<protos.google.cloud.translation.v3.Glossary, protos.google.cloud.translation.v3.CreateGlossaryMetadata>>;

Check the status of the long running operation returned by createGlossary().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.translation.v3.Glossary, protos.google.cloud.translation.v3.CreateGlossaryMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The project name.
   */
  // const parent = 'abc123'
  /**
   *  Required. The glossary to create.
   */
  // const glossary = {}

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callCreateGlossary() {
    // Construct request
    const request = {
      parent,
      glossary,
    };

    // Run request
    const [operation] = await translationClient.createGlossary(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callCreateGlossary();

checkCreateModelProgress(name)

checkCreateModelProgress(name: string): Promise<LROperation<protos.google.cloud.translation.v3.Model, protos.google.cloud.translation.v3.CreateModelMetadata>>;

Check the status of the long running operation returned by createModel().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.translation.v3.Model, protos.google.cloud.translation.v3.CreateModelMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The project name, in form of
   *  `projects/{project}/locations/{location}`
   */
  // const parent = 'abc123'
  /**
   *  Required. The Model to create.
   */
  // const model = {}

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callCreateModel() {
    // Construct request
    const request = {
      parent,
      model,
    };

    // Run request
    const [operation] = await translationClient.createModel(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callCreateModel();

checkDeleteDatasetProgress(name)

checkDeleteDatasetProgress(name: string): Promise<LROperation<protos.google.protobuf.Empty, protos.google.cloud.translation.v3.DeleteDatasetMetadata>>;

Check the status of the long running operation returned by deleteDataset().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.protobuf.Empty, protos.google.cloud.translation.v3.DeleteDatasetMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the dataset to delete.
   */
  // const name = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callDeleteDataset() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await translationClient.deleteDataset(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callDeleteDataset();

checkDeleteGlossaryProgress(name)

checkDeleteGlossaryProgress(name: string): Promise<LROperation<protos.google.cloud.translation.v3.DeleteGlossaryResponse, protos.google.cloud.translation.v3.DeleteGlossaryMetadata>>;

Check the status of the long running operation returned by deleteGlossary().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.translation.v3.DeleteGlossaryResponse, protos.google.cloud.translation.v3.DeleteGlossaryMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the glossary to delete.
   */
  // const name = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callDeleteGlossary() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await translationClient.deleteGlossary(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callDeleteGlossary();

checkDeleteModelProgress(name)

checkDeleteModelProgress(name: string): Promise<LROperation<protos.google.protobuf.Empty, protos.google.cloud.translation.v3.DeleteModelMetadata>>;

Check the status of the long running operation returned by deleteModel().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.protobuf.Empty, protos.google.cloud.translation.v3.DeleteModelMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the model to delete.
   */
  // const name = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callDeleteModel() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await translationClient.deleteModel(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callDeleteModel();

checkExportDataProgress(name)

checkExportDataProgress(name: string): Promise<LROperation<protos.google.protobuf.Empty, protos.google.cloud.translation.v3.ExportDataMetadata>>;

Check the status of the long running operation returned by exportData().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.protobuf.Empty, protos.google.cloud.translation.v3.ExportDataMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Name of the dataset. In form of
   *  `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}`
   */
  // const dataset = 'abc123'
  /**
   *  Required. The config for the output content.
   */
  // const outputConfig = {}

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callExportData() {
    // Construct request
    const request = {
      dataset,
      outputConfig,
    };

    // Run request
    const [operation] = await translationClient.exportData(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callExportData();

checkImportDataProgress(name)

checkImportDataProgress(name: string): Promise<LROperation<protos.google.protobuf.Empty, protos.google.cloud.translation.v3.ImportDataMetadata>>;

Check the status of the long running operation returned by importData().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.protobuf.Empty, protos.google.cloud.translation.v3.ImportDataMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Name of the dataset. In form of
   *  `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}`
   */
  // const dataset = 'abc123'
  /**
   *  Required. The config for the input content.
   */
  // const inputConfig = {}

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callImportData() {
    // Construct request
    const request = {
      dataset,
      inputConfig,
    };

    // Run request
    const [operation] = await translationClient.importData(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callImportData();

checkUpdateGlossaryProgress(name)

checkUpdateGlossaryProgress(name: string): Promise<LROperation<protos.google.cloud.translation.v3.Glossary, protos.google.cloud.translation.v3.UpdateGlossaryMetadata>>;

Check the status of the long running operation returned by updateGlossary().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.translation.v3.Glossary, protos.google.cloud.translation.v3.UpdateGlossaryMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The glossary entry to update.
   */
  // const glossary = {}
  /**
   *  The list of fields to be updated. Currently only `display_name` and
   *  'input_config'
   */
  // const updateMask = {}

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callUpdateGlossary() {
    // Construct request
    const request = {
      glossary,
    };

    // Run request
    const [operation] = await translationClient.updateGlossary(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callUpdateGlossary();

close()

close(): Promise<void>;

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns
Type Description
Promise<void>

{Promise} A promise that resolves when the client is closed.

createAdaptiveMtDataset(request, options)

createAdaptiveMtDataset(request?: protos.google.cloud.translation.v3.ICreateAdaptiveMtDatasetRequest, options?: CallOptions): Promise<[
        protos.google.cloud.translation.v3.IAdaptiveMtDataset,
        (protos.google.cloud.translation.v3.ICreateAdaptiveMtDatasetRequest | undefined),
        {} | undefined
    ]>;

Creates an Adaptive MT dataset.

Parameters
Name Description
request ICreateAdaptiveMtDatasetRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.translation.v3.IAdaptiveMtDataset, (protos.google.cloud.translation.v3.ICreateAdaptiveMtDatasetRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing AdaptiveMtDataset. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Name of the parent project. In form of
   *  `projects/{project-number-or-id}/locations/{location-id}`
   */
  // const parent = 'abc123'
  /**
   *  Required. The AdaptiveMtDataset to be created.
   */
  // const adaptiveMtDataset = {}

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callCreateAdaptiveMtDataset() {
    // Construct request
    const request = {
      parent,
      adaptiveMtDataset,
    };

    // Run request
    const response = await translationClient.createAdaptiveMtDataset(request);
    console.log(response);
  }

  callCreateAdaptiveMtDataset();

createAdaptiveMtDataset(request, options, callback)

createAdaptiveMtDataset(request: protos.google.cloud.translation.v3.ICreateAdaptiveMtDatasetRequest, options: CallOptions, callback: Callback<protos.google.cloud.translation.v3.IAdaptiveMtDataset, protos.google.cloud.translation.v3.ICreateAdaptiveMtDatasetRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateAdaptiveMtDatasetRequest
options CallOptions
callback Callback<protos.google.cloud.translation.v3.IAdaptiveMtDataset, protos.google.cloud.translation.v3.ICreateAdaptiveMtDatasetRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

createAdaptiveMtDataset(request, callback)

createAdaptiveMtDataset(request: protos.google.cloud.translation.v3.ICreateAdaptiveMtDatasetRequest, callback: Callback<protos.google.cloud.translation.v3.IAdaptiveMtDataset, protos.google.cloud.translation.v3.ICreateAdaptiveMtDatasetRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateAdaptiveMtDatasetRequest
callback Callback<protos.google.cloud.translation.v3.IAdaptiveMtDataset, protos.google.cloud.translation.v3.ICreateAdaptiveMtDatasetRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

createDataset(request, options)

createDataset(request?: protos.google.cloud.translation.v3.ICreateDatasetRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.translation.v3.IDataset, protos.google.cloud.translation.v3.ICreateDatasetMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Creates a Dataset.

Parameters
Name Description
request ICreateDatasetRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.cloud.translation.v3.IDataset, protos.google.cloud.translation.v3.ICreateDatasetMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The project name.
   */
  // const parent = 'abc123'
  /**
   *  Required. The Dataset to create.
   */
  // const dataset = {}

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callCreateDataset() {
    // Construct request
    const request = {
      parent,
      dataset,
    };

    // Run request
    const [operation] = await translationClient.createDataset(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callCreateDataset();

createDataset(request, options, callback)

createDataset(request: protos.google.cloud.translation.v3.ICreateDatasetRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.translation.v3.IDataset, protos.google.cloud.translation.v3.ICreateDatasetMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateDatasetRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.translation.v3.IDataset, protos.google.cloud.translation.v3.ICreateDatasetMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

createDataset(request, callback)

createDataset(request: protos.google.cloud.translation.v3.ICreateDatasetRequest, callback: Callback<LROperation<protos.google.cloud.translation.v3.IDataset, protos.google.cloud.translation.v3.ICreateDatasetMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateDatasetRequest
callback Callback<LROperation<protos.google.cloud.translation.v3.IDataset, protos.google.cloud.translation.v3.ICreateDatasetMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

createGlossary(request, options)

createGlossary(request?: protos.google.cloud.translation.v3.ICreateGlossaryRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.translation.v3.IGlossary, protos.google.cloud.translation.v3.ICreateGlossaryMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist.

Parameters
Name Description
request ICreateGlossaryRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.cloud.translation.v3.IGlossary, protos.google.cloud.translation.v3.ICreateGlossaryMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The project name.
   */
  // const parent = 'abc123'
  /**
   *  Required. The glossary to create.
   */
  // const glossary = {}

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callCreateGlossary() {
    // Construct request
    const request = {
      parent,
      glossary,
    };

    // Run request
    const [operation] = await translationClient.createGlossary(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callCreateGlossary();

createGlossary(request, options, callback)

createGlossary(request: protos.google.cloud.translation.v3.ICreateGlossaryRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.translation.v3.IGlossary, protos.google.cloud.translation.v3.ICreateGlossaryMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateGlossaryRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.translation.v3.IGlossary, protos.google.cloud.translation.v3.ICreateGlossaryMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

createGlossary(request, callback)

createGlossary(request: protos.google.cloud.translation.v3.ICreateGlossaryRequest, callback: Callback<LROperation<protos.google.cloud.translation.v3.IGlossary, protos.google.cloud.translation.v3.ICreateGlossaryMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateGlossaryRequest
callback Callback<LROperation<protos.google.cloud.translation.v3.IGlossary, protos.google.cloud.translation.v3.ICreateGlossaryMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

createGlossaryEntry(request, options)

createGlossaryEntry(request?: protos.google.cloud.translation.v3.ICreateGlossaryEntryRequest, options?: CallOptions): Promise<[
        protos.google.cloud.translation.v3.IGlossaryEntry,
        (protos.google.cloud.translation.v3.ICreateGlossaryEntryRequest | undefined),
        {} | undefined
    ]>;

Creates a glossary entry.

Parameters
Name Description
request ICreateGlossaryEntryRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.translation.v3.IGlossaryEntry, (protos.google.cloud.translation.v3.ICreateGlossaryEntryRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The resource name of the glossary to create the entry under.
   */
  // const parent = 'abc123'
  /**
   *  Required. The glossary entry to create
   */
  // const glossaryEntry = {}

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callCreateGlossaryEntry() {
    // Construct request
    const request = {
      parent,
      glossaryEntry,
    };

    // Run request
    const response = await translationClient.createGlossaryEntry(request);
    console.log(response);
  }

  callCreateGlossaryEntry();

createGlossaryEntry(request, options, callback)

createGlossaryEntry(request: protos.google.cloud.translation.v3.ICreateGlossaryEntryRequest, options: CallOptions, callback: Callback<protos.google.cloud.translation.v3.IGlossaryEntry, protos.google.cloud.translation.v3.ICreateGlossaryEntryRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateGlossaryEntryRequest
options CallOptions
callback Callback<protos.google.cloud.translation.v3.IGlossaryEntry, protos.google.cloud.translation.v3.ICreateGlossaryEntryRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

createGlossaryEntry(request, callback)

createGlossaryEntry(request: protos.google.cloud.translation.v3.ICreateGlossaryEntryRequest, callback: Callback<protos.google.cloud.translation.v3.IGlossaryEntry, protos.google.cloud.translation.v3.ICreateGlossaryEntryRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateGlossaryEntryRequest
callback Callback<protos.google.cloud.translation.v3.IGlossaryEntry, protos.google.cloud.translation.v3.ICreateGlossaryEntryRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

createModel(request, options)

createModel(request?: protos.google.cloud.translation.v3.ICreateModelRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.translation.v3.IModel, protos.google.cloud.translation.v3.ICreateModelMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Creates a Model.

Parameters
Name Description
request ICreateModelRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.cloud.translation.v3.IModel, protos.google.cloud.translation.v3.ICreateModelMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The project name, in form of
   *  `projects/{project}/locations/{location}`
   */
  // const parent = 'abc123'
  /**
   *  Required. The Model to create.
   */
  // const model = {}

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callCreateModel() {
    // Construct request
    const request = {
      parent,
      model,
    };

    // Run request
    const [operation] = await translationClient.createModel(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callCreateModel();

createModel(request, options, callback)

createModel(request: protos.google.cloud.translation.v3.ICreateModelRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.translation.v3.IModel, protos.google.cloud.translation.v3.ICreateModelMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateModelRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.translation.v3.IModel, protos.google.cloud.translation.v3.ICreateModelMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

createModel(request, callback)

createModel(request: protos.google.cloud.translation.v3.ICreateModelRequest, callback: Callback<LROperation<protos.google.cloud.translation.v3.IModel, protos.google.cloud.translation.v3.ICreateModelMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateModelRequest
callback Callback<LROperation<protos.google.cloud.translation.v3.IModel, protos.google.cloud.translation.v3.ICreateModelMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

datasetPath(project, location, dataset)

datasetPath(project: string, location: string, dataset: string): string;

Return a fully-qualified dataset resource name string.

Parameters
Name Description
project string
location string
dataset string
Returns
Type Description
string

{string} Resource name string.

deleteAdaptiveMtDataset(request, options)

deleteAdaptiveMtDataset(request?: protos.google.cloud.translation.v3.IDeleteAdaptiveMtDatasetRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IEmpty,
        (protos.google.cloud.translation.v3.IDeleteAdaptiveMtDatasetRequest | undefined),
        {} | undefined
    ]>;

Deletes an Adaptive MT dataset, including all its entries and associated metadata.

Parameters
Name Description
request IDeleteAdaptiveMtDatasetRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.protobuf.IEmpty, (protos.google.cloud.translation.v3.IDeleteAdaptiveMtDatasetRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Name of the dataset. In the form of
   *  `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
   */
  // const name = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callDeleteAdaptiveMtDataset() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await translationClient.deleteAdaptiveMtDataset(request);
    console.log(response);
  }

  callDeleteAdaptiveMtDataset();

deleteAdaptiveMtDataset(request, options, callback)

deleteAdaptiveMtDataset(request: protos.google.cloud.translation.v3.IDeleteAdaptiveMtDatasetRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IDeleteAdaptiveMtDatasetRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteAdaptiveMtDatasetRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IDeleteAdaptiveMtDatasetRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteAdaptiveMtDataset(request, callback)

deleteAdaptiveMtDataset(request: protos.google.cloud.translation.v3.IDeleteAdaptiveMtDatasetRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IDeleteAdaptiveMtDatasetRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteAdaptiveMtDatasetRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IDeleteAdaptiveMtDatasetRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteAdaptiveMtFile(request, options)

deleteAdaptiveMtFile(request?: protos.google.cloud.translation.v3.IDeleteAdaptiveMtFileRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IEmpty,
        (protos.google.cloud.translation.v3.IDeleteAdaptiveMtFileRequest | undefined),
        {} | undefined
    ]>;

Deletes an AdaptiveMtFile along with its sentences.

Parameters
Name Description
request IDeleteAdaptiveMtFileRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.protobuf.IEmpty, (protos.google.cloud.translation.v3.IDeleteAdaptiveMtFileRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The resource name of the file to delete, in form of
   *  `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
   */
  // const name = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callDeleteAdaptiveMtFile() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await translationClient.deleteAdaptiveMtFile(request);
    console.log(response);
  }

  callDeleteAdaptiveMtFile();

deleteAdaptiveMtFile(request, options, callback)

deleteAdaptiveMtFile(request: protos.google.cloud.translation.v3.IDeleteAdaptiveMtFileRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IDeleteAdaptiveMtFileRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteAdaptiveMtFileRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IDeleteAdaptiveMtFileRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteAdaptiveMtFile(request, callback)

deleteAdaptiveMtFile(request: protos.google.cloud.translation.v3.IDeleteAdaptiveMtFileRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IDeleteAdaptiveMtFileRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteAdaptiveMtFileRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IDeleteAdaptiveMtFileRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteDataset(request, options)

deleteDataset(request?: protos.google.cloud.translation.v3.IDeleteDatasetRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IDeleteDatasetMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Deletes a dataset and all of its contents.

Parameters
Name Description
request IDeleteDatasetRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IDeleteDatasetMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the dataset to delete.
   */
  // const name = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callDeleteDataset() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await translationClient.deleteDataset(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callDeleteDataset();

deleteDataset(request, options, callback)

deleteDataset(request: protos.google.cloud.translation.v3.IDeleteDatasetRequest, options: CallOptions, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IDeleteDatasetMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteDatasetRequest
options CallOptions
callback Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IDeleteDatasetMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteDataset(request, callback)

deleteDataset(request: protos.google.cloud.translation.v3.IDeleteDatasetRequest, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IDeleteDatasetMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteDatasetRequest
callback Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IDeleteDatasetMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteGlossary(request, options)

deleteGlossary(request?: protos.google.cloud.translation.v3.IDeleteGlossaryRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.translation.v3.IDeleteGlossaryResponse, protos.google.cloud.translation.v3.IDeleteGlossaryMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist.

Parameters
Name Description
request IDeleteGlossaryRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.cloud.translation.v3.IDeleteGlossaryResponse, protos.google.cloud.translation.v3.IDeleteGlossaryMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the glossary to delete.
   */
  // const name = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callDeleteGlossary() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await translationClient.deleteGlossary(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callDeleteGlossary();

deleteGlossary(request, options, callback)

deleteGlossary(request: protos.google.cloud.translation.v3.IDeleteGlossaryRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.translation.v3.IDeleteGlossaryResponse, protos.google.cloud.translation.v3.IDeleteGlossaryMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteGlossaryRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.translation.v3.IDeleteGlossaryResponse, protos.google.cloud.translation.v3.IDeleteGlossaryMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteGlossary(request, callback)

deleteGlossary(request: protos.google.cloud.translation.v3.IDeleteGlossaryRequest, callback: Callback<LROperation<protos.google.cloud.translation.v3.IDeleteGlossaryResponse, protos.google.cloud.translation.v3.IDeleteGlossaryMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteGlossaryRequest
callback Callback<LROperation<protos.google.cloud.translation.v3.IDeleteGlossaryResponse, protos.google.cloud.translation.v3.IDeleteGlossaryMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteGlossaryEntry(request, options)

deleteGlossaryEntry(request?: protos.google.cloud.translation.v3.IDeleteGlossaryEntryRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IEmpty,
        (protos.google.cloud.translation.v3.IDeleteGlossaryEntryRequest | undefined),
        {} | undefined
    ]>;

Deletes a single entry from the glossary

Parameters
Name Description
request IDeleteGlossaryEntryRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.protobuf.IEmpty, (protos.google.cloud.translation.v3.IDeleteGlossaryEntryRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The resource name of the glossary entry to delete
   */
  // const name = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callDeleteGlossaryEntry() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await translationClient.deleteGlossaryEntry(request);
    console.log(response);
  }

  callDeleteGlossaryEntry();

deleteGlossaryEntry(request, options, callback)

deleteGlossaryEntry(request: protos.google.cloud.translation.v3.IDeleteGlossaryEntryRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IDeleteGlossaryEntryRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteGlossaryEntryRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IDeleteGlossaryEntryRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteGlossaryEntry(request, callback)

deleteGlossaryEntry(request: protos.google.cloud.translation.v3.IDeleteGlossaryEntryRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IDeleteGlossaryEntryRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteGlossaryEntryRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IDeleteGlossaryEntryRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteModel(request, options)

deleteModel(request?: protos.google.cloud.translation.v3.IDeleteModelRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IDeleteModelMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Deletes a model.

Parameters
Name Description
request IDeleteModelRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IDeleteModelMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the model to delete.
   */
  // const name = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callDeleteModel() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const [operation] = await translationClient.deleteModel(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callDeleteModel();

deleteModel(request, options, callback)

deleteModel(request: protos.google.cloud.translation.v3.IDeleteModelRequest, options: CallOptions, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IDeleteModelMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteModelRequest
options CallOptions
callback Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IDeleteModelMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteModel(request, callback)

deleteModel(request: protos.google.cloud.translation.v3.IDeleteModelRequest, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IDeleteModelMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteModelRequest
callback Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IDeleteModelMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteOperation(request, options, callback)

deleteOperation(request: protos.google.longrunning.DeleteOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>): Promise<protos.google.protobuf.Empty>;

Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED.

Parameters
Name Description
request DeleteOperationRequest

The request object that will be sent.

options CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>

The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.

Returns
Type Description
Promise<protos.google.protobuf.Empty>
Example

const client = longrunning.operationsClient();
await client.deleteOperation({name: ''});

detectLanguage(request, options)

detectLanguage(request?: protos.google.cloud.translation.v3.IDetectLanguageRequest, options?: CallOptions): Promise<[
        protos.google.cloud.translation.v3.IDetectLanguageResponse,
        protos.google.cloud.translation.v3.IDetectLanguageRequest | undefined,
        {} | undefined
    ]>;

Detects the language of text within a request.

Parameters
Name Description
request IDetectLanguageRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.translation.v3.IDetectLanguageResponse, protos.google.cloud.translation.v3.IDetectLanguageRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing DetectLanguageResponse. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Project or location to make a call. Must refer to a caller's
   *  project.
   *  Format: `projects/{project-number-or-id}/locations/{location-id}` or
   *  `projects/{project-number-or-id}`.
   *  For global calls, use `projects/{project-number-or-id}/locations/global` or
   *  `projects/{project-number-or-id}`.
   *  Only models within the same region (has same location-id) can be used.
   *  Otherwise an INVALID_ARGUMENT (400) error is returned.
   */
  // const parent = 'abc123'
  /**
   *  Optional. The language detection model to be used.
   *  Format:
   *  `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}`
   *  Only one language detection model is currently supported:
   *  `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`.
   *  If not specified, the default model is used.
   */
  // const model = 'abc123'
  /**
   *  The content of the input stored as a string.
   */
  // const content = 'abc123'
  /**
   *  Optional. The format of the source text, for example, "text/html",
   *  "text/plain". If left blank, the MIME type defaults to "text/html".
   */
  // const mimeType = 'abc123'
  /**
   *  Optional. The labels with user-defined metadata for the request.
   *  Label keys and values can be no longer than 63 characters
   *  (Unicode codepoints), can only contain lowercase letters, numeric
   *  characters, underscores and dashes. International characters are allowed.
   *  Label values are optional. Label keys must start with a letter.
   *  See https://cloud.google.com/translate/docs/advanced/labels for more
   *  information.
   */
  // const labels = [1,2,3,4]

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callDetectLanguage() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const response = await translationClient.detectLanguage(request);
    console.log(response);
  }

  callDetectLanguage();

detectLanguage(request, options, callback)

detectLanguage(request: protos.google.cloud.translation.v3.IDetectLanguageRequest, options: CallOptions, callback: Callback<protos.google.cloud.translation.v3.IDetectLanguageResponse, protos.google.cloud.translation.v3.IDetectLanguageRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDetectLanguageRequest
options CallOptions
callback Callback<protos.google.cloud.translation.v3.IDetectLanguageResponse, protos.google.cloud.translation.v3.IDetectLanguageRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

detectLanguage(request, callback)

detectLanguage(request: protos.google.cloud.translation.v3.IDetectLanguageRequest, callback: Callback<protos.google.cloud.translation.v3.IDetectLanguageResponse, protos.google.cloud.translation.v3.IDetectLanguageRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDetectLanguageRequest
callback Callback<protos.google.cloud.translation.v3.IDetectLanguageResponse, protos.google.cloud.translation.v3.IDetectLanguageRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

examplePath(project, location, dataset, example)

examplePath(project: string, location: string, dataset: string, example: string): string;

Return a fully-qualified example resource name string.

Parameters
Name Description
project string
location string
dataset string
example string
Returns
Type Description
string

{string} Resource name string.

exportData(request, options)

exportData(request?: protos.google.cloud.translation.v3.IExportDataRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IExportDataMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Exports dataset's data to the provided output location.

Parameters
Name Description
request IExportDataRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IExportDataMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Name of the dataset. In form of
   *  `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}`
   */
  // const dataset = 'abc123'
  /**
   *  Required. The config for the output content.
   */
  // const outputConfig = {}

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callExportData() {
    // Construct request
    const request = {
      dataset,
      outputConfig,
    };

    // Run request
    const [operation] = await translationClient.exportData(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callExportData();

exportData(request, options, callback)

exportData(request: protos.google.cloud.translation.v3.IExportDataRequest, options: CallOptions, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IExportDataMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IExportDataRequest
options CallOptions
callback Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IExportDataMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

exportData(request, callback)

exportData(request: protos.google.cloud.translation.v3.IExportDataRequest, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IExportDataMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IExportDataRequest
callback Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IExportDataMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

getAdaptiveMtDataset(request, options)

getAdaptiveMtDataset(request?: protos.google.cloud.translation.v3.IGetAdaptiveMtDatasetRequest, options?: CallOptions): Promise<[
        protos.google.cloud.translation.v3.IAdaptiveMtDataset,
        (protos.google.cloud.translation.v3.IGetAdaptiveMtDatasetRequest | undefined),
        {} | undefined
    ]>;

Gets the Adaptive MT dataset.

Parameters
Name Description
request IGetAdaptiveMtDatasetRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.translation.v3.IAdaptiveMtDataset, (protos.google.cloud.translation.v3.IGetAdaptiveMtDatasetRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing AdaptiveMtDataset. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Name of the dataset. In the form of
   *  `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`
   */
  // const name = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callGetAdaptiveMtDataset() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await translationClient.getAdaptiveMtDataset(request);
    console.log(response);
  }

  callGetAdaptiveMtDataset();

getAdaptiveMtDataset(request, options, callback)

getAdaptiveMtDataset(request: protos.google.cloud.translation.v3.IGetAdaptiveMtDatasetRequest, options: CallOptions, callback: Callback<protos.google.cloud.translation.v3.IAdaptiveMtDataset, protos.google.cloud.translation.v3.IGetAdaptiveMtDatasetRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetAdaptiveMtDatasetRequest
options CallOptions
callback Callback<protos.google.cloud.translation.v3.IAdaptiveMtDataset, protos.google.cloud.translation.v3.IGetAdaptiveMtDatasetRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getAdaptiveMtDataset(request, callback)

getAdaptiveMtDataset(request: protos.google.cloud.translation.v3.IGetAdaptiveMtDatasetRequest, callback: Callback<protos.google.cloud.translation.v3.IAdaptiveMtDataset, protos.google.cloud.translation.v3.IGetAdaptiveMtDatasetRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetAdaptiveMtDatasetRequest
callback Callback<protos.google.cloud.translation.v3.IAdaptiveMtDataset, protos.google.cloud.translation.v3.IGetAdaptiveMtDatasetRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getAdaptiveMtFile(request, options)

getAdaptiveMtFile(request?: protos.google.cloud.translation.v3.IGetAdaptiveMtFileRequest, options?: CallOptions): Promise<[
        protos.google.cloud.translation.v3.IAdaptiveMtFile,
        protos.google.cloud.translation.v3.IGetAdaptiveMtFileRequest | undefined,
        {} | undefined
    ]>;

Gets and AdaptiveMtFile

Parameters
Name Description
request IGetAdaptiveMtFileRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.translation.v3.IAdaptiveMtFile, protos.google.cloud.translation.v3.IGetAdaptiveMtFileRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing AdaptiveMtFile. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The resource name of the file, in form of
   *  `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
   */
  // const name = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callGetAdaptiveMtFile() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await translationClient.getAdaptiveMtFile(request);
    console.log(response);
  }

  callGetAdaptiveMtFile();

getAdaptiveMtFile(request, options, callback)

getAdaptiveMtFile(request: protos.google.cloud.translation.v3.IGetAdaptiveMtFileRequest, options: CallOptions, callback: Callback<protos.google.cloud.translation.v3.IAdaptiveMtFile, protos.google.cloud.translation.v3.IGetAdaptiveMtFileRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetAdaptiveMtFileRequest
options CallOptions
callback Callback<protos.google.cloud.translation.v3.IAdaptiveMtFile, protos.google.cloud.translation.v3.IGetAdaptiveMtFileRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getAdaptiveMtFile(request, callback)

getAdaptiveMtFile(request: protos.google.cloud.translation.v3.IGetAdaptiveMtFileRequest, callback: Callback<protos.google.cloud.translation.v3.IAdaptiveMtFile, protos.google.cloud.translation.v3.IGetAdaptiveMtFileRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetAdaptiveMtFileRequest
callback Callback<protos.google.cloud.translation.v3.IAdaptiveMtFile, protos.google.cloud.translation.v3.IGetAdaptiveMtFileRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getDataset(request, options)

getDataset(request?: protos.google.cloud.translation.v3.IGetDatasetRequest, options?: CallOptions): Promise<[
        protos.google.cloud.translation.v3.IDataset,
        protos.google.cloud.translation.v3.IGetDatasetRequest | undefined,
        {} | undefined
    ]>;

Gets a Dataset.

Parameters
Name Description
request IGetDatasetRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.translation.v3.IDataset, protos.google.cloud.translation.v3.IGetDatasetRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Dataset. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The resource name of the dataset to retrieve.
   */
  // const name = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callGetDataset() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await translationClient.getDataset(request);
    console.log(response);
  }

  callGetDataset();

getDataset(request, options, callback)

getDataset(request: protos.google.cloud.translation.v3.IGetDatasetRequest, options: CallOptions, callback: Callback<protos.google.cloud.translation.v3.IDataset, protos.google.cloud.translation.v3.IGetDatasetRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetDatasetRequest
options CallOptions
callback Callback<protos.google.cloud.translation.v3.IDataset, protos.google.cloud.translation.v3.IGetDatasetRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getDataset(request, callback)

getDataset(request: protos.google.cloud.translation.v3.IGetDatasetRequest, callback: Callback<protos.google.cloud.translation.v3.IDataset, protos.google.cloud.translation.v3.IGetDatasetRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetDatasetRequest
callback Callback<protos.google.cloud.translation.v3.IDataset, protos.google.cloud.translation.v3.IGetDatasetRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getGlossary(request, options)

getGlossary(request?: protos.google.cloud.translation.v3.IGetGlossaryRequest, options?: CallOptions): Promise<[
        protos.google.cloud.translation.v3.IGlossary,
        protos.google.cloud.translation.v3.IGetGlossaryRequest | undefined,
        {} | undefined
    ]>;

Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist.

Parameters
Name Description
request IGetGlossaryRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.translation.v3.IGlossary, protos.google.cloud.translation.v3.IGetGlossaryRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the glossary to retrieve.
   */
  // const name = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callGetGlossary() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await translationClient.getGlossary(request);
    console.log(response);
  }

  callGetGlossary();

getGlossary(request, options, callback)

getGlossary(request: protos.google.cloud.translation.v3.IGetGlossaryRequest, options: CallOptions, callback: Callback<protos.google.cloud.translation.v3.IGlossary, protos.google.cloud.translation.v3.IGetGlossaryRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetGlossaryRequest
options CallOptions
callback Callback<protos.google.cloud.translation.v3.IGlossary, protos.google.cloud.translation.v3.IGetGlossaryRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getGlossary(request, callback)

getGlossary(request: protos.google.cloud.translation.v3.IGetGlossaryRequest, callback: Callback<protos.google.cloud.translation.v3.IGlossary, protos.google.cloud.translation.v3.IGetGlossaryRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetGlossaryRequest
callback Callback<protos.google.cloud.translation.v3.IGlossary, protos.google.cloud.translation.v3.IGetGlossaryRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getGlossaryEntry(request, options)

getGlossaryEntry(request?: protos.google.cloud.translation.v3.IGetGlossaryEntryRequest, options?: CallOptions): Promise<[
        protos.google.cloud.translation.v3.IGlossaryEntry,
        protos.google.cloud.translation.v3.IGetGlossaryEntryRequest | undefined,
        {} | undefined
    ]>;

Gets a single glossary entry by the given id.

Parameters
Name Description
request IGetGlossaryEntryRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.translation.v3.IGlossaryEntry, protos.google.cloud.translation.v3.IGetGlossaryEntryRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The resource name of the glossary entry to get
   */
  // const name = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callGetGlossaryEntry() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await translationClient.getGlossaryEntry(request);
    console.log(response);
  }

  callGetGlossaryEntry();

getGlossaryEntry(request, options, callback)

getGlossaryEntry(request: protos.google.cloud.translation.v3.IGetGlossaryEntryRequest, options: CallOptions, callback: Callback<protos.google.cloud.translation.v3.IGlossaryEntry, protos.google.cloud.translation.v3.IGetGlossaryEntryRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetGlossaryEntryRequest
options CallOptions
callback Callback<protos.google.cloud.translation.v3.IGlossaryEntry, protos.google.cloud.translation.v3.IGetGlossaryEntryRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getGlossaryEntry(request, callback)

getGlossaryEntry(request: protos.google.cloud.translation.v3.IGetGlossaryEntryRequest, callback: Callback<protos.google.cloud.translation.v3.IGlossaryEntry, protos.google.cloud.translation.v3.IGetGlossaryEntryRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetGlossaryEntryRequest
callback Callback<protos.google.cloud.translation.v3.IGlossaryEntry, protos.google.cloud.translation.v3.IGetGlossaryEntryRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getIamPolicy(request, options, callback)

getIamPolicy(request: IamProtos.google.iam.v1.GetIamPolicyRequest, options?: gax.CallOptions | Callback<IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined>, callback?: Callback<IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined>): Promise<[IamProtos.google.iam.v1.Policy]>;

Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.

Parameters
Name Description
request IamProtos.google.iam.v1.GetIamPolicyRequest

The request object that will be sent.

options CallOptions | Callback<google.iam.v1.Policy, google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<google.iam.v1.Policy, google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined>

The function which will be called with the result of the API call.

The second parameter to the callback is an object representing .

Returns
Type Description
Promise<[google.iam.v1.Policy]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.

getLocation(request, options, callback)

getLocation(request: LocationProtos.google.cloud.location.IGetLocationRequest, options?: gax.CallOptions | Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>, callback?: Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>): Promise<LocationProtos.google.cloud.location.ILocation>;

Gets information about a location.

Parameters
Name Description
request LocationProtos.google.cloud.location.IGetLocationRequest

The request object that will be sent.

options CallOptions | Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>

Call options. See CallOptions for more details.

callback Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>
Returns
Type Description
Promise<google.cloud.location.ILocation>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

const [response] = await client.getLocation(request);

getModel(request, options)

getModel(request?: protos.google.cloud.translation.v3.IGetModelRequest, options?: CallOptions): Promise<[
        protos.google.cloud.translation.v3.IModel,
        protos.google.cloud.translation.v3.IGetModelRequest | undefined,
        {} | undefined
    ]>;

Gets a model.

Parameters
Name Description
request IGetModelRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.translation.v3.IModel, protos.google.cloud.translation.v3.IGetModelRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Model. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The resource name of the model to retrieve.
   */
  // const name = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callGetModel() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await translationClient.getModel(request);
    console.log(response);
  }

  callGetModel();

getModel(request, options, callback)

getModel(request: protos.google.cloud.translation.v3.IGetModelRequest, options: CallOptions, callback: Callback<protos.google.cloud.translation.v3.IModel, protos.google.cloud.translation.v3.IGetModelRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetModelRequest
options CallOptions
callback Callback<protos.google.cloud.translation.v3.IModel, protos.google.cloud.translation.v3.IGetModelRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getModel(request, callback)

getModel(request: protos.google.cloud.translation.v3.IGetModelRequest, callback: Callback<protos.google.cloud.translation.v3.IModel, protos.google.cloud.translation.v3.IGetModelRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetModelRequest
callback Callback<protos.google.cloud.translation.v3.IModel, protos.google.cloud.translation.v3.IGetModelRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getOperation(request, options, callback)

getOperation(request: protos.google.longrunning.GetOperationRequest, options?: gax.CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>): Promise<[protos.google.longrunning.Operation]>;

Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.

Parameters
Name Description
request GetOperationRequest

The request object that will be sent.

options CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>

The function which will be called with the result of the API call.

The second parameter to the callback is an object representing . {Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.

Returns
Type Description
Promise<[protos.google.longrunning.Operation]>
Example

const client = longrunning.operationsClient();
const name = '';
const [response] = await client.getOperation({name});
// doThingsWith(response)

getProjectId()

getProjectId(): Promise<string>;
Returns
Type Description
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
Name Description
callback Callback<string, undefined, undefined>
Returns
Type Description
void

getSupportedLanguages(request, options)

getSupportedLanguages(request?: protos.google.cloud.translation.v3.IGetSupportedLanguagesRequest, options?: CallOptions): Promise<[
        protos.google.cloud.translation.v3.ISupportedLanguages,
        (protos.google.cloud.translation.v3.IGetSupportedLanguagesRequest | undefined),
        {} | undefined
    ]>;

Returns a list of supported languages for translation.

Parameters
Name Description
request IGetSupportedLanguagesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.translation.v3.ISupportedLanguages, (protos.google.cloud.translation.v3.IGetSupportedLanguagesRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing SupportedLanguages. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Project or location to make a call. Must refer to a caller's
   *  project.
   *  Format: `projects/{project-number-or-id}` or
   *  `projects/{project-number-or-id}/locations/{location-id}`.
   *  For global calls, use `projects/{project-number-or-id}/locations/global` or
   *  `projects/{project-number-or-id}`.
   *  Non-global location is required for AutoML models.
   *  Only models within the same region (have same location-id) can be used,
   *  otherwise an INVALID_ARGUMENT (400) error is returned.
   */
  // const parent = 'abc123'
  /**
   *  Optional. The language to use to return localized, human readable names
   *  of supported languages. If missing, then display names are not returned
   *  in a response.
   */
  // const displayLanguageCode = 'abc123'
  /**
   *  Optional. Get supported languages of this model.
   *  The format depends on model type:
   *  - AutoML Translation models:
   *    `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
   *  - General (built-in) models:
   *    `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
   *  Returns languages supported by the specified model.
   *  If missing, we get supported languages of Google general NMT model.
   */
  // const model = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callGetSupportedLanguages() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const response = await translationClient.getSupportedLanguages(request);
    console.log(response);
  }

  callGetSupportedLanguages();

getSupportedLanguages(request, options, callback)

getSupportedLanguages(request: protos.google.cloud.translation.v3.IGetSupportedLanguagesRequest, options: CallOptions, callback: Callback<protos.google.cloud.translation.v3.ISupportedLanguages, protos.google.cloud.translation.v3.IGetSupportedLanguagesRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetSupportedLanguagesRequest
options CallOptions
callback Callback<protos.google.cloud.translation.v3.ISupportedLanguages, protos.google.cloud.translation.v3.IGetSupportedLanguagesRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getSupportedLanguages(request, callback)

getSupportedLanguages(request: protos.google.cloud.translation.v3.IGetSupportedLanguagesRequest, callback: Callback<protos.google.cloud.translation.v3.ISupportedLanguages, protos.google.cloud.translation.v3.IGetSupportedLanguagesRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetSupportedLanguagesRequest
callback Callback<protos.google.cloud.translation.v3.ISupportedLanguages, protos.google.cloud.translation.v3.IGetSupportedLanguagesRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

glossaryEntryPath(project, location, glossary, glossaryEntry)

glossaryEntryPath(project: string, location: string, glossary: string, glossaryEntry: string): string;

Return a fully-qualified glossaryEntry resource name string.

Parameters
Name Description
project string
location string
glossary string
glossaryEntry string
Returns
Type Description
string

{string} Resource name string.

glossaryPath(project, location, glossary)

glossaryPath(project: string, location: string, glossary: string): string;

Return a fully-qualified glossary resource name string.

Parameters
Name Description
project string
location string
glossary string
Returns
Type Description
string

{string} Resource name string.

importAdaptiveMtFile(request, options)

importAdaptiveMtFile(request?: protos.google.cloud.translation.v3.IImportAdaptiveMtFileRequest, options?: CallOptions): Promise<[
        protos.google.cloud.translation.v3.IImportAdaptiveMtFileResponse,
        (protos.google.cloud.translation.v3.IImportAdaptiveMtFileRequest | undefined),
        {} | undefined
    ]>;

Imports an AdaptiveMtFile and adds all of its sentences into the AdaptiveMtDataset.

Parameters
Name Description
request IImportAdaptiveMtFileRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.translation.v3.IImportAdaptiveMtFileResponse, (protos.google.cloud.translation.v3.IImportAdaptiveMtFileRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing ImportAdaptiveMtFileResponse. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The resource name of the file, in form of
   *  `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}`
   */
  // const parent = 'abc123'
  /**
   *  Inline file source.
   */
  // const fileInputSource = {}
  /**
   *  Google Cloud Storage file source.
   */
  // const gcsInputSource = {}

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callImportAdaptiveMtFile() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const response = await translationClient.importAdaptiveMtFile(request);
    console.log(response);
  }

  callImportAdaptiveMtFile();

importAdaptiveMtFile(request, options, callback)

importAdaptiveMtFile(request: protos.google.cloud.translation.v3.IImportAdaptiveMtFileRequest, options: CallOptions, callback: Callback<protos.google.cloud.translation.v3.IImportAdaptiveMtFileResponse, protos.google.cloud.translation.v3.IImportAdaptiveMtFileRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IImportAdaptiveMtFileRequest
options CallOptions
callback Callback<protos.google.cloud.translation.v3.IImportAdaptiveMtFileResponse, protos.google.cloud.translation.v3.IImportAdaptiveMtFileRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

importAdaptiveMtFile(request, callback)

importAdaptiveMtFile(request: protos.google.cloud.translation.v3.IImportAdaptiveMtFileRequest, callback: Callback<protos.google.cloud.translation.v3.IImportAdaptiveMtFileResponse, protos.google.cloud.translation.v3.IImportAdaptiveMtFileRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IImportAdaptiveMtFileRequest
callback Callback<protos.google.cloud.translation.v3.IImportAdaptiveMtFileResponse, protos.google.cloud.translation.v3.IImportAdaptiveMtFileRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

importData(request, options)

importData(request?: protos.google.cloud.translation.v3.IImportDataRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IImportDataMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Import sentence pairs into translation Dataset.

Parameters
Name Description
request IImportDataRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IImportDataMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Name of the dataset. In form of
   *  `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}`
   */
  // const dataset = 'abc123'
  /**
   *  Required. The config for the input content.
   */
  // const inputConfig = {}

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callImportData() {
    // Construct request
    const request = {
      dataset,
      inputConfig,
    };

    // Run request
    const [operation] = await translationClient.importData(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callImportData();

importData(request, options, callback)

importData(request: protos.google.cloud.translation.v3.IImportDataRequest, options: CallOptions, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IImportDataMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IImportDataRequest
options CallOptions
callback Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IImportDataMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

importData(request, callback)

importData(request: protos.google.cloud.translation.v3.IImportDataRequest, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IImportDataMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IImportDataRequest
callback Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.translation.v3.IImportDataMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

initialize()

initialize(): Promise<{
        [name: string]: Function;
    }>;

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns
Type Description
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.

listAdaptiveMtDatasets(request, options)

listAdaptiveMtDatasets(request?: protos.google.cloud.translation.v3.IListAdaptiveMtDatasetsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.translation.v3.IAdaptiveMtDataset[],
        protos.google.cloud.translation.v3.IListAdaptiveMtDatasetsRequest | null,
        protos.google.cloud.translation.v3.IListAdaptiveMtDatasetsResponse
    ]>;

Lists all Adaptive MT datasets for which the caller has read permission.

Parameters
Name Description
request IListAdaptiveMtDatasetsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.translation.v3.IAdaptiveMtDataset[], protos.google.cloud.translation.v3.IListAdaptiveMtDatasetsRequest | null, protos.google.cloud.translation.v3.IListAdaptiveMtDatasetsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of AdaptiveMtDataset. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listAdaptiveMtDatasetsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listAdaptiveMtDatasets(request, options, callback)

listAdaptiveMtDatasets(request: protos.google.cloud.translation.v3.IListAdaptiveMtDatasetsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.translation.v3.IListAdaptiveMtDatasetsRequest, protos.google.cloud.translation.v3.IListAdaptiveMtDatasetsResponse | null | undefined, protos.google.cloud.translation.v3.IAdaptiveMtDataset>): void;
Parameters
Name Description
request IListAdaptiveMtDatasetsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.translation.v3.IListAdaptiveMtDatasetsRequest, protos.google.cloud.translation.v3.IListAdaptiveMtDatasetsResponse | null | undefined, protos.google.cloud.translation.v3.IAdaptiveMtDataset>
Returns
Type Description
void

listAdaptiveMtDatasets(request, callback)

listAdaptiveMtDatasets(request: protos.google.cloud.translation.v3.IListAdaptiveMtDatasetsRequest, callback: PaginationCallback<protos.google.cloud.translation.v3.IListAdaptiveMtDatasetsRequest, protos.google.cloud.translation.v3.IListAdaptiveMtDatasetsResponse | null | undefined, protos.google.cloud.translation.v3.IAdaptiveMtDataset>): void;
Parameters
Name Description
request IListAdaptiveMtDatasetsRequest
callback PaginationCallback<protos.google.cloud.translation.v3.IListAdaptiveMtDatasetsRequest, protos.google.cloud.translation.v3.IListAdaptiveMtDatasetsResponse | null | undefined, protos.google.cloud.translation.v3.IAdaptiveMtDataset>
Returns
Type Description
void

listAdaptiveMtDatasetsAsync(request, options)

listAdaptiveMtDatasetsAsync(request?: protos.google.cloud.translation.v3.IListAdaptiveMtDatasetsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.translation.v3.IAdaptiveMtDataset>;

Equivalent to listAdaptiveMtDatasets, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
Name Description
request IListAdaptiveMtDatasetsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.translation.v3.IAdaptiveMtDataset>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing AdaptiveMtDataset. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The resource name of the project from which to list the Adaptive
   *  MT datasets. `projects/{project-number-or-id}/locations/{location-id}`
   */
  // const parent = 'abc123'
  /**
   *  Optional. Requested page size. The server may return fewer results than
   *  requested. If unspecified, the server picks an appropriate default.
   */
  // const pageSize = 1234
  /**
   *  Optional. A token identifying a page of results the server should return.
   *  Typically, this is the value of
   *  ListAdaptiveMtDatasetsResponse.next_page_token returned from the
   *  previous call to `ListAdaptiveMtDatasets` method. The first page is
   *  returned if `page_token`is empty or missing.
   */
  // const pageToken = 'abc123'
  /**
   *  Optional. An expression for filtering the results of the request.
   *  Filter is not supported yet.
   */
  // const filter = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callListAdaptiveMtDatasets() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = translationClient.listAdaptiveMtDatasetsAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListAdaptiveMtDatasets();

listAdaptiveMtDatasetsStream(request, options)

listAdaptiveMtDatasetsStream(request?: protos.google.cloud.translation.v3.IListAdaptiveMtDatasetsRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
Name Description
request IListAdaptiveMtDatasetsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Transform

{Stream} An object stream which emits an object representing AdaptiveMtDataset on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listAdaptiveMtDatasetsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listAdaptiveMtFiles(request, options)

listAdaptiveMtFiles(request?: protos.google.cloud.translation.v3.IListAdaptiveMtFilesRequest, options?: CallOptions): Promise<[
        protos.google.cloud.translation.v3.IAdaptiveMtFile[],
        protos.google.cloud.translation.v3.IListAdaptiveMtFilesRequest | null,
        protos.google.cloud.translation.v3.IListAdaptiveMtFilesResponse
    ]>;

Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.

Parameters
Name Description
request IListAdaptiveMtFilesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.translation.v3.IAdaptiveMtFile[], protos.google.cloud.translation.v3.IListAdaptiveMtFilesRequest | null, protos.google.cloud.translation.v3.IListAdaptiveMtFilesResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of AdaptiveMtFile. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listAdaptiveMtFilesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listAdaptiveMtFiles(request, options, callback)

listAdaptiveMtFiles(request: protos.google.cloud.translation.v3.IListAdaptiveMtFilesRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.translation.v3.IListAdaptiveMtFilesRequest, protos.google.cloud.translation.v3.IListAdaptiveMtFilesResponse | null | undefined, protos.google.cloud.translation.v3.IAdaptiveMtFile>): void;
Parameters
Name Description
request IListAdaptiveMtFilesRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.translation.v3.IListAdaptiveMtFilesRequest, protos.google.cloud.translation.v3.IListAdaptiveMtFilesResponse | null | undefined, protos.google.cloud.translation.v3.IAdaptiveMtFile>
Returns
Type Description
void

listAdaptiveMtFiles(request, callback)

listAdaptiveMtFiles(request: protos.google.cloud.translation.v3.IListAdaptiveMtFilesRequest, callback: PaginationCallback<protos.google.cloud.translation.v3.IListAdaptiveMtFilesRequest, protos.google.cloud.translation.v3.IListAdaptiveMtFilesResponse | null | undefined, protos.google.cloud.translation.v3.IAdaptiveMtFile>): void;
Parameters
Name Description
request IListAdaptiveMtFilesRequest
callback PaginationCallback<protos.google.cloud.translation.v3.IListAdaptiveMtFilesRequest, protos.google.cloud.translation.v3.IListAdaptiveMtFilesResponse | null | undefined, protos.google.cloud.translation.v3.IAdaptiveMtFile>
Returns
Type Description
void

listAdaptiveMtFilesAsync(request, options)

listAdaptiveMtFilesAsync(request?: protos.google.cloud.translation.v3.IListAdaptiveMtFilesRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.translation.v3.IAdaptiveMtFile>;

Equivalent to listAdaptiveMtFiles, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
Name Description
request IListAdaptiveMtFilesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.translation.v3.IAdaptiveMtFile>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing AdaptiveMtFile. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The resource name of the project from which to list the Adaptive
   *  MT files.
   *  `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
   */
  // const parent = 'abc123'
  /**
   *  Optional.
   */
  // const pageSize = 1234
  /**
   *  Optional. A token identifying a page of results the server should return.
   *  Typically, this is the value of
   *  ListAdaptiveMtFilesResponse.next_page_token returned from the
   *  previous call to `ListAdaptiveMtFiles` method. The first page is
   *  returned if `page_token`is empty or missing.
   */
  // const pageToken = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callListAdaptiveMtFiles() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = translationClient.listAdaptiveMtFilesAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListAdaptiveMtFiles();

listAdaptiveMtFilesStream(request, options)

listAdaptiveMtFilesStream(request?: protos.google.cloud.translation.v3.IListAdaptiveMtFilesRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
Name Description
request IListAdaptiveMtFilesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Transform

{Stream} An object stream which emits an object representing AdaptiveMtFile on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listAdaptiveMtFilesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listAdaptiveMtSentences(request, options)

listAdaptiveMtSentences(request?: protos.google.cloud.translation.v3.IListAdaptiveMtSentencesRequest, options?: CallOptions): Promise<[
        protos.google.cloud.translation.v3.IAdaptiveMtSentence[],
        protos.google.cloud.translation.v3.IListAdaptiveMtSentencesRequest | null,
        protos.google.cloud.translation.v3.IListAdaptiveMtSentencesResponse
    ]>;

Lists all AdaptiveMtSentences under a given file/dataset.

Parameters
Name Description
request IListAdaptiveMtSentencesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.translation.v3.IAdaptiveMtSentence[], protos.google.cloud.translation.v3.IListAdaptiveMtSentencesRequest | null, protos.google.cloud.translation.v3.IListAdaptiveMtSentencesResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of AdaptiveMtSentence. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listAdaptiveMtSentencesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listAdaptiveMtSentences(request, options, callback)

listAdaptiveMtSentences(request: protos.google.cloud.translation.v3.IListAdaptiveMtSentencesRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.translation.v3.IListAdaptiveMtSentencesRequest, protos.google.cloud.translation.v3.IListAdaptiveMtSentencesResponse | null | undefined, protos.google.cloud.translation.v3.IAdaptiveMtSentence>): void;
Parameters
Name Description
request IListAdaptiveMtSentencesRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.translation.v3.IListAdaptiveMtSentencesRequest, protos.google.cloud.translation.v3.IListAdaptiveMtSentencesResponse | null | undefined, protos.google.cloud.translation.v3.IAdaptiveMtSentence>
Returns
Type Description
void

listAdaptiveMtSentences(request, callback)

listAdaptiveMtSentences(request: protos.google.cloud.translation.v3.IListAdaptiveMtSentencesRequest, callback: PaginationCallback<protos.google.cloud.translation.v3.IListAdaptiveMtSentencesRequest, protos.google.cloud.translation.v3.IListAdaptiveMtSentencesResponse | null | undefined, protos.google.cloud.translation.v3.IAdaptiveMtSentence>): void;
Parameters
Name Description
request IListAdaptiveMtSentencesRequest
callback PaginationCallback<protos.google.cloud.translation.v3.IListAdaptiveMtSentencesRequest, protos.google.cloud.translation.v3.IListAdaptiveMtSentencesResponse | null | undefined, protos.google.cloud.translation.v3.IAdaptiveMtSentence>
Returns
Type Description
void

listAdaptiveMtSentencesAsync(request, options)

listAdaptiveMtSentencesAsync(request?: protos.google.cloud.translation.v3.IListAdaptiveMtSentencesRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.translation.v3.IAdaptiveMtSentence>;

Equivalent to listAdaptiveMtSentences, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
Name Description
request IListAdaptiveMtSentencesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.translation.v3.IAdaptiveMtSentence>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing AdaptiveMtSentence. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The resource name of the project from which to list the Adaptive
   *  MT files. The following format lists all sentences under a file.
   *  `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`
   *  The following format lists all sentences within a dataset.
   *  `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`
   */
  // const parent = 'abc123'
  /**
   */
  // const pageSize = 1234
  /**
   *  A token identifying a page of results the server should return.
   *  Typically, this is the value of
   *  ListAdaptiveMtSentencesRequest.next_page_token returned from the
   *  previous call to `ListTranslationMemories` method. The first page is
   *  returned if `page_token` is empty or missing.
   */
  // const pageToken = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callListAdaptiveMtSentences() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = translationClient.listAdaptiveMtSentencesAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListAdaptiveMtSentences();

listAdaptiveMtSentencesStream(request, options)

listAdaptiveMtSentencesStream(request?: protos.google.cloud.translation.v3.IListAdaptiveMtSentencesRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
Name Description
request IListAdaptiveMtSentencesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Transform

{Stream} An object stream which emits an object representing AdaptiveMtSentence on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listAdaptiveMtSentencesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listDatasets(request, options)

listDatasets(request?: protos.google.cloud.translation.v3.IListDatasetsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.translation.v3.IDataset[],
        protos.google.cloud.translation.v3.IListDatasetsRequest | null,
        protos.google.cloud.translation.v3.IListDatasetsResponse
    ]>;

Lists datasets.

Parameters
Name Description
request IListDatasetsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.translation.v3.IDataset[], protos.google.cloud.translation.v3.IListDatasetsRequest | null, protos.google.cloud.translation.v3.IListDatasetsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of Dataset. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listDatasetsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listDatasets(request, options, callback)

listDatasets(request: protos.google.cloud.translation.v3.IListDatasetsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.translation.v3.IListDatasetsRequest, protos.google.cloud.translation.v3.IListDatasetsResponse | null | undefined, protos.google.cloud.translation.v3.IDataset>): void;
Parameters
Name Description
request IListDatasetsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.translation.v3.IListDatasetsRequest, protos.google.cloud.translation.v3.IListDatasetsResponse | null | undefined, protos.google.cloud.translation.v3.IDataset>
Returns
Type Description
void

listDatasets(request, callback)

listDatasets(request: protos.google.cloud.translation.v3.IListDatasetsRequest, callback: PaginationCallback<protos.google.cloud.translation.v3.IListDatasetsRequest, protos.google.cloud.translation.v3.IListDatasetsResponse | null | undefined, protos.google.cloud.translation.v3.IDataset>): void;
Parameters
Name Description
request IListDatasetsRequest
callback PaginationCallback<protos.google.cloud.translation.v3.IListDatasetsRequest, protos.google.cloud.translation.v3.IListDatasetsResponse | null | undefined, protos.google.cloud.translation.v3.IDataset>
Returns
Type Description
void

listDatasetsAsync(request, options)

listDatasetsAsync(request?: protos.google.cloud.translation.v3.IListDatasetsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.translation.v3.IDataset>;

Equivalent to listDatasets, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
Name Description
request IListDatasetsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.translation.v3.IDataset>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Dataset. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Name of the parent project. In form of
   *  `projects/{project-number-or-id}/locations/{location-id}`
   */
  // const parent = 'abc123'
  /**
   *  Optional. Requested page size. The server can return fewer results than
   *  requested.
   */
  // const pageSize = 1234
  /**
   *  Optional. A token identifying a page of results for the server to return.
   *  Typically obtained from next_page_token field in the response of a
   *  ListDatasets call.
   */
  // const pageToken = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callListDatasets() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = translationClient.listDatasetsAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListDatasets();

listDatasetsStream(request, options)

listDatasetsStream(request?: protos.google.cloud.translation.v3.IListDatasetsRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
Name Description
request IListDatasetsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Transform

{Stream} An object stream which emits an object representing Dataset on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listDatasetsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listExamples(request, options)

listExamples(request?: protos.google.cloud.translation.v3.IListExamplesRequest, options?: CallOptions): Promise<[
        protos.google.cloud.translation.v3.IExample[],
        protos.google.cloud.translation.v3.IListExamplesRequest | null,
        protos.google.cloud.translation.v3.IListExamplesResponse
    ]>;

Lists sentence pairs in the dataset.

Parameters
Name Description
request IListExamplesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.translation.v3.IExample[], protos.google.cloud.translation.v3.IListExamplesRequest | null, protos.google.cloud.translation.v3.IListExamplesResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of Example. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listExamplesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listExamples(request, options, callback)

listExamples(request: protos.google.cloud.translation.v3.IListExamplesRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.translation.v3.IListExamplesRequest, protos.google.cloud.translation.v3.IListExamplesResponse | null | undefined, protos.google.cloud.translation.v3.IExample>): void;
Parameters
Name Description
request IListExamplesRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.translation.v3.IListExamplesRequest, protos.google.cloud.translation.v3.IListExamplesResponse | null | undefined, protos.google.cloud.translation.v3.IExample>
Returns
Type Description
void

listExamples(request, callback)

listExamples(request: protos.google.cloud.translation.v3.IListExamplesRequest, callback: PaginationCallback<protos.google.cloud.translation.v3.IListExamplesRequest, protos.google.cloud.translation.v3.IListExamplesResponse | null | undefined, protos.google.cloud.translation.v3.IExample>): void;
Parameters
Name Description
request IListExamplesRequest
callback PaginationCallback<protos.google.cloud.translation.v3.IListExamplesRequest, protos.google.cloud.translation.v3.IListExamplesResponse | null | undefined, protos.google.cloud.translation.v3.IExample>
Returns
Type Description
void

listExamplesAsync(request, options)

listExamplesAsync(request?: protos.google.cloud.translation.v3.IListExamplesRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.translation.v3.IExample>;

Equivalent to listExamples, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
Name Description
request IListExamplesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.translation.v3.IExample>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Example. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Name of the parent dataset. In form of
   *  `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}`
   */
  // const parent = 'abc123'
  /**
   *  Optional. An expression for filtering the examples that will be returned.
   *  Example filter:
   *  * `usage=TRAIN`
   */
  // const filter = 'abc123'
  /**
   *  Optional. Requested page size. The server can return fewer results than
   *  requested.
   */
  // const pageSize = 1234
  /**
   *  Optional. A token identifying a page of results for the server to return.
   *  Typically obtained from next_page_token field in the response of a
   *  ListExamples call.
   */
  // const pageToken = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callListExamples() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = translationClient.listExamplesAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListExamples();

listExamplesStream(request, options)

listExamplesStream(request?: protos.google.cloud.translation.v3.IListExamplesRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
Name Description
request IListExamplesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Transform

{Stream} An object stream which emits an object representing Example on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listExamplesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listGlossaries(request, options)

listGlossaries(request?: protos.google.cloud.translation.v3.IListGlossariesRequest, options?: CallOptions): Promise<[
        protos.google.cloud.translation.v3.IGlossary[],
        protos.google.cloud.translation.v3.IListGlossariesRequest | null,
        protos.google.cloud.translation.v3.IListGlossariesResponse
    ]>;

Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist.

Parameters
Name Description
request IListGlossariesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.translation.v3.IGlossary[], protos.google.cloud.translation.v3.IListGlossariesRequest | null, protos.google.cloud.translation.v3.IListGlossariesResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listGlossariesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listGlossaries(request, options, callback)

listGlossaries(request: protos.google.cloud.translation.v3.IListGlossariesRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.translation.v3.IListGlossariesRequest, protos.google.cloud.translation.v3.IListGlossariesResponse | null | undefined, protos.google.cloud.translation.v3.IGlossary>): void;
Parameters
Name Description
request IListGlossariesRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.translation.v3.IListGlossariesRequest, protos.google.cloud.translation.v3.IListGlossariesResponse | null | undefined, protos.google.cloud.translation.v3.IGlossary>
Returns
Type Description
void

listGlossaries(request, callback)

listGlossaries(request: protos.google.cloud.translation.v3.IListGlossariesRequest, callback: PaginationCallback<protos.google.cloud.translation.v3.IListGlossariesRequest, protos.google.cloud.translation.v3.IListGlossariesResponse | null | undefined, protos.google.cloud.translation.v3.IGlossary>): void;
Parameters
Name Description
request IListGlossariesRequest
callback PaginationCallback<protos.google.cloud.translation.v3.IListGlossariesRequest, protos.google.cloud.translation.v3.IListGlossariesResponse | null | undefined, protos.google.cloud.translation.v3.IGlossary>
Returns
Type Description
void

listGlossariesAsync(request, options)

listGlossariesAsync(request?: protos.google.cloud.translation.v3.IListGlossariesRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.translation.v3.IGlossary>;

Equivalent to listGlossaries, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
Name Description
request IListGlossariesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.translation.v3.IGlossary>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the project from which to list all of the glossaries.
   */
  // const parent = 'abc123'
  /**
   *  Optional. Requested page size. The server may return fewer glossaries than
   *  requested. If unspecified, the server picks an appropriate default.
   */
  // const pageSize = 1234
  /**
   *  Optional. A token identifying a page of results the server should return.
   *  Typically, this is the value of ListGlossariesResponse.next_page_token 
   *  returned from the previous call to `ListGlossaries` method.
   *  The first page is returned if `page_token`is empty or missing.
   */
  // const pageToken = 'abc123'
  /**
   *  Optional. Filter specifying constraints of a list operation.
   *  Specify the constraint by the format of "key=value", where key must be
   *  "src" or "tgt", and the value must be a valid language code.
   *  For multiple restrictions, concatenate them by "AND" (uppercase only),
   *  such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used
   *  here, which means using 'en-US' and 'en' can lead to different results,
   *  which depends on the language code you used when you create the glossary.
   *  For the unidirectional glossaries, the "src" and "tgt" add restrictions
   *  on the source and target language code separately.
   *  For the equivalent term set glossaries, the "src" and/or "tgt" add
   *  restrictions on the term set.
   *  For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional
   *  glossaries which exactly match the source language code as "en-US" and the
   *  target language code "zh-CN", but all equivalent term set glossaries which
   *  contain "en-US" and "zh-CN" in their language set will be picked.
   *  If missing, no filtering is performed.
   */
  // const filter = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callListGlossaries() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = translationClient.listGlossariesAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListGlossaries();

listGlossariesStream(request, options)

listGlossariesStream(request?: protos.google.cloud.translation.v3.IListGlossariesRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
Name Description
request IListGlossariesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Transform

{Stream} An object stream which emits an object representing on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listGlossariesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listGlossaryEntries(request, options)

listGlossaryEntries(request?: protos.google.cloud.translation.v3.IListGlossaryEntriesRequest, options?: CallOptions): Promise<[
        protos.google.cloud.translation.v3.IGlossaryEntry[],
        protos.google.cloud.translation.v3.IListGlossaryEntriesRequest | null,
        protos.google.cloud.translation.v3.IListGlossaryEntriesResponse
    ]>;

List the entries for the glossary.

Parameters
Name Description
request IListGlossaryEntriesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.translation.v3.IGlossaryEntry[], protos.google.cloud.translation.v3.IListGlossaryEntriesRequest | null, protos.google.cloud.translation.v3.IListGlossaryEntriesResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listGlossaryEntriesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listGlossaryEntries(request, options, callback)

listGlossaryEntries(request: protos.google.cloud.translation.v3.IListGlossaryEntriesRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.translation.v3.IListGlossaryEntriesRequest, protos.google.cloud.translation.v3.IListGlossaryEntriesResponse | null | undefined, protos.google.cloud.translation.v3.IGlossaryEntry>): void;
Parameters
Name Description
request IListGlossaryEntriesRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.translation.v3.IListGlossaryEntriesRequest, protos.google.cloud.translation.v3.IListGlossaryEntriesResponse | null | undefined, protos.google.cloud.translation.v3.IGlossaryEntry>
Returns
Type Description
void

listGlossaryEntries(request, callback)

listGlossaryEntries(request: protos.google.cloud.translation.v3.IListGlossaryEntriesRequest, callback: PaginationCallback<protos.google.cloud.translation.v3.IListGlossaryEntriesRequest, protos.google.cloud.translation.v3.IListGlossaryEntriesResponse | null | undefined, protos.google.cloud.translation.v3.IGlossaryEntry>): void;
Parameters
Name Description
request IListGlossaryEntriesRequest
callback PaginationCallback<protos.google.cloud.translation.v3.IListGlossaryEntriesRequest, protos.google.cloud.translation.v3.IListGlossaryEntriesResponse | null | undefined, protos.google.cloud.translation.v3.IGlossaryEntry>
Returns
Type Description
void

listGlossaryEntriesAsync(request, options)

listGlossaryEntriesAsync(request?: protos.google.cloud.translation.v3.IListGlossaryEntriesRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.translation.v3.IGlossaryEntry>;

Equivalent to listGlossaryEntries, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
Name Description
request IListGlossaryEntriesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.translation.v3.IGlossaryEntry>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The parent glossary resource name for listing the glossary's
   *  entries.
   */
  // const parent = 'abc123'
  /**
   *  Optional. Requested page size. The server may return fewer glossary entries
   *  than requested. If unspecified, the server picks an appropriate default.
   */
  // const pageSize = 1234
  /**
   *  Optional. A token identifying a page of results the server should return.
   *  Typically, this is the value of
   *  ListGlossaryEntriesResponse.next_page_token  returned from the previous
   *  call. The first page is returned if `page_token`is empty or missing.
   */
  // const pageToken = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callListGlossaryEntries() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = translationClient.listGlossaryEntriesAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListGlossaryEntries();

listGlossaryEntriesStream(request, options)

listGlossaryEntriesStream(request?: protos.google.cloud.translation.v3.IListGlossaryEntriesRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
Name Description
request IListGlossaryEntriesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Transform

{Stream} An object stream which emits an object representing on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listGlossaryEntriesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listLocationsAsync(request, options)

listLocationsAsync(request: LocationProtos.google.cloud.location.IListLocationsRequest, options?: CallOptions): AsyncIterable<LocationProtos.google.cloud.location.ILocation>;

Lists information about the supported locations for this service. Returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
Name Description
request LocationProtos.google.cloud.location.IListLocationsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<google.cloud.location.ILocation>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

const iterable = client.listLocationsAsync(request);
for await (const response of iterable) {
  // process response
}

listModels(request, options)

listModels(request?: protos.google.cloud.translation.v3.IListModelsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.translation.v3.IModel[],
        protos.google.cloud.translation.v3.IListModelsRequest | null,
        protos.google.cloud.translation.v3.IListModelsResponse
    ]>;

Lists models.

Parameters
Name Description
request IListModelsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.translation.v3.IModel[], protos.google.cloud.translation.v3.IListModelsRequest | null, protos.google.cloud.translation.v3.IListModelsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of Model. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listModelsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listModels(request, options, callback)

listModels(request: protos.google.cloud.translation.v3.IListModelsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.translation.v3.IListModelsRequest, protos.google.cloud.translation.v3.IListModelsResponse | null | undefined, protos.google.cloud.translation.v3.IModel>): void;
Parameters
Name Description
request IListModelsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.translation.v3.IListModelsRequest, protos.google.cloud.translation.v3.IListModelsResponse | null | undefined, protos.google.cloud.translation.v3.IModel>
Returns
Type Description
void

listModels(request, callback)

listModels(request: protos.google.cloud.translation.v3.IListModelsRequest, callback: PaginationCallback<protos.google.cloud.translation.v3.IListModelsRequest, protos.google.cloud.translation.v3.IListModelsResponse | null | undefined, protos.google.cloud.translation.v3.IModel>): void;
Parameters
Name Description
request IListModelsRequest
callback PaginationCallback<protos.google.cloud.translation.v3.IListModelsRequest, protos.google.cloud.translation.v3.IListModelsResponse | null | undefined, protos.google.cloud.translation.v3.IModel>
Returns
Type Description
void

listModelsAsync(request, options)

listModelsAsync(request?: protos.google.cloud.translation.v3.IListModelsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.translation.v3.IModel>;

Equivalent to listModels, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
Name Description
request IListModelsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.translation.v3.IModel>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Model. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Name of the parent project. In form of
   *  `projects/{project-number-or-id}/locations/{location-id}`
   */
  // const parent = 'abc123'
  /**
   *  Optional. An expression for filtering the models that will be returned.
   *  Supported filter:
   *  `dataset_id=${dataset_id}`
   */
  // const filter = 'abc123'
  /**
   *  Optional. Requested page size. The server can return fewer results than
   *  requested.
   */
  // const pageSize = 1234
  /**
   *  Optional. A token identifying a page of results for the server to return.
   *  Typically obtained from next_page_token field in the response of a
   *  ListModels call.
   */
  // const pageToken = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callListModels() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = translationClient.listModelsAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListModels();

listModelsStream(request, options)

listModelsStream(request?: protos.google.cloud.translation.v3.IListModelsRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
Name Description
request IListModelsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Transform

{Stream} An object stream which emits an object representing Model on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listModelsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listOperationsAsync(request, options)

listOperationsAsync(request: protos.google.longrunning.ListOperationsRequest, options?: gax.CallOptions): AsyncIterable<protos.google.longrunning.ListOperationsResponse>;

Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED. Returns an iterable object.

For-await-of syntax is used with the iterable to recursively get response element on-demand.

Parameters
Name Description
request ListOperationsRequest

The request object that will be sent.

options CallOptions

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

Returns
Type Description
AsyncIterable<protos.google.longrunning.ListOperationsResponse>

{Object} An iterable Object that conforms to iteration protocols.

Example

const client = longrunning.operationsClient();
for await (const response of client.listOperationsAsync(request));
// doThingsWith(response)

locationPath(project, location)

locationPath(project: string, location: string): string;

Return a fully-qualified location resource name string.

Parameters
Name Description
project string
location string
Returns
Type Description
string

{string} Resource name string.

matchDatasetFromAdaptiveMtDatasetName(adaptiveMtDatasetName)

matchDatasetFromAdaptiveMtDatasetName(adaptiveMtDatasetName: string): string | number;

Parse the dataset from AdaptiveMtDataset resource.

Parameter
Name Description
adaptiveMtDatasetName string

A fully-qualified path representing AdaptiveMtDataset resource.

Returns
Type Description
string | number

{string} A string representing the dataset.

matchDatasetFromAdaptiveMtFileName(adaptiveMtFileName)

matchDatasetFromAdaptiveMtFileName(adaptiveMtFileName: string): string | number;

Parse the dataset from AdaptiveMtFile resource.

Parameter
Name Description
adaptiveMtFileName string

A fully-qualified path representing AdaptiveMtFile resource.

Returns
Type Description
string | number

{string} A string representing the dataset.

matchDatasetFromAdaptiveMtSentenceName(adaptiveMtSentenceName)

matchDatasetFromAdaptiveMtSentenceName(adaptiveMtSentenceName: string): string | number;

Parse the dataset from AdaptiveMtSentence resource.

Parameter
Name Description
adaptiveMtSentenceName string

A fully-qualified path representing AdaptiveMtSentence resource.

Returns
Type Description
string | number

{string} A string representing the dataset.

matchDatasetFromDatasetName(datasetName)

matchDatasetFromDatasetName(datasetName: string): string | number;

Parse the dataset from Dataset resource.

Parameter
Name Description
datasetName string

A fully-qualified path representing Dataset resource.

Returns
Type Description
string | number

{string} A string representing the dataset.

matchDatasetFromExampleName(exampleName)

matchDatasetFromExampleName(exampleName: string): string | number;

Parse the dataset from Example resource.

Parameter
Name Description
exampleName string

A fully-qualified path representing Example resource.

Returns
Type Description
string | number

{string} A string representing the dataset.

matchExampleFromExampleName(exampleName)

matchExampleFromExampleName(exampleName: string): string | number;

Parse the example from Example resource.

Parameter
Name Description
exampleName string

A fully-qualified path representing Example resource.

Returns
Type Description
string | number

{string} A string representing the example.

matchFileFromAdaptiveMtFileName(adaptiveMtFileName)

matchFileFromAdaptiveMtFileName(adaptiveMtFileName: string): string | number;

Parse the file from AdaptiveMtFile resource.

Parameter
Name Description
adaptiveMtFileName string

A fully-qualified path representing AdaptiveMtFile resource.

Returns
Type Description
string | number

{string} A string representing the file.

matchFileFromAdaptiveMtSentenceName(adaptiveMtSentenceName)

matchFileFromAdaptiveMtSentenceName(adaptiveMtSentenceName: string): string | number;

Parse the file from AdaptiveMtSentence resource.

Parameter
Name Description
adaptiveMtSentenceName string

A fully-qualified path representing AdaptiveMtSentence resource.

Returns
Type Description
string | number

{string} A string representing the file.

matchGlossaryEntryFromGlossaryEntryName(glossaryEntryName)

matchGlossaryEntryFromGlossaryEntryName(glossaryEntryName: string): string | number;

Parse the glossary_entry from GlossaryEntry resource.

Parameter
Name Description
glossaryEntryName string

A fully-qualified path representing GlossaryEntry resource.

Returns
Type Description
string | number

{string} A string representing the glossary_entry.

matchGlossaryFromGlossaryEntryName(glossaryEntryName)

matchGlossaryFromGlossaryEntryName(glossaryEntryName: string): string | number;

Parse the glossary from GlossaryEntry resource.

Parameter
Name Description
glossaryEntryName string

A fully-qualified path representing GlossaryEntry resource.

Returns
Type Description
string | number

{string} A string representing the glossary.

matchGlossaryFromGlossaryName(glossaryName)

matchGlossaryFromGlossaryName(glossaryName: string): string | number;

Parse the glossary from Glossary resource.

Parameter
Name Description
glossaryName string

A fully-qualified path representing Glossary resource.

Returns
Type Description
string | number

{string} A string representing the glossary.

matchLocationFromAdaptiveMtDatasetName(adaptiveMtDatasetName)

matchLocationFromAdaptiveMtDatasetName(adaptiveMtDatasetName: string): string | number;

Parse the location from AdaptiveMtDataset resource.

Parameter
Name Description
adaptiveMtDatasetName string

A fully-qualified path representing AdaptiveMtDataset resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromAdaptiveMtFileName(adaptiveMtFileName)

matchLocationFromAdaptiveMtFileName(adaptiveMtFileName: string): string | number;

Parse the location from AdaptiveMtFile resource.

Parameter
Name Description
adaptiveMtFileName string

A fully-qualified path representing AdaptiveMtFile resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromAdaptiveMtSentenceName(adaptiveMtSentenceName)

matchLocationFromAdaptiveMtSentenceName(adaptiveMtSentenceName: string): string | number;

Parse the location from AdaptiveMtSentence resource.

Parameter
Name Description
adaptiveMtSentenceName string

A fully-qualified path representing AdaptiveMtSentence resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromDatasetName(datasetName)

matchLocationFromDatasetName(datasetName: string): string | number;

Parse the location from Dataset resource.

Parameter
Name Description
datasetName string

A fully-qualified path representing Dataset resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromExampleName(exampleName)

matchLocationFromExampleName(exampleName: string): string | number;

Parse the location from Example resource.

Parameter
Name Description
exampleName string

A fully-qualified path representing Example resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromGlossaryEntryName(glossaryEntryName)

matchLocationFromGlossaryEntryName(glossaryEntryName: string): string | number;

Parse the location from GlossaryEntry resource.

Parameter
Name Description
glossaryEntryName string

A fully-qualified path representing GlossaryEntry resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromGlossaryName(glossaryName)

matchLocationFromGlossaryName(glossaryName: string): string | number;

Parse the location from Glossary resource.

Parameter
Name Description
glossaryName string

A fully-qualified path representing Glossary resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromLocationName(locationName)

matchLocationFromLocationName(locationName: string): string | number;

Parse the location from Location resource.

Parameter
Name Description
locationName string

A fully-qualified path representing Location resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromModelName(modelName)

matchLocationFromModelName(modelName: string): string | number;

Parse the location from Model resource.

Parameter
Name Description
modelName string

A fully-qualified path representing Model resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchModelFromModelName(modelName)

matchModelFromModelName(modelName: string): string | number;

Parse the model from Model resource.

Parameter
Name Description
modelName string

A fully-qualified path representing Model resource.

Returns
Type Description
string | number

{string} A string representing the model.

matchProjectFromAdaptiveMtDatasetName(adaptiveMtDatasetName)

matchProjectFromAdaptiveMtDatasetName(adaptiveMtDatasetName: string): string | number;

Parse the project from AdaptiveMtDataset resource.

Parameter
Name Description
adaptiveMtDatasetName string

A fully-qualified path representing AdaptiveMtDataset resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromAdaptiveMtFileName(adaptiveMtFileName)

matchProjectFromAdaptiveMtFileName(adaptiveMtFileName: string): string | number;

Parse the project from AdaptiveMtFile resource.

Parameter
Name Description
adaptiveMtFileName string

A fully-qualified path representing AdaptiveMtFile resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromAdaptiveMtSentenceName(adaptiveMtSentenceName)

matchProjectFromAdaptiveMtSentenceName(adaptiveMtSentenceName: string): string | number;

Parse the project from AdaptiveMtSentence resource.

Parameter
Name Description
adaptiveMtSentenceName string

A fully-qualified path representing AdaptiveMtSentence resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromDatasetName(datasetName)

matchProjectFromDatasetName(datasetName: string): string | number;

Parse the project from Dataset resource.

Parameter
Name Description
datasetName string

A fully-qualified path representing Dataset resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromExampleName(exampleName)

matchProjectFromExampleName(exampleName: string): string | number;

Parse the project from Example resource.

Parameter
Name Description
exampleName string

A fully-qualified path representing Example resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromGlossaryEntryName(glossaryEntryName)

matchProjectFromGlossaryEntryName(glossaryEntryName: string): string | number;

Parse the project from GlossaryEntry resource.

Parameter
Name Description
glossaryEntryName string

A fully-qualified path representing GlossaryEntry resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromGlossaryName(glossaryName)

matchProjectFromGlossaryName(glossaryName: string): string | number;

Parse the project from Glossary resource.

Parameter
Name Description
glossaryName string

A fully-qualified path representing Glossary resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromLocationName(locationName)

matchProjectFromLocationName(locationName: string): string | number;

Parse the project from Location resource.

Parameter
Name Description
locationName string

A fully-qualified path representing Location resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromModelName(modelName)

matchProjectFromModelName(modelName: string): string | number;

Parse the project from Model resource.

Parameter
Name Description
modelName string

A fully-qualified path representing Model resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchSentenceFromAdaptiveMtSentenceName(adaptiveMtSentenceName)

matchSentenceFromAdaptiveMtSentenceName(adaptiveMtSentenceName: string): string | number;

Parse the sentence from AdaptiveMtSentence resource.

Parameter
Name Description
adaptiveMtSentenceName string

A fully-qualified path representing AdaptiveMtSentence resource.

Returns
Type Description
string | number

{string} A string representing the sentence.

modelPath(project, location, model)

modelPath(project: string, location: string, model: string): string;

Return a fully-qualified model resource name string.

Parameters
Name Description
project string
location string
model string
Returns
Type Description
string

{string} Resource name string.

romanizeText(request, options)

romanizeText(request?: protos.google.cloud.translation.v3.IRomanizeTextRequest, options?: CallOptions): Promise<[
        protos.google.cloud.translation.v3.IRomanizeTextResponse,
        protos.google.cloud.translation.v3.IRomanizeTextRequest | undefined,
        {} | undefined
    ]>;

Romanize input text written in non-Latin scripts to Latin text.

Parameters
Name Description
request IRomanizeTextRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.translation.v3.IRomanizeTextResponse, protos.google.cloud.translation.v3.IRomanizeTextRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing RomanizeTextResponse. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Project or location to make a call. Must refer to a caller's
   *  project.
   *  Format: `projects/{project-number-or-id}/locations/{location-id}` or
   *  `projects/{project-number-or-id}`.
   *  For global calls, use `projects/{project-number-or-id}/locations/global` or
   *  `projects/{project-number-or-id}`.
   */
  // const parent = 'abc123'
  /**
   *  Required. The content of the input in string format.
   */
  // const contents = ['abc','def']
  /**
   *  Optional. The ISO-639 language code of the input text if
   *  known, for example, "hi" or "zh". If the source language isn't specified,
   *  the API attempts to identify the source language automatically and returns
   *  the source language for each content in the response.
   */
  // const sourceLanguageCode = 'abc123'

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callRomanizeText() {
    // Construct request
    const request = {
      parent,
      contents,
    };

    // Run request
    const response = await translationClient.romanizeText(request);
    console.log(response);
  }

  callRomanizeText();

romanizeText(request, options, callback)

romanizeText(request: protos.google.cloud.translation.v3.IRomanizeTextRequest, options: CallOptions, callback: Callback<protos.google.cloud.translation.v3.IRomanizeTextResponse, protos.google.cloud.translation.v3.IRomanizeTextRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IRomanizeTextRequest
options CallOptions
callback Callback<protos.google.cloud.translation.v3.IRomanizeTextResponse, protos.google.cloud.translation.v3.IRomanizeTextRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

romanizeText(request, callback)

romanizeText(request: protos.google.cloud.translation.v3.IRomanizeTextRequest, callback: Callback<protos.google.cloud.translation.v3.IRomanizeTextResponse, protos.google.cloud.translation.v3.IRomanizeTextRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IRomanizeTextRequest
callback Callback<protos.google.cloud.translation.v3.IRomanizeTextResponse, protos.google.cloud.translation.v3.IRomanizeTextRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

setIamPolicy(request, options, callback)

setIamPolicy(request: IamProtos.google.iam.v1.SetIamPolicyRequest, options?: gax.CallOptions | Callback<IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined>, callback?: Callback<IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined>): Promise<[IamProtos.google.iam.v1.Policy]>;

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Parameters
Name Description
request IamProtos.google.iam.v1.SetIamPolicyRequest

The request object that will be sent.

options CallOptions | Callback<google.iam.v1.Policy, google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<google.iam.v1.Policy, google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined>

The function which will be called with the result of the API call.

The second parameter to the callback is an object representing .

Returns
Type Description
Promise<[google.iam.v1.Policy]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.

testIamPermissions(request, options, callback)

testIamPermissions(request: IamProtos.google.iam.v1.TestIamPermissionsRequest, options?: gax.CallOptions | Callback<IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined>, callback?: Callback<IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined>): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]>;

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Parameters
Name Description
request IamProtos.google.iam.v1.TestIamPermissionsRequest

The request object that will be sent.

options CallOptions | Callback<google.iam.v1.TestIamPermissionsResponse, google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<google.iam.v1.TestIamPermissionsResponse, google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined>

The function which will be called with the result of the API call.

The second parameter to the callback is an object representing .

Returns
Type Description
Promise<[google.iam.v1.TestIamPermissionsResponse]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.

translateDocument(request, options)

translateDocument(request?: protos.google.cloud.translation.v3.ITranslateDocumentRequest, options?: CallOptions): Promise<[
        protos.google.cloud.translation.v3.ITranslateDocumentResponse,
        protos.google.cloud.translation.v3.ITranslateDocumentRequest | undefined,
        {} | undefined
    ]>;

Translates documents in synchronous mode.

Parameters
Name Description
request ITranslateDocumentRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.translation.v3.ITranslateDocumentResponse, protos.google.cloud.translation.v3.ITranslateDocumentRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing TranslateDocumentResponse. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Location to make a regional call.
   *  Format: `projects/{project-number-or-id}/locations/{location-id}`.
   *  For global calls, use `projects/{project-number-or-id}/locations/global` or
   *  `projects/{project-number-or-id}`.
   *  Non-global location is required for requests using AutoML models or custom
   *  glossaries.
   *  Models and glossaries must be within the same region (have the same
   *  location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
   */
  // const parent = 'abc123'
  /**
   *  Optional. The ISO-639 language code of the input document if known, for
   *  example, "en-US" or "sr-Latn". Supported language codes are listed in
   *  Language Support. If the source language isn't specified, the API attempts
   *  to identify the source language automatically and returns the source
   *  language within the response. Source language must be specified if the
   *  request contains a glossary or a custom model.
   */
  // const sourceLanguageCode = 'abc123'
  /**
   *  Required. The ISO-639 language code to use for translation of the input
   *  document, set to one of the language codes listed in Language Support.
   */
  // const targetLanguageCode = 'abc123'
  /**
   *  Required. Input configurations.
   */
  // const documentInputConfig = {}
  /**
   *  Optional. Output configurations.
   *  Defines if the output file should be stored within Cloud Storage as well
   *  as the desired output format. If not provided the translated file will
   *  only be returned through a byte-stream and its output mime type will be
   *  the same as the input file's mime type.
   */
  // const documentOutputConfig = {}
  /**
   *  Optional. The `model` type requested for this translation.
   *  The format depends on model type:
   *  - AutoML Translation models:
   *    `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
   *  - General (built-in) models:
   *    `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
   *  If not provided, the default Google model (NMT) will be used for
   *  translation.
   */
  // const model = 'abc123'
  /**
   *  Optional. Glossary to be applied. The glossary must be within the same
   *  region (have the same location-id) as the model, otherwise an
   *  INVALID_ARGUMENT (400) error is returned.
   */
  // const glossaryConfig = {}
  /**
   *  Optional. The labels with user-defined metadata for the request.
   *  Label keys and values can be no longer than 63 characters (Unicode
   *  codepoints), can only contain lowercase letters, numeric characters,
   *  underscores and dashes. International characters are allowed. Label values
   *  are optional. Label keys must start with a letter.
   *  See https://cloud.google.com/translate/docs/advanced/labels for more
   *  information.
   */
  // const labels = [1,2,3,4]
  /**
   *  Optional. This flag is to support user customized attribution.
   *  If not provided, the default is `Machine Translated by Google`.
   *  Customized attribution should follow rules in
   *  https://cloud.google.com/translate/attribution#attribution_and_logos
   */
  // const customizedAttribution = 'abc123'
  /**
   *  Optional. is_translate_native_pdf_only field for external customers.
   *  If true, the page limit of online native pdf translation is 300 and only
   *  native pdf pages will be translated.
   */
  // const isTranslateNativePdfOnly = true
  /**
   *  Optional. If true, use the text removal server to remove the shadow text on
   *  background image for native pdf translation.
   *  Shadow removal feature can only be enabled when
   *  is_translate_native_pdf_only: false && pdf_native_only: false
   */
  // const enableShadowRemovalNativePdf = true
  /**
   *  Optional. If true, enable auto rotation correction in DVS.
   */
  // const enableRotationCorrection = true

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callTranslateDocument() {
    // Construct request
    const request = {
      parent,
      targetLanguageCode,
      documentInputConfig,
    };

    // Run request
    const response = await translationClient.translateDocument(request);
    console.log(response);
  }

  callTranslateDocument();

translateDocument(request, options, callback)

translateDocument(request: protos.google.cloud.translation.v3.ITranslateDocumentRequest, options: CallOptions, callback: Callback<protos.google.cloud.translation.v3.ITranslateDocumentResponse, protos.google.cloud.translation.v3.ITranslateDocumentRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ITranslateDocumentRequest
options CallOptions
callback Callback<protos.google.cloud.translation.v3.ITranslateDocumentResponse, protos.google.cloud.translation.v3.ITranslateDocumentRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

translateDocument(request, callback)

translateDocument(request: protos.google.cloud.translation.v3.ITranslateDocumentRequest, callback: Callback<protos.google.cloud.translation.v3.ITranslateDocumentResponse, protos.google.cloud.translation.v3.ITranslateDocumentRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ITranslateDocumentRequest
callback Callback<protos.google.cloud.translation.v3.ITranslateDocumentResponse, protos.google.cloud.translation.v3.ITranslateDocumentRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

translateText(request, options)

translateText(request?: protos.google.cloud.translation.v3.ITranslateTextRequest, options?: CallOptions): Promise<[
        protos.google.cloud.translation.v3.ITranslateTextResponse,
        protos.google.cloud.translation.v3.ITranslateTextRequest | undefined,
        {} | undefined
    ]>;

Translates input text and returns translated text.

Parameters
Name Description
request ITranslateTextRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.translation.v3.ITranslateTextResponse, protos.google.cloud.translation.v3.ITranslateTextRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing TranslateTextResponse. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The content of the input in string format.
   *  We recommend the total content be less than 30,000 codepoints. The max
   *  length of this field is 1024. Use BatchTranslateText for larger text.
   */
  // const contents = ['abc','def']
  /**
   *  Optional. The format of the source text, for example, "text/html",
   *   "text/plain". If left blank, the MIME type defaults to "text/html".
   */
  // const mimeType = 'abc123'
  /**
   *  Optional. The ISO-639 language code of the input text if
   *  known, for example, "en-US" or "sr-Latn". Supported language codes are
   *  listed in Language Support. If the source language isn't specified, the API
   *  attempts to identify the source language automatically and returns the
   *  source language within the response.
   */
  // const sourceLanguageCode = 'abc123'
  /**
   *  Required. The ISO-639 language code to use for translation of the input
   *  text, set to one of the language codes listed in Language Support.
   */
  // const targetLanguageCode = 'abc123'
  /**
   *  Required. Project or location to make a call. Must refer to a caller's
   *  project.
   *  Format: `projects/{project-number-or-id}` or
   *  `projects/{project-number-or-id}/locations/{location-id}`.
   *  For global calls, use `projects/{project-number-or-id}/locations/global` or
   *  `projects/{project-number-or-id}`.
   *  Non-global location is required for requests using AutoML models or
   *  custom glossaries.
   *  Models and glossaries must be within the same region (have same
   *  location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
   */
  // const parent = 'abc123'
  /**
   *  Optional. The `model` type requested for this translation.
   *  The format depends on model type:
   *  - AutoML Translation models:
   *    `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
   *  - General (built-in) models:
   *    `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
   *  - Translation LLM models:
   *    `projects/{project-number-or-id}/locations/{location-id}/models/general/translation-llm`,
   *  For global (non-regionalized) requests, use `location-id` `global`.
   *  For example,
   *  `projects/{project-number-or-id}/locations/global/models/general/nmt`.
   *  If not provided, the default Google model (NMT) will be used
   */
  // const model = 'abc123'
  /**
   *  Optional. Glossary to be applied. The glossary must be
   *  within the same region (have the same location-id) as the model, otherwise
   *  an INVALID_ARGUMENT (400) error is returned.
   */
  // const glossaryConfig = {}
  /**
   *  Optional. Transliteration to be applied.
   */
  // const transliterationConfig = {}
  /**
   *  Optional. The labels with user-defined metadata for the request.
   *  Label keys and values can be no longer than 63 characters
   *  (Unicode codepoints), can only contain lowercase letters, numeric
   *  characters, underscores and dashes. International characters are allowed.
   *  Label values are optional. Label keys must start with a letter.
   *  See https://cloud.google.com/translate/docs/advanced/labels for more
   *  information.
   */
  // const labels = [1,2,3,4]

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callTranslateText() {
    // Construct request
    const request = {
      contents,
      targetLanguageCode,
      parent,
    };

    // Run request
    const response = await translationClient.translateText(request);
    console.log(response);
  }

  callTranslateText();

translateText(request, options, callback)

translateText(request: protos.google.cloud.translation.v3.ITranslateTextRequest, options: CallOptions, callback: Callback<protos.google.cloud.translation.v3.ITranslateTextResponse, protos.google.cloud.translation.v3.ITranslateTextRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ITranslateTextRequest
options CallOptions
callback Callback<protos.google.cloud.translation.v3.ITranslateTextResponse, protos.google.cloud.translation.v3.ITranslateTextRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

translateText(request, callback)

translateText(request: protos.google.cloud.translation.v3.ITranslateTextRequest, callback: Callback<protos.google.cloud.translation.v3.ITranslateTextResponse, protos.google.cloud.translation.v3.ITranslateTextRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ITranslateTextRequest
callback Callback<protos.google.cloud.translation.v3.ITranslateTextResponse, protos.google.cloud.translation.v3.ITranslateTextRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateGlossary(request, options)

updateGlossary(request?: protos.google.cloud.translation.v3.IUpdateGlossaryRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.translation.v3.IGlossary, protos.google.cloud.translation.v3.IUpdateGlossaryMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Updates a glossary. A LRO is used since the update can be async if the glossary's entry file is updated.

Parameters
Name Description
request IUpdateGlossaryRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ LROperation<protos.google.cloud.translation.v3.IGlossary, protos.google.cloud.translation.v3.IUpdateGlossaryMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The glossary entry to update.
   */
  // const glossary = {}
  /**
   *  The list of fields to be updated. Currently only `display_name` and
   *  'input_config'
   */
  // const updateMask = {}

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callUpdateGlossary() {
    // Construct request
    const request = {
      glossary,
    };

    // Run request
    const [operation] = await translationClient.updateGlossary(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callUpdateGlossary();

updateGlossary(request, options, callback)

updateGlossary(request: protos.google.cloud.translation.v3.IUpdateGlossaryRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.translation.v3.IGlossary, protos.google.cloud.translation.v3.IUpdateGlossaryMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateGlossaryRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.translation.v3.IGlossary, protos.google.cloud.translation.v3.IUpdateGlossaryMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateGlossary(request, callback)

updateGlossary(request: protos.google.cloud.translation.v3.IUpdateGlossaryRequest, callback: Callback<LROperation<protos.google.cloud.translation.v3.IGlossary, protos.google.cloud.translation.v3.IUpdateGlossaryMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateGlossaryRequest
callback Callback<LROperation<protos.google.cloud.translation.v3.IGlossary, protos.google.cloud.translation.v3.IUpdateGlossaryMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateGlossaryEntry(request, options)

updateGlossaryEntry(request?: protos.google.cloud.translation.v3.IUpdateGlossaryEntryRequest, options?: CallOptions): Promise<[
        protos.google.cloud.translation.v3.IGlossaryEntry,
        (protos.google.cloud.translation.v3.IUpdateGlossaryEntryRequest | undefined),
        {} | undefined
    ]>;

Updates a glossary entry.

Parameters
Name Description
request IUpdateGlossaryEntryRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.translation.v3.IGlossaryEntry, (protos.google.cloud.translation.v3.IUpdateGlossaryEntryRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The glossary entry to update.
   */
  // const glossaryEntry = {}

  // Imports the Translation library
  const {TranslationServiceClient} = require('@google-cloud/translate').v3;

  // Instantiates a client
  const translationClient = new TranslationServiceClient();

  async function callUpdateGlossaryEntry() {
    // Construct request
    const request = {
      glossaryEntry,
    };

    // Run request
    const response = await translationClient.updateGlossaryEntry(request);
    console.log(response);
  }

  callUpdateGlossaryEntry();

updateGlossaryEntry(request, options, callback)

updateGlossaryEntry(request: protos.google.cloud.translation.v3.IUpdateGlossaryEntryRequest, options: CallOptions, callback: Callback<protos.google.cloud.translation.v3.IGlossaryEntry, protos.google.cloud.translation.v3.IUpdateGlossaryEntryRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateGlossaryEntryRequest
options CallOptions
callback Callback<protos.google.cloud.translation.v3.IGlossaryEntry, protos.google.cloud.translation.v3.IUpdateGlossaryEntryRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateGlossaryEntry(request, callback)

updateGlossaryEntry(request: protos.google.cloud.translation.v3.IUpdateGlossaryEntryRequest, callback: Callback<protos.google.cloud.translation.v3.IGlossaryEntry, protos.google.cloud.translation.v3.IUpdateGlossaryEntryRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateGlossaryEntryRequest
callback Callback<protos.google.cloud.translation.v3.IGlossaryEntry, protos.google.cloud.translation.v3.IUpdateGlossaryEntryRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void