Class TranslationServiceClient (2.2.0)

public abstract class TranslationServiceClient

TranslationService client wrapper, for convenient use.

Inheritance

Object > TranslationServiceClient

Namespace

Google.Cloud.Translate.V3

Assembly

Google.Cloud.Translate.V3.dll

Remarks

Provides natural language translation operations.

Properties

BatchTranslateTextOperationsClient

public virtual OperationsClient BatchTranslateTextOperationsClient { get; }

The long-running operations client for BatchTranslateText.

Property Value
TypeDescription
OperationsClient

CreateGlossaryOperationsClient

public virtual OperationsClient CreateGlossaryOperationsClient { get; }

The long-running operations client for CreateGlossary.

Property Value
TypeDescription
OperationsClient

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the TranslationService service, which is a host of "translate.googleapis.com" and a port of 443.

Property Value
TypeDescription
String

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default TranslationService scopes.

Property Value
TypeDescription
IReadOnlyList<String>
Remarks

DeleteGlossaryOperationsClient

public virtual OperationsClient DeleteGlossaryOperationsClient { get; }

The long-running operations client for DeleteGlossary.

Property Value
TypeDescription
OperationsClient

GrpcClient

public virtual TranslationService.TranslationServiceClient GrpcClient { get; }

The underlying gRPC TranslationService client

Property Value
TypeDescription
TranslationService.TranslationServiceClient

Methods

BatchTranslateText(BatchTranslateTextRequest, CallSettings)

public virtual Operation<BatchTranslateResponse, BatchTranslateMetadata> BatchTranslateText(BatchTranslateTextRequest request, CallSettings callSettings = null)

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
NameDescription
requestBatchTranslateTextRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<BatchTranslateResponse, BatchTranslateMetadata>

The RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
// Initialize request argument(s)
BatchTranslateTextRequest request = new BatchTranslateTextRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    SourceLanguageCode = "",
    TargetLanguageCodes = { "", },
    Models = { { "", "" }, },
    InputConfigs = { new InputConfig(), },
    OutputConfig = new OutputConfig(),
    Glossaries =
    {
        {
            "",
            new TranslateTextGlossaryConfig()
        },
    },
    Labels = { { "", "" }, },
};
// Make the request
Operation<BatchTranslateResponse, BatchTranslateMetadata> response = translationServiceClient.BatchTranslateText(request);

// Poll until the returned long-running operation is complete
Operation<BatchTranslateResponse, BatchTranslateMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
BatchTranslateResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<BatchTranslateResponse, BatchTranslateMetadata> retrievedResponse = translationServiceClient.PollOnceBatchTranslateText(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    BatchTranslateResponse retrievedResult = retrievedResponse.Result;
}

BatchTranslateTextAsync(BatchTranslateTextRequest, CallSettings)

public virtual Task<Operation<BatchTranslateResponse, BatchTranslateMetadata>> BatchTranslateTextAsync(BatchTranslateTextRequest request, CallSettings callSettings = null)

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
NameDescription
requestBatchTranslateTextRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<BatchTranslateResponse, BatchTranslateMetadata>>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
BatchTranslateTextRequest request = new BatchTranslateTextRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    SourceLanguageCode = "",
    TargetLanguageCodes = { "", },
    Models = { { "", "" }, },
    InputConfigs = { new InputConfig(), },
    OutputConfig = new OutputConfig(),
    Glossaries =
    {
        {
            "",
            new TranslateTextGlossaryConfig()
        },
    },
    Labels = { { "", "" }, },
};
// Make the request
Operation<BatchTranslateResponse, BatchTranslateMetadata> response = await translationServiceClient.BatchTranslateTextAsync(request);

// Poll until the returned long-running operation is complete
Operation<BatchTranslateResponse, BatchTranslateMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
BatchTranslateResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<BatchTranslateResponse, BatchTranslateMetadata> retrievedResponse = await translationServiceClient.PollOnceBatchTranslateTextAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    BatchTranslateResponse retrievedResult = retrievedResponse.Result;
}

BatchTranslateTextAsync(BatchTranslateTextRequest, CancellationToken)

public virtual Task<Operation<BatchTranslateResponse, BatchTranslateMetadata>> BatchTranslateTextAsync(BatchTranslateTextRequest request, CancellationToken cancellationToken)

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
NameDescription
requestBatchTranslateTextRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<BatchTranslateResponse, BatchTranslateMetadata>>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
BatchTranslateTextRequest request = new BatchTranslateTextRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    SourceLanguageCode = "",
    TargetLanguageCodes = { "", },
    Models = { { "", "" }, },
    InputConfigs = { new InputConfig(), },
    OutputConfig = new OutputConfig(),
    Glossaries =
    {
        {
            "",
            new TranslateTextGlossaryConfig()
        },
    },
    Labels = { { "", "" }, },
};
// Make the request
Operation<BatchTranslateResponse, BatchTranslateMetadata> response = await translationServiceClient.BatchTranslateTextAsync(request);

// Poll until the returned long-running operation is complete
Operation<BatchTranslateResponse, BatchTranslateMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
BatchTranslateResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<BatchTranslateResponse, BatchTranslateMetadata> retrievedResponse = await translationServiceClient.PollOnceBatchTranslateTextAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    BatchTranslateResponse retrievedResult = retrievedResponse.Result;
}

Create()

public static TranslationServiceClient Create()

Synchronously creates a TranslationServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use TranslationServiceClientBuilder .

Returns
TypeDescription
TranslationServiceClient

The created TranslationServiceClient.

CreateAsync(CancellationToken)

public static Task<TranslationServiceClient> CreateAsync(CancellationToken cancellationToken = default(CancellationToken))

Asynchronously creates a TranslationServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use TranslationServiceClientBuilder .

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
Task<TranslationServiceClient>

The task representing the created TranslationServiceClient.

CreateGlossary(LocationName, Glossary, CallSettings)

public virtual Operation<Glossary, CreateGlossaryMetadata> CreateGlossary(LocationName parent, Glossary glossary, CallSettings callSettings = null)

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

Parameters
NameDescription
parentLocationName

Required. The project name.

glossaryGlossary

Required. The glossary to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Glossary, CreateGlossaryMetadata>

The RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Glossary glossary = new Glossary();
// Make the request
Operation<Glossary, CreateGlossaryMetadata> response = translationServiceClient.CreateGlossary(parent, glossary);

// Poll until the returned long-running operation is complete
Operation<Glossary, CreateGlossaryMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Glossary result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Glossary, CreateGlossaryMetadata> retrievedResponse = translationServiceClient.PollOnceCreateGlossary(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Glossary retrievedResult = retrievedResponse.Result;
}

CreateGlossary(CreateGlossaryRequest, CallSettings)

public virtual Operation<Glossary, CreateGlossaryMetadata> CreateGlossary(CreateGlossaryRequest request, CallSettings callSettings = null)

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

Parameters
NameDescription
requestCreateGlossaryRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Glossary, CreateGlossaryMetadata>

The RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
// Initialize request argument(s)
CreateGlossaryRequest request = new CreateGlossaryRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Glossary = new Glossary(),
};
// Make the request
Operation<Glossary, CreateGlossaryMetadata> response = translationServiceClient.CreateGlossary(request);

// Poll until the returned long-running operation is complete
Operation<Glossary, CreateGlossaryMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Glossary result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Glossary, CreateGlossaryMetadata> retrievedResponse = translationServiceClient.PollOnceCreateGlossary(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Glossary retrievedResult = retrievedResponse.Result;
}

CreateGlossary(String, Glossary, CallSettings)

public virtual Operation<Glossary, CreateGlossaryMetadata> CreateGlossary(string parent, Glossary glossary, CallSettings callSettings = null)

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

Parameters
NameDescription
parentString

Required. The project name.

glossaryGlossary

Required. The glossary to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Glossary, CreateGlossaryMetadata>

The RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Glossary glossary = new Glossary();
// Make the request
Operation<Glossary, CreateGlossaryMetadata> response = translationServiceClient.CreateGlossary(parent, glossary);

// Poll until the returned long-running operation is complete
Operation<Glossary, CreateGlossaryMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Glossary result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Glossary, CreateGlossaryMetadata> retrievedResponse = translationServiceClient.PollOnceCreateGlossary(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Glossary retrievedResult = retrievedResponse.Result;
}

CreateGlossaryAsync(LocationName, Glossary, CallSettings)

public virtual Task<Operation<Glossary, CreateGlossaryMetadata>> CreateGlossaryAsync(LocationName parent, Glossary glossary, CallSettings callSettings = null)

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

Parameters
NameDescription
parentLocationName

Required. The project name.

glossaryGlossary

Required. The glossary to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<Glossary, CreateGlossaryMetadata>>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Glossary glossary = new Glossary();
// Make the request
Operation<Glossary, CreateGlossaryMetadata> response = await translationServiceClient.CreateGlossaryAsync(parent, glossary);

// Poll until the returned long-running operation is complete
Operation<Glossary, CreateGlossaryMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Glossary result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Glossary, CreateGlossaryMetadata> retrievedResponse = await translationServiceClient.PollOnceCreateGlossaryAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Glossary retrievedResult = retrievedResponse.Result;
}

CreateGlossaryAsync(LocationName, Glossary, CancellationToken)

public virtual Task<Operation<Glossary, CreateGlossaryMetadata>> CreateGlossaryAsync(LocationName parent, Glossary glossary, CancellationToken cancellationToken)

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

Parameters
NameDescription
parentLocationName

Required. The project name.

glossaryGlossary

Required. The glossary to create.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<Glossary, CreateGlossaryMetadata>>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Glossary glossary = new Glossary();
// Make the request
Operation<Glossary, CreateGlossaryMetadata> response = await translationServiceClient.CreateGlossaryAsync(parent, glossary);

// Poll until the returned long-running operation is complete
Operation<Glossary, CreateGlossaryMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Glossary result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Glossary, CreateGlossaryMetadata> retrievedResponse = await translationServiceClient.PollOnceCreateGlossaryAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Glossary retrievedResult = retrievedResponse.Result;
}

CreateGlossaryAsync(CreateGlossaryRequest, CallSettings)

public virtual Task<Operation<Glossary, CreateGlossaryMetadata>> CreateGlossaryAsync(CreateGlossaryRequest request, CallSettings callSettings = null)

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

Parameters
NameDescription
requestCreateGlossaryRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<Glossary, CreateGlossaryMetadata>>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
CreateGlossaryRequest request = new CreateGlossaryRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Glossary = new Glossary(),
};
// Make the request
Operation<Glossary, CreateGlossaryMetadata> response = await translationServiceClient.CreateGlossaryAsync(request);

// Poll until the returned long-running operation is complete
Operation<Glossary, CreateGlossaryMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Glossary result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Glossary, CreateGlossaryMetadata> retrievedResponse = await translationServiceClient.PollOnceCreateGlossaryAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Glossary retrievedResult = retrievedResponse.Result;
}

CreateGlossaryAsync(CreateGlossaryRequest, CancellationToken)

public virtual Task<Operation<Glossary, CreateGlossaryMetadata>> CreateGlossaryAsync(CreateGlossaryRequest request, CancellationToken cancellationToken)

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

Parameters
NameDescription
requestCreateGlossaryRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<Glossary, CreateGlossaryMetadata>>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
CreateGlossaryRequest request = new CreateGlossaryRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Glossary = new Glossary(),
};
// Make the request
Operation<Glossary, CreateGlossaryMetadata> response = await translationServiceClient.CreateGlossaryAsync(request);

// Poll until the returned long-running operation is complete
Operation<Glossary, CreateGlossaryMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Glossary result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Glossary, CreateGlossaryMetadata> retrievedResponse = await translationServiceClient.PollOnceCreateGlossaryAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Glossary retrievedResult = retrievedResponse.Result;
}

CreateGlossaryAsync(String, Glossary, CallSettings)

public virtual Task<Operation<Glossary, CreateGlossaryMetadata>> CreateGlossaryAsync(string parent, Glossary glossary, CallSettings callSettings = null)

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

Parameters
NameDescription
parentString

Required. The project name.

glossaryGlossary

Required. The glossary to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<Glossary, CreateGlossaryMetadata>>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Glossary glossary = new Glossary();
// Make the request
Operation<Glossary, CreateGlossaryMetadata> response = await translationServiceClient.CreateGlossaryAsync(parent, glossary);

// Poll until the returned long-running operation is complete
Operation<Glossary, CreateGlossaryMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Glossary result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Glossary, CreateGlossaryMetadata> retrievedResponse = await translationServiceClient.PollOnceCreateGlossaryAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Glossary retrievedResult = retrievedResponse.Result;
}

CreateGlossaryAsync(String, Glossary, CancellationToken)

public virtual Task<Operation<Glossary, CreateGlossaryMetadata>> CreateGlossaryAsync(string parent, Glossary glossary, CancellationToken cancellationToken)

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

Parameters
NameDescription
parentString

Required. The project name.

glossaryGlossary

Required. The glossary to create.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<Glossary, CreateGlossaryMetadata>>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Glossary glossary = new Glossary();
// Make the request
Operation<Glossary, CreateGlossaryMetadata> response = await translationServiceClient.CreateGlossaryAsync(parent, glossary);

// Poll until the returned long-running operation is complete
Operation<Glossary, CreateGlossaryMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Glossary result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Glossary, CreateGlossaryMetadata> retrievedResponse = await translationServiceClient.PollOnceCreateGlossaryAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Glossary retrievedResult = retrievedResponse.Result;
}

DeleteGlossary(DeleteGlossaryRequest, CallSettings)

public virtual Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> DeleteGlossary(DeleteGlossaryRequest request, CallSettings callSettings = null)

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

Parameters
NameDescription
requestDeleteGlossaryRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata>

The RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
// Initialize request argument(s)
DeleteGlossaryRequest request = new DeleteGlossaryRequest
{
    GlossaryName = GlossaryName.FromProjectLocationGlossary("[PROJECT]", "[LOCATION]", "[GLOSSARY]"),
};
// Make the request
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> response = translationServiceClient.DeleteGlossary(request);

// Poll until the returned long-running operation is complete
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
DeleteGlossaryResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> retrievedResponse = translationServiceClient.PollOnceDeleteGlossary(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    DeleteGlossaryResponse retrievedResult = retrievedResponse.Result;
}

DeleteGlossary(GlossaryName, CallSettings)

public virtual Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> DeleteGlossary(GlossaryName name, CallSettings callSettings = null)

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

Parameters
NameDescription
nameGlossaryName

Required. The name of the glossary to delete.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata>

The RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
// Initialize request argument(s)
GlossaryName name = GlossaryName.FromProjectLocationGlossary("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
// Make the request
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> response = translationServiceClient.DeleteGlossary(name);

// Poll until the returned long-running operation is complete
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
DeleteGlossaryResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> retrievedResponse = translationServiceClient.PollOnceDeleteGlossary(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    DeleteGlossaryResponse retrievedResult = retrievedResponse.Result;
}

DeleteGlossary(String, CallSettings)

public virtual Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> DeleteGlossary(string name, CallSettings callSettings = null)

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

Parameters
NameDescription
nameString

Required. The name of the glossary to delete.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata>

The RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/glossaries/[GLOSSARY]";
// Make the request
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> response = translationServiceClient.DeleteGlossary(name);

// Poll until the returned long-running operation is complete
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
DeleteGlossaryResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> retrievedResponse = translationServiceClient.PollOnceDeleteGlossary(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    DeleteGlossaryResponse retrievedResult = retrievedResponse.Result;
}

DeleteGlossaryAsync(DeleteGlossaryRequest, CallSettings)

public virtual Task<Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata>> DeleteGlossaryAsync(DeleteGlossaryRequest request, CallSettings callSettings = null)

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

Parameters
NameDescription
requestDeleteGlossaryRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata>>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
DeleteGlossaryRequest request = new DeleteGlossaryRequest
{
    GlossaryName = GlossaryName.FromProjectLocationGlossary("[PROJECT]", "[LOCATION]", "[GLOSSARY]"),
};
// Make the request
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> response = await translationServiceClient.DeleteGlossaryAsync(request);

// Poll until the returned long-running operation is complete
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
DeleteGlossaryResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> retrievedResponse = await translationServiceClient.PollOnceDeleteGlossaryAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    DeleteGlossaryResponse retrievedResult = retrievedResponse.Result;
}

DeleteGlossaryAsync(DeleteGlossaryRequest, CancellationToken)

public virtual Task<Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata>> DeleteGlossaryAsync(DeleteGlossaryRequest request, CancellationToken cancellationToken)

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

Parameters
NameDescription
requestDeleteGlossaryRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata>>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
DeleteGlossaryRequest request = new DeleteGlossaryRequest
{
    GlossaryName = GlossaryName.FromProjectLocationGlossary("[PROJECT]", "[LOCATION]", "[GLOSSARY]"),
};
// Make the request
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> response = await translationServiceClient.DeleteGlossaryAsync(request);

// Poll until the returned long-running operation is complete
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
DeleteGlossaryResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> retrievedResponse = await translationServiceClient.PollOnceDeleteGlossaryAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    DeleteGlossaryResponse retrievedResult = retrievedResponse.Result;
}

DeleteGlossaryAsync(GlossaryName, CallSettings)

public virtual Task<Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata>> DeleteGlossaryAsync(GlossaryName name, CallSettings callSettings = null)

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

Parameters
NameDescription
nameGlossaryName

Required. The name of the glossary to delete.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata>>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
GlossaryName name = GlossaryName.FromProjectLocationGlossary("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
// Make the request
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> response = await translationServiceClient.DeleteGlossaryAsync(name);

// Poll until the returned long-running operation is complete
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
DeleteGlossaryResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> retrievedResponse = await translationServiceClient.PollOnceDeleteGlossaryAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    DeleteGlossaryResponse retrievedResult = retrievedResponse.Result;
}

DeleteGlossaryAsync(GlossaryName, CancellationToken)

public virtual Task<Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata>> DeleteGlossaryAsync(GlossaryName name, CancellationToken cancellationToken)

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

Parameters
NameDescription
nameGlossaryName

Required. The name of the glossary to delete.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata>>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
GlossaryName name = GlossaryName.FromProjectLocationGlossary("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
// Make the request
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> response = await translationServiceClient.DeleteGlossaryAsync(name);

// Poll until the returned long-running operation is complete
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
DeleteGlossaryResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> retrievedResponse = await translationServiceClient.PollOnceDeleteGlossaryAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    DeleteGlossaryResponse retrievedResult = retrievedResponse.Result;
}

DeleteGlossaryAsync(String, CallSettings)

public virtual Task<Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata>> DeleteGlossaryAsync(string name, CallSettings callSettings = null)

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

Parameters
NameDescription
nameString

Required. The name of the glossary to delete.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata>>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/glossaries/[GLOSSARY]";
// Make the request
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> response = await translationServiceClient.DeleteGlossaryAsync(name);

// Poll until the returned long-running operation is complete
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
DeleteGlossaryResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> retrievedResponse = await translationServiceClient.PollOnceDeleteGlossaryAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    DeleteGlossaryResponse retrievedResult = retrievedResponse.Result;
}

DeleteGlossaryAsync(String, CancellationToken)

public virtual Task<Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata>> DeleteGlossaryAsync(string name, CancellationToken cancellationToken)

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

Parameters
NameDescription
nameString

Required. The name of the glossary to delete.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata>>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/glossaries/[GLOSSARY]";
// Make the request
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> response = await translationServiceClient.DeleteGlossaryAsync(name);

// Poll until the returned long-running operation is complete
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
DeleteGlossaryResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> retrievedResponse = await translationServiceClient.PollOnceDeleteGlossaryAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    DeleteGlossaryResponse retrievedResult = retrievedResponse.Result;
}

DetectLanguage(LocationName, String, String, String, CallSettings)

public virtual DetectLanguageResponse DetectLanguage(LocationName parent, string model, string mimeType, string content, CallSettings callSettings = null)

Detects the language of text within a request.

Parameters
NameDescription
parentLocationName

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.

modelString

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.

mimeTypeString

Optional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html".

contentString

The content of the input stored as a string.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
DetectLanguageResponse

The RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string model = "";
string mimeType = "";
string content = "";
// Make the request
DetectLanguageResponse response = translationServiceClient.DetectLanguage(parent, model, mimeType, content);

DetectLanguage(DetectLanguageRequest, CallSettings)

public virtual DetectLanguageResponse DetectLanguage(DetectLanguageRequest request, CallSettings callSettings = null)

Detects the language of text within a request.

Parameters
NameDescription
requestDetectLanguageRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
DetectLanguageResponse

The RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
// Initialize request argument(s)
DetectLanguageRequest request = new DetectLanguageRequest
{
    Content = "",
    MimeType = "",
    Model = "",
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Labels = { { "", "" }, },
};
// Make the request
DetectLanguageResponse response = translationServiceClient.DetectLanguage(request);

DetectLanguage(String, String, String, String, CallSettings)

public virtual DetectLanguageResponse DetectLanguage(string parent, string model, string mimeType, string content, CallSettings callSettings = null)

Detects the language of text within a request.

Parameters
NameDescription
parentString

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.

modelString

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.

mimeTypeString

Optional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html".

contentString

The content of the input stored as a string.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
DetectLanguageResponse

The RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
string model = "";
string mimeType = "";
string content = "";
// Make the request
DetectLanguageResponse response = translationServiceClient.DetectLanguage(parent, model, mimeType, content);

DetectLanguageAsync(LocationName, String, String, String, CallSettings)

public virtual Task<DetectLanguageResponse> DetectLanguageAsync(LocationName parent, string model, string mimeType, string content, CallSettings callSettings = null)

Detects the language of text within a request.

Parameters
NameDescription
parentLocationName

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.

modelString

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.

mimeTypeString

Optional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html".

contentString

The content of the input stored as a string.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<DetectLanguageResponse>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string model = "";
string mimeType = "";
string content = "";
// Make the request
DetectLanguageResponse response = await translationServiceClient.DetectLanguageAsync(parent, model, mimeType, content);

DetectLanguageAsync(LocationName, String, String, String, CancellationToken)

public virtual Task<DetectLanguageResponse> DetectLanguageAsync(LocationName parent, string model, string mimeType, string content, CancellationToken cancellationToken)

Detects the language of text within a request.

Parameters
NameDescription
parentLocationName

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.

modelString

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.

mimeTypeString

Optional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html".

contentString

The content of the input stored as a string.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<DetectLanguageResponse>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string model = "";
string mimeType = "";
string content = "";
// Make the request
DetectLanguageResponse response = await translationServiceClient.DetectLanguageAsync(parent, model, mimeType, content);

DetectLanguageAsync(DetectLanguageRequest, CallSettings)

public virtual Task<DetectLanguageResponse> DetectLanguageAsync(DetectLanguageRequest request, CallSettings callSettings = null)

Detects the language of text within a request.

Parameters
NameDescription
requestDetectLanguageRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<DetectLanguageResponse>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
DetectLanguageRequest request = new DetectLanguageRequest
{
    Content = "",
    MimeType = "",
    Model = "",
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Labels = { { "", "" }, },
};
// Make the request
DetectLanguageResponse response = await translationServiceClient.DetectLanguageAsync(request);

DetectLanguageAsync(DetectLanguageRequest, CancellationToken)

public virtual Task<DetectLanguageResponse> DetectLanguageAsync(DetectLanguageRequest request, CancellationToken cancellationToken)

Detects the language of text within a request.

Parameters
NameDescription
requestDetectLanguageRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<DetectLanguageResponse>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
DetectLanguageRequest request = new DetectLanguageRequest
{
    Content = "",
    MimeType = "",
    Model = "",
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Labels = { { "", "" }, },
};
// Make the request
DetectLanguageResponse response = await translationServiceClient.DetectLanguageAsync(request);

DetectLanguageAsync(String, String, String, String, CallSettings)

public virtual Task<DetectLanguageResponse> DetectLanguageAsync(string parent, string model, string mimeType, string content, CallSettings callSettings = null)

Detects the language of text within a request.

Parameters
NameDescription
parentString

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.

modelString

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.

mimeTypeString

Optional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html".

contentString

The content of the input stored as a string.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<DetectLanguageResponse>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
string model = "";
string mimeType = "";
string content = "";
// Make the request
DetectLanguageResponse response = await translationServiceClient.DetectLanguageAsync(parent, model, mimeType, content);

DetectLanguageAsync(String, String, String, String, CancellationToken)

public virtual Task<DetectLanguageResponse> DetectLanguageAsync(string parent, string model, string mimeType, string content, CancellationToken cancellationToken)

Detects the language of text within a request.

Parameters
NameDescription
parentString

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.

modelString

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.

mimeTypeString

Optional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html".

contentString

The content of the input stored as a string.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<DetectLanguageResponse>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
string model = "";
string mimeType = "";
string content = "";
// Make the request
DetectLanguageResponse response = await translationServiceClient.DetectLanguageAsync(parent, model, mimeType, content);

GetGlossary(GetGlossaryRequest, CallSettings)

public virtual Glossary GetGlossary(GetGlossaryRequest request, CallSettings callSettings = null)

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

Parameters
NameDescription
requestGetGlossaryRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Glossary

The RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
// Initialize request argument(s)
GetGlossaryRequest request = new GetGlossaryRequest
{
    GlossaryName = GlossaryName.FromProjectLocationGlossary("[PROJECT]", "[LOCATION]", "[GLOSSARY]"),
};
// Make the request
Glossary response = translationServiceClient.GetGlossary(request);

GetGlossary(GlossaryName, CallSettings)

public virtual Glossary GetGlossary(GlossaryName name, CallSettings callSettings = null)

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

Parameters
NameDescription
nameGlossaryName

Required. The name of the glossary to retrieve.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Glossary

The RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
// Initialize request argument(s)
GlossaryName name = GlossaryName.FromProjectLocationGlossary("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
// Make the request
Glossary response = translationServiceClient.GetGlossary(name);

GetGlossary(String, CallSettings)

public virtual Glossary GetGlossary(string name, CallSettings callSettings = null)

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

Parameters
NameDescription
nameString

Required. The name of the glossary to retrieve.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Glossary

The RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/glossaries/[GLOSSARY]";
// Make the request
Glossary response = translationServiceClient.GetGlossary(name);

GetGlossaryAsync(GetGlossaryRequest, CallSettings)

public virtual Task<Glossary> GetGlossaryAsync(GetGlossaryRequest request, CallSettings callSettings = null)

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

Parameters
NameDescription
requestGetGlossaryRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Glossary>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
GetGlossaryRequest request = new GetGlossaryRequest
{
    GlossaryName = GlossaryName.FromProjectLocationGlossary("[PROJECT]", "[LOCATION]", "[GLOSSARY]"),
};
// Make the request
Glossary response = await translationServiceClient.GetGlossaryAsync(request);

GetGlossaryAsync(GetGlossaryRequest, CancellationToken)

public virtual Task<Glossary> GetGlossaryAsync(GetGlossaryRequest request, CancellationToken cancellationToken)

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

Parameters
NameDescription
requestGetGlossaryRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Glossary>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
GetGlossaryRequest request = new GetGlossaryRequest
{
    GlossaryName = GlossaryName.FromProjectLocationGlossary("[PROJECT]", "[LOCATION]", "[GLOSSARY]"),
};
// Make the request
Glossary response = await translationServiceClient.GetGlossaryAsync(request);

GetGlossaryAsync(GlossaryName, CallSettings)

public virtual Task<Glossary> GetGlossaryAsync(GlossaryName name, CallSettings callSettings = null)

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

Parameters
NameDescription
nameGlossaryName

Required. The name of the glossary to retrieve.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Glossary>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
GlossaryName name = GlossaryName.FromProjectLocationGlossary("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
// Make the request
Glossary response = await translationServiceClient.GetGlossaryAsync(name);

GetGlossaryAsync(GlossaryName, CancellationToken)

public virtual Task<Glossary> GetGlossaryAsync(GlossaryName name, CancellationToken cancellationToken)

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

Parameters
NameDescription
nameGlossaryName

Required. The name of the glossary to retrieve.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Glossary>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
GlossaryName name = GlossaryName.FromProjectLocationGlossary("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
// Make the request
Glossary response = await translationServiceClient.GetGlossaryAsync(name);

GetGlossaryAsync(String, CallSettings)

public virtual Task<Glossary> GetGlossaryAsync(string name, CallSettings callSettings = null)

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

Parameters
NameDescription
nameString

Required. The name of the glossary to retrieve.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Glossary>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/glossaries/[GLOSSARY]";
// Make the request
Glossary response = await translationServiceClient.GetGlossaryAsync(name);

GetGlossaryAsync(String, CancellationToken)

public virtual Task<Glossary> GetGlossaryAsync(string name, CancellationToken cancellationToken)

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

Parameters
NameDescription
nameString

Required. The name of the glossary to retrieve.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Glossary>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/glossaries/[GLOSSARY]";
// Make the request
Glossary response = await translationServiceClient.GetGlossaryAsync(name);

GetSupportedLanguages(LocationName, String, String, CallSettings)

public virtual SupportedLanguages GetSupportedLanguages(LocationName parent, string model, string displayLanguageCode, CallSettings callSettings = null)

Returns a list of supported languages for translation.

Parameters
NameDescription
parentLocationName

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.

modelString

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, projects/{project-number-or-id}/locations/{location-id}/models/general/base

Returns languages supported by the specified model. If missing, we get supported languages of Google general base (PBMT) model.

displayLanguageCodeString

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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
SupportedLanguages

The RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string model = "";
string displayLanguageCode = "";
// Make the request
SupportedLanguages response = translationServiceClient.GetSupportedLanguages(parent, model, displayLanguageCode);

GetSupportedLanguages(GetSupportedLanguagesRequest, CallSettings)

public virtual SupportedLanguages GetSupportedLanguages(GetSupportedLanguagesRequest request, CallSettings callSettings = null)

Returns a list of supported languages for translation.

Parameters
NameDescription
requestGetSupportedLanguagesRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
SupportedLanguages

The RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
// Initialize request argument(s)
GetSupportedLanguagesRequest request = new GetSupportedLanguagesRequest
{
    DisplayLanguageCode = "",
    Model = "",
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
};
// Make the request
SupportedLanguages response = translationServiceClient.GetSupportedLanguages(request);

GetSupportedLanguages(String, String, String, CallSettings)

public virtual SupportedLanguages GetSupportedLanguages(string parent, string model, string displayLanguageCode, CallSettings callSettings = null)

Returns a list of supported languages for translation.

Parameters
NameDescription
parentString

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.

modelString

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, projects/{project-number-or-id}/locations/{location-id}/models/general/base

Returns languages supported by the specified model. If missing, we get supported languages of Google general base (PBMT) model.

displayLanguageCodeString

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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
SupportedLanguages

The RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
string model = "";
string displayLanguageCode = "";
// Make the request
SupportedLanguages response = translationServiceClient.GetSupportedLanguages(parent, model, displayLanguageCode);

GetSupportedLanguagesAsync(LocationName, String, String, CallSettings)

public virtual Task<SupportedLanguages> GetSupportedLanguagesAsync(LocationName parent, string model, string displayLanguageCode, CallSettings callSettings = null)

Returns a list of supported languages for translation.

Parameters
NameDescription
parentLocationName

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.

modelString

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, projects/{project-number-or-id}/locations/{location-id}/models/general/base

Returns languages supported by the specified model. If missing, we get supported languages of Google general base (PBMT) model.

displayLanguageCodeString

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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<SupportedLanguages>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string model = "";
string displayLanguageCode = "";
// Make the request
SupportedLanguages response = await translationServiceClient.GetSupportedLanguagesAsync(parent, model, displayLanguageCode);

GetSupportedLanguagesAsync(LocationName, String, String, CancellationToken)

public virtual Task<SupportedLanguages> GetSupportedLanguagesAsync(LocationName parent, string model, string displayLanguageCode, CancellationToken cancellationToken)

Returns a list of supported languages for translation.

Parameters
NameDescription
parentLocationName

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.

modelString

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, projects/{project-number-or-id}/locations/{location-id}/models/general/base

Returns languages supported by the specified model. If missing, we get supported languages of Google general base (PBMT) model.

displayLanguageCodeString

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.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<SupportedLanguages>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string model = "";
string displayLanguageCode = "";
// Make the request
SupportedLanguages response = await translationServiceClient.GetSupportedLanguagesAsync(parent, model, displayLanguageCode);

GetSupportedLanguagesAsync(GetSupportedLanguagesRequest, CallSettings)

public virtual Task<SupportedLanguages> GetSupportedLanguagesAsync(GetSupportedLanguagesRequest request, CallSettings callSettings = null)

Returns a list of supported languages for translation.

Parameters
NameDescription
requestGetSupportedLanguagesRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<SupportedLanguages>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
GetSupportedLanguagesRequest request = new GetSupportedLanguagesRequest
{
    DisplayLanguageCode = "",
    Model = "",
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
};
// Make the request
SupportedLanguages response = await translationServiceClient.GetSupportedLanguagesAsync(request);

GetSupportedLanguagesAsync(GetSupportedLanguagesRequest, CancellationToken)

public virtual Task<SupportedLanguages> GetSupportedLanguagesAsync(GetSupportedLanguagesRequest request, CancellationToken cancellationToken)

Returns a list of supported languages for translation.

Parameters
NameDescription
requestGetSupportedLanguagesRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<SupportedLanguages>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
GetSupportedLanguagesRequest request = new GetSupportedLanguagesRequest
{
    DisplayLanguageCode = "",
    Model = "",
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
};
// Make the request
SupportedLanguages response = await translationServiceClient.GetSupportedLanguagesAsync(request);

GetSupportedLanguagesAsync(String, String, String, CallSettings)

public virtual Task<SupportedLanguages> GetSupportedLanguagesAsync(string parent, string model, string displayLanguageCode, CallSettings callSettings = null)

Returns a list of supported languages for translation.

Parameters
NameDescription
parentString

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.

modelString

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, projects/{project-number-or-id}/locations/{location-id}/models/general/base

Returns languages supported by the specified model. If missing, we get supported languages of Google general base (PBMT) model.

displayLanguageCodeString

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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<SupportedLanguages>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
string model = "";
string displayLanguageCode = "";
// Make the request
SupportedLanguages response = await translationServiceClient.GetSupportedLanguagesAsync(parent, model, displayLanguageCode);

GetSupportedLanguagesAsync(String, String, String, CancellationToken)

public virtual Task<SupportedLanguages> GetSupportedLanguagesAsync(string parent, string model, string displayLanguageCode, CancellationToken cancellationToken)

Returns a list of supported languages for translation.

Parameters
NameDescription
parentString

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.

modelString

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, projects/{project-number-or-id}/locations/{location-id}/models/general/base

Returns languages supported by the specified model. If missing, we get supported languages of Google general base (PBMT) model.

displayLanguageCodeString

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.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<SupportedLanguages>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
string model = "";
string displayLanguageCode = "";
// Make the request
SupportedLanguages response = await translationServiceClient.GetSupportedLanguagesAsync(parent, model, displayLanguageCode);

ListGlossaries(LocationName, String, Nullable<Int32>, CallSettings)

public virtual PagedEnumerable<ListGlossariesResponse, Glossary> ListGlossaries(LocationName parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)

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

Parameters
NameDescription
parentLocationName

Required. The name of the project from which to list all of the glossaries.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListGlossariesResponse, Glossary>

A pageable sequence of Glossary resources.

Example
// Create client
TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedEnumerable<ListGlossariesResponse, Glossary> response = translationServiceClient.ListGlossaries(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Glossary item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListGlossariesResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Glossary item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Glossary> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Glossary item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListGlossaries(ListGlossariesRequest, CallSettings)

public virtual PagedEnumerable<ListGlossariesResponse, Glossary> ListGlossaries(ListGlossariesRequest request, CallSettings callSettings = null)

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

Parameters
NameDescription
requestListGlossariesRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListGlossariesResponse, Glossary>

A pageable sequence of Glossary resources.

Example
// Create client
TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
// Initialize request argument(s)
ListGlossariesRequest request = new ListGlossariesRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Filter = "",
};
// Make the request
PagedEnumerable<ListGlossariesResponse, Glossary> response = translationServiceClient.ListGlossaries(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (Glossary item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListGlossariesResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Glossary item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Glossary> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Glossary item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListGlossaries(String, String, Nullable<Int32>, CallSettings)

public virtual PagedEnumerable<ListGlossariesResponse, Glossary> ListGlossaries(string parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)

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

Parameters
NameDescription
parentString

Required. The name of the project from which to list all of the glossaries.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListGlossariesResponse, Glossary>

A pageable sequence of Glossary resources.

Example
// Create client
TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedEnumerable<ListGlossariesResponse, Glossary> response = translationServiceClient.ListGlossaries(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Glossary item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListGlossariesResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Glossary item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Glossary> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Glossary item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListGlossariesAsync(LocationName, String, Nullable<Int32>, CallSettings)

public virtual PagedAsyncEnumerable<ListGlossariesResponse, Glossary> ListGlossariesAsync(LocationName parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)

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

Parameters
NameDescription
parentLocationName

Required. The name of the project from which to list all of the glossaries.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListGlossariesResponse, Glossary>

A pageable asynchronous sequence of Glossary resources.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedAsyncEnumerable<ListGlossariesResponse, Glossary> response = translationServiceClient.ListGlossariesAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Glossary item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListGlossariesResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Glossary item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Glossary> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Glossary item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListGlossariesAsync(ListGlossariesRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListGlossariesResponse, Glossary> ListGlossariesAsync(ListGlossariesRequest request, CallSettings callSettings = null)

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

Parameters
NameDescription
requestListGlossariesRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListGlossariesResponse, Glossary>

A pageable asynchronous sequence of Glossary resources.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
ListGlossariesRequest request = new ListGlossariesRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Filter = "",
};
// Make the request
PagedAsyncEnumerable<ListGlossariesResponse, Glossary> response = translationServiceClient.ListGlossariesAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Glossary item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListGlossariesResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Glossary item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Glossary> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Glossary item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListGlossariesAsync(String, String, Nullable<Int32>, CallSettings)

public virtual PagedAsyncEnumerable<ListGlossariesResponse, Glossary> ListGlossariesAsync(string parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)

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

Parameters
NameDescription
parentString

Required. The name of the project from which to list all of the glossaries.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListGlossariesResponse, Glossary>

A pageable asynchronous sequence of Glossary resources.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedAsyncEnumerable<ListGlossariesResponse, Glossary> response = translationServiceClient.ListGlossariesAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Glossary item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListGlossariesResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Glossary item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Glossary> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Glossary item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

PollOnceBatchTranslateText(String, CallSettings)

public virtual Operation<BatchTranslateResponse, BatchTranslateMetadata> PollOnceBatchTranslateText(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of BatchTranslateText .

Parameters
NameDescription
operationNameString

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<BatchTranslateResponse, BatchTranslateMetadata>

The result of polling the operation.

PollOnceBatchTranslateTextAsync(String, CallSettings)

public virtual Task<Operation<BatchTranslateResponse, BatchTranslateMetadata>> PollOnceBatchTranslateTextAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of BatchTranslateText.

Parameters
NameDescription
operationNameString

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<BatchTranslateResponse, BatchTranslateMetadata>>

A task representing the result of polling the operation.

PollOnceCreateGlossary(String, CallSettings)

public virtual Operation<Glossary, CreateGlossaryMetadata> PollOnceCreateGlossary(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of CreateGlossary.

Parameters
NameDescription
operationNameString

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Glossary, CreateGlossaryMetadata>

The result of polling the operation.

PollOnceCreateGlossaryAsync(String, CallSettings)

public virtual Task<Operation<Glossary, CreateGlossaryMetadata>> PollOnceCreateGlossaryAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of CreateGlossary.

Parameters
NameDescription
operationNameString

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<Glossary, CreateGlossaryMetadata>>

A task representing the result of polling the operation.

PollOnceDeleteGlossary(String, CallSettings)

public virtual Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata> PollOnceDeleteGlossary(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of DeleteGlossary.

Parameters
NameDescription
operationNameString

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata>

The result of polling the operation.

PollOnceDeleteGlossaryAsync(String, CallSettings)

public virtual Task<Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata>> PollOnceDeleteGlossaryAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of DeleteGlossary.

Parameters
NameDescription
operationNameString

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<DeleteGlossaryResponse, DeleteGlossaryMetadata>>

A task representing the result of polling the operation.

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
TypeDescription
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.

TranslateText(LocationName, String, IEnumerable<String>, CallSettings)

public virtual TranslateTextResponse TranslateText(LocationName parent, string targetLanguageCode, IEnumerable<string> contents, CallSettings callSettings = null)

Translates input text and returns translated text.

Parameters
NameDescription
parentLocationName

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.

targetLanguageCodeString

Required. The BCP-47 language code to use for translation of the input text, set to one of the language codes listed in Language Support.

contentsIEnumerable<String>

Required. The content of the input in string format. We recommend the total content be less than 30k codepoints. Use BatchTranslateText for larger text.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TranslateTextResponse

The RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string targetLanguageCode = "";
IEnumerable<string> contents = new string[] { "", };
// Make the request
TranslateTextResponse response = translationServiceClient.TranslateText(parent, targetLanguageCode, contents);

TranslateText(LocationName, String, String, String, String, IEnumerable<String>, CallSettings)

public virtual TranslateTextResponse TranslateText(LocationName parent, string model, string mimeType, string sourceLanguageCode, string targetLanguageCode, IEnumerable<string> contents, CallSettings callSettings = null)

Translates input text and returns translated text.

Parameters
NameDescription
parentLocationName

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.

modelString

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, projects/{project-number-or-id}/locations/{location-id}/models/general/base

For global (non-regionalized) requests, use location-id global. For example, projects/{project-number-or-id}/locations/global/models/general/nmt.

If missing, the system decides which google base model to use.

mimeTypeString

Optional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html".

sourceLanguageCodeString

Optional. The BCP-47 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.

targetLanguageCodeString

Required. The BCP-47 language code to use for translation of the input text, set to one of the language codes listed in Language Support.

contentsIEnumerable<String>

Required. The content of the input in string format. We recommend the total content be less than 30k codepoints. Use BatchTranslateText for larger text.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TranslateTextResponse

The RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string model = "";
string mimeType = "";
string sourceLanguageCode = "";
string targetLanguageCode = "";
IEnumerable<string> contents = new string[] { "", };
// Make the request
TranslateTextResponse response = translationServiceClient.TranslateText(parent, model, mimeType, sourceLanguageCode, targetLanguageCode, contents);

TranslateText(TranslateTextRequest, CallSettings)

public virtual TranslateTextResponse TranslateText(TranslateTextRequest request, CallSettings callSettings = null)

Translates input text and returns translated text.

Parameters
NameDescription
requestTranslateTextRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TranslateTextResponse

The RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
// Initialize request argument(s)
TranslateTextRequest request = new TranslateTextRequest
{
    Contents = { "", },
    MimeType = "",
    SourceLanguageCode = "",
    TargetLanguageCode = "",
    Model = "",
    GlossaryConfig = new TranslateTextGlossaryConfig(),
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Labels = { { "", "" }, },
};
// Make the request
TranslateTextResponse response = translationServiceClient.TranslateText(request);

TranslateText(String, String, IEnumerable<String>, CallSettings)

public virtual TranslateTextResponse TranslateText(string parent, string targetLanguageCode, IEnumerable<string> contents, CallSettings callSettings = null)

Translates input text and returns translated text.

Parameters
NameDescription
parentString

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.

targetLanguageCodeString

Required. The BCP-47 language code to use for translation of the input text, set to one of the language codes listed in Language Support.

contentsIEnumerable<String>

Required. The content of the input in string format. We recommend the total content be less than 30k codepoints. Use BatchTranslateText for larger text.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TranslateTextResponse

The RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
string targetLanguageCode = "";
IEnumerable<string> contents = new string[] { "", };
// Make the request
TranslateTextResponse response = translationServiceClient.TranslateText(parent, targetLanguageCode, contents);

TranslateText(String, String, String, String, String, IEnumerable<String>, CallSettings)

public virtual TranslateTextResponse TranslateText(string parent, string model, string mimeType, string sourceLanguageCode, string targetLanguageCode, IEnumerable<string> contents, CallSettings callSettings = null)

Translates input text and returns translated text.

Parameters
NameDescription
parentString

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.

modelString

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, projects/{project-number-or-id}/locations/{location-id}/models/general/base

For global (non-regionalized) requests, use location-id global. For example, projects/{project-number-or-id}/locations/global/models/general/nmt.

If missing, the system decides which google base model to use.

mimeTypeString

Optional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html".

sourceLanguageCodeString

Optional. The BCP-47 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.

targetLanguageCodeString

Required. The BCP-47 language code to use for translation of the input text, set to one of the language codes listed in Language Support.

contentsIEnumerable<String>

Required. The content of the input in string format. We recommend the total content be less than 30k codepoints. Use BatchTranslateText for larger text.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TranslateTextResponse

The RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = TranslationServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
string model = "";
string mimeType = "";
string sourceLanguageCode = "";
string targetLanguageCode = "";
IEnumerable<string> contents = new string[] { "", };
// Make the request
TranslateTextResponse response = translationServiceClient.TranslateText(parent, model, mimeType, sourceLanguageCode, targetLanguageCode, contents);

TranslateTextAsync(LocationName, String, IEnumerable<String>, CallSettings)

public virtual Task<TranslateTextResponse> TranslateTextAsync(LocationName parent, string targetLanguageCode, IEnumerable<string> contents, CallSettings callSettings = null)

Translates input text and returns translated text.

Parameters
NameDescription
parentLocationName

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.

targetLanguageCodeString

Required. The BCP-47 language code to use for translation of the input text, set to one of the language codes listed in Language Support.

contentsIEnumerable<String>

Required. The content of the input in string format. We recommend the total content be less than 30k codepoints. Use BatchTranslateText for larger text.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<TranslateTextResponse>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string targetLanguageCode = "";
IEnumerable<string> contents = new string[] { "", };
// Make the request
TranslateTextResponse response = await translationServiceClient.TranslateTextAsync(parent, targetLanguageCode, contents);

TranslateTextAsync(LocationName, String, IEnumerable<String>, CancellationToken)

public virtual Task<TranslateTextResponse> TranslateTextAsync(LocationName parent, string targetLanguageCode, IEnumerable<string> contents, CancellationToken cancellationToken)

Translates input text and returns translated text.

Parameters
NameDescription
parentLocationName

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.

targetLanguageCodeString

Required. The BCP-47 language code to use for translation of the input text, set to one of the language codes listed in Language Support.

contentsIEnumerable<String>

Required. The content of the input in string format. We recommend the total content be less than 30k codepoints. Use BatchTranslateText for larger text.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<TranslateTextResponse>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string targetLanguageCode = "";
IEnumerable<string> contents = new string[] { "", };
// Make the request
TranslateTextResponse response = await translationServiceClient.TranslateTextAsync(parent, targetLanguageCode, contents);

TranslateTextAsync(LocationName, String, String, String, String, IEnumerable<String>, CallSettings)

public virtual Task<TranslateTextResponse> TranslateTextAsync(LocationName parent, string model, string mimeType, string sourceLanguageCode, string targetLanguageCode, IEnumerable<string> contents, CallSettings callSettings = null)

Translates input text and returns translated text.

Parameters
NameDescription
parentLocationName

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.

modelString

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, projects/{project-number-or-id}/locations/{location-id}/models/general/base

For global (non-regionalized) requests, use location-id global. For example, projects/{project-number-or-id}/locations/global/models/general/nmt.

If missing, the system decides which google base model to use.

mimeTypeString

Optional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html".

sourceLanguageCodeString

Optional. The BCP-47 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.

targetLanguageCodeString

Required. The BCP-47 language code to use for translation of the input text, set to one of the language codes listed in Language Support.

contentsIEnumerable<String>

Required. The content of the input in string format. We recommend the total content be less than 30k codepoints. Use BatchTranslateText for larger text.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<TranslateTextResponse>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string model = "";
string mimeType = "";
string sourceLanguageCode = "";
string targetLanguageCode = "";
IEnumerable<string> contents = new string[] { "", };
// Make the request
TranslateTextResponse response = await translationServiceClient.TranslateTextAsync(parent, model, mimeType, sourceLanguageCode, targetLanguageCode, contents);

TranslateTextAsync(LocationName, String, String, String, String, IEnumerable<String>, CancellationToken)

public virtual Task<TranslateTextResponse> TranslateTextAsync(LocationName parent, string model, string mimeType, string sourceLanguageCode, string targetLanguageCode, IEnumerable<string> contents, CancellationToken cancellationToken)

Translates input text and returns translated text.

Parameters
NameDescription
parentLocationName

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.

modelString

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, projects/{project-number-or-id}/locations/{location-id}/models/general/base

For global (non-regionalized) requests, use location-id global. For example, projects/{project-number-or-id}/locations/global/models/general/nmt.

If missing, the system decides which google base model to use.

mimeTypeString

Optional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html".

sourceLanguageCodeString

Optional. The BCP-47 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.

targetLanguageCodeString

Required. The BCP-47 language code to use for translation of the input text, set to one of the language codes listed in Language Support.

contentsIEnumerable<String>

Required. The content of the input in string format. We recommend the total content be less than 30k codepoints. Use BatchTranslateText for larger text.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<TranslateTextResponse>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string model = "";
string mimeType = "";
string sourceLanguageCode = "";
string targetLanguageCode = "";
IEnumerable<string> contents = new string[] { "", };
// Make the request
TranslateTextResponse response = await translationServiceClient.TranslateTextAsync(parent, model, mimeType, sourceLanguageCode, targetLanguageCode, contents);

TranslateTextAsync(TranslateTextRequest, CallSettings)

public virtual Task<TranslateTextResponse> TranslateTextAsync(TranslateTextRequest request, CallSettings callSettings = null)

Translates input text and returns translated text.

Parameters
NameDescription
requestTranslateTextRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<TranslateTextResponse>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
TranslateTextRequest request = new TranslateTextRequest
{
    Contents = { "", },
    MimeType = "",
    SourceLanguageCode = "",
    TargetLanguageCode = "",
    Model = "",
    GlossaryConfig = new TranslateTextGlossaryConfig(),
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Labels = { { "", "" }, },
};
// Make the request
TranslateTextResponse response = await translationServiceClient.TranslateTextAsync(request);

TranslateTextAsync(TranslateTextRequest, CancellationToken)

public virtual Task<TranslateTextResponse> TranslateTextAsync(TranslateTextRequest request, CancellationToken cancellationToken)

Translates input text and returns translated text.

Parameters
NameDescription
requestTranslateTextRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<TranslateTextResponse>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
TranslateTextRequest request = new TranslateTextRequest
{
    Contents = { "", },
    MimeType = "",
    SourceLanguageCode = "",
    TargetLanguageCode = "",
    Model = "",
    GlossaryConfig = new TranslateTextGlossaryConfig(),
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Labels = { { "", "" }, },
};
// Make the request
TranslateTextResponse response = await translationServiceClient.TranslateTextAsync(request);

TranslateTextAsync(String, String, IEnumerable<String>, CallSettings)

public virtual Task<TranslateTextResponse> TranslateTextAsync(string parent, string targetLanguageCode, IEnumerable<string> contents, CallSettings callSettings = null)

Translates input text and returns translated text.

Parameters
NameDescription
parentString

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.

targetLanguageCodeString

Required. The BCP-47 language code to use for translation of the input text, set to one of the language codes listed in Language Support.

contentsIEnumerable<String>

Required. The content of the input in string format. We recommend the total content be less than 30k codepoints. Use BatchTranslateText for larger text.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<TranslateTextResponse>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
string targetLanguageCode = "";
IEnumerable<string> contents = new string[] { "", };
// Make the request
TranslateTextResponse response = await translationServiceClient.TranslateTextAsync(parent, targetLanguageCode, contents);

TranslateTextAsync(String, String, IEnumerable<String>, CancellationToken)

public virtual Task<TranslateTextResponse> TranslateTextAsync(string parent, string targetLanguageCode, IEnumerable<string> contents, CancellationToken cancellationToken)

Translates input text and returns translated text.

Parameters
NameDescription
parentString

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.

targetLanguageCodeString

Required. The BCP-47 language code to use for translation of the input text, set to one of the language codes listed in Language Support.

contentsIEnumerable<String>

Required. The content of the input in string format. We recommend the total content be less than 30k codepoints. Use BatchTranslateText for larger text.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<TranslateTextResponse>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
string targetLanguageCode = "";
IEnumerable<string> contents = new string[] { "", };
// Make the request
TranslateTextResponse response = await translationServiceClient.TranslateTextAsync(parent, targetLanguageCode, contents);

TranslateTextAsync(String, String, String, String, String, IEnumerable<String>, CallSettings)

public virtual Task<TranslateTextResponse> TranslateTextAsync(string parent, string model, string mimeType, string sourceLanguageCode, string targetLanguageCode, IEnumerable<string> contents, CallSettings callSettings = null)

Translates input text and returns translated text.

Parameters
NameDescription
parentString

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.

modelString

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, projects/{project-number-or-id}/locations/{location-id}/models/general/base

For global (non-regionalized) requests, use location-id global. For example, projects/{project-number-or-id}/locations/global/models/general/nmt.

If missing, the system decides which google base model to use.

mimeTypeString

Optional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html".

sourceLanguageCodeString

Optional. The BCP-47 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.

targetLanguageCodeString

Required. The BCP-47 language code to use for translation of the input text, set to one of the language codes listed in Language Support.

contentsIEnumerable<String>

Required. The content of the input in string format. We recommend the total content be less than 30k codepoints. Use BatchTranslateText for larger text.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<TranslateTextResponse>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
string model = "";
string mimeType = "";
string sourceLanguageCode = "";
string targetLanguageCode = "";
IEnumerable<string> contents = new string[] { "", };
// Make the request
TranslateTextResponse response = await translationServiceClient.TranslateTextAsync(parent, model, mimeType, sourceLanguageCode, targetLanguageCode, contents);

TranslateTextAsync(String, String, String, String, String, IEnumerable<String>, CancellationToken)

public virtual Task<TranslateTextResponse> TranslateTextAsync(string parent, string model, string mimeType, string sourceLanguageCode, string targetLanguageCode, IEnumerable<string> contents, CancellationToken cancellationToken)

Translates input text and returns translated text.

Parameters
NameDescription
parentString

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.

modelString

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, projects/{project-number-or-id}/locations/{location-id}/models/general/base

For global (non-regionalized) requests, use location-id global. For example, projects/{project-number-or-id}/locations/global/models/general/nmt.

If missing, the system decides which google base model to use.

mimeTypeString

Optional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html".

sourceLanguageCodeString

Optional. The BCP-47 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.

targetLanguageCodeString

Required. The BCP-47 language code to use for translation of the input text, set to one of the language codes listed in Language Support.

contentsIEnumerable<String>

Required. The content of the input in string format. We recommend the total content be less than 30k codepoints. Use BatchTranslateText for larger text.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<TranslateTextResponse>

A Task containing the RPC response.

Example
// Create client
TranslationServiceClient translationServiceClient = await TranslationServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
string model = "";
string mimeType = "";
string sourceLanguageCode = "";
string targetLanguageCode = "";
IEnumerable<string> contents = new string[] { "", };
// Make the request
TranslateTextResponse response = await translationServiceClient.TranslateTextAsync(parent, model, mimeType, sourceLanguageCode, targetLanguageCode, contents);