# Google Cloud Translation v2 API - Class AdvancedTranslationClientImpl (3.5.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [3.5.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClientImpl)
- [3.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/3.4.0/Google.Cloud.Translation.V2.AdvancedTranslationClientImpl)
- [3.3.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/3.3.0/Google.Cloud.Translation.V2.AdvancedTranslationClientImpl)
- [3.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/3.2.0/Google.Cloud.Translation.V2.AdvancedTranslationClientImpl)
- [3.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/3.1.0/Google.Cloud.Translation.V2.AdvancedTranslationClientImpl)
- [3.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/3.0.0/Google.Cloud.Translation.V2.AdvancedTranslationClientImpl)
- [2.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/2.1.0/Google.Cloud.Translation.V2.AdvancedTranslationClientImpl)

    public sealed class AdvancedTranslationClientImpl : AdvancedTranslationClient, IDisposable

Reference documentation and code samples for the Google Cloud Translation v2 API class AdvancedTranslationClientImpl.

Wrapper around [TranslateService](https://googleapis.dev/dotnet/Google.Apis.Translate.v2/1.68.0.875/api/Google.Apis.Translate.v2.TranslateService.html) to provide simpler operations.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> [AdvancedTranslationClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient) \> AdvancedTranslationClientImpl

## Implements

[IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

## Inherited Members

[AdvancedTranslationClient.TranslateText(string, string, string, string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_TranslateText_System_String_System_String_System_String_System_String_) [AdvancedTranslationClient.TranslateHtml(string, string, string, string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_TranslateHtml_System_String_System_String_System_String_System_String_) [AdvancedTranslationClient.DetectLanguage(string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_DetectLanguage_System_String_) [AdvancedTranslationClient.TranslateTextAsync(string, string, string, string, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_TranslateTextAsync_System_String_System_String_System_String_System_String_System_Threading_CancellationToken_) [AdvancedTranslationClient.TranslateHtmlAsync(string, string, string, string, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_TranslateHtmlAsync_System_String_System_String_System_String_System_String_System_Threading_CancellationToken_) [AdvancedTranslationClient.DetectLanguageAsync(string, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_DetectLanguageAsync_System_String_System_Threading_CancellationToken_) [AdvancedTranslationClient.CreateAsync()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_CreateAsync) [AdvancedTranslationClient.Create()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_Create) [AdvancedTranslationClient.CreateAsync(GoogleCredential, string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_CreateAsync_Google_Apis_Auth_OAuth2_GoogleCredential_System_String_) [AdvancedTranslationClient.CreateFromApiKey(string, string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_CreateFromApiKey_System_String_System_String_) [AdvancedTranslationClient.Create(GoogleCredential, string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_Create_Google_Apis_Auth_OAuth2_GoogleCredential_System_String_) [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.Translation.V2](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2)

## Assembly

Google.Cloud.Translation.V2.dll

## Remarks

This is the "default" implementation of [AdvancedTranslationClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient). Most client code
should refer to [AdvancedTranslationClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient), creating instances with
[Create(GoogleCredential, string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_Create_Google_Apis_Auth_OAuth2_GoogleCredential_System_String_),
[CreateAsync(GoogleCredential, string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_CreateAsync_Google_Apis_Auth_OAuth2_GoogleCredential_System_String_) and
[CreateFromApiKey(string, string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_CreateFromApiKey_System_String_System_String_).
The constructor of this class is public for the sake of constructor-based dependency injection.

## Constructors

### AdvancedTranslationClientImpl(TranslateService, string)

    public AdvancedTranslationClientImpl(TranslateService service, string model = null)

Constructs a new client wrapping the given [TranslateService](https://googleapis.dev/dotnet/Google.Apis.Translate.v2/1.68.0.875/api/Google.Apis.Translate.v2.TranslateService.html).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `service` | `https://googleapis.dev/dotnet/Google.Apis.Translate.v2/1.68.0.875/api/Google.Apis.Translate.v2.TranslateService.html` The service to wrap. Must not be null. |
| `model` | `https://learn.microsoft.com/dotnet/api/system.string` The default translation model to use. Defaults to null, indicating that by default no model is specified in requests. |

## Properties

### ApplicationName

    public static string ApplicationName { get; set; }

The default application name used when creating a [TranslateService](https://googleapis.dev/dotnet/Google.Apis.Translate.v2/1.68.0.875/api/Google.Apis.Translate.v2.TranslateService.html).
Defaults to "google-cloud-dotnet"; must not be null.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

**Remarks** Most applications will never want to set this, which is why it's in this class rather than
[AdvancedTranslationClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient).

### DefaultModel

    public override string DefaultModel { get; }

The default translation model used by this client.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

**Overrides** [AdvancedTranslationClient.DefaultModel](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_DefaultModel) **Remarks** Each `Translate` method has an optional parameter to override this.

### Service

    public override TranslateService Service { get; }

The underlying translation service object used by this client.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://googleapis.dev/dotnet/Google.Apis.Translate.v2/1.68.0.875/api/Google.Apis.Translate.v2.TranslateService.html` |   |

**Overrides** [AdvancedTranslationClient.Service](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_Service) **Remarks** The [AdvancedTranslationClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient) class only provides convenience operations built on top of
an existing service object. Any more complex operations which are not supported by this wrapper may wish
to use the same service object as the wrapper, in order to take advantage of its configuration (for authentication,
application naming etc).

## Methods

### DetectLanguages(IEnumerable\<string\>)

    public override IList<Detection> DetectLanguages(IEnumerable<string> textItems)

Detects the languages of the specified text items synchronously.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `textItems` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://learn.microsoft.com/dotnet/api/system.string` The text items to detect the language of. Must not be null or contain null elements. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.Detection` | A list of detected languages. This will be the same size as `textItems`, in the same order. |

**Overrides** [AdvancedTranslationClient.DetectLanguages(IEnumerable\<string\>)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_DetectLanguages_System_Collections_Generic_IEnumerable_System_String__)

### DetectLanguagesAsync(IEnumerable\<string\>, CancellationToken)

    public override Task<IList<Detection>> DetectLanguagesAsync(IEnumerable<string> textItems, CancellationToken cancellationToken = default)

Detects the languages of the specified text items asynchronously.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `textItems` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://learn.microsoft.com/dotnet/api/system.string` The text items to detect the language of. Must not be null or contain null elements. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` The token to monitor for cancellation requests. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.Detection` | A list of detected languages. This will be the same size as `textItems`, in the same order. |

**Overrides** [AdvancedTranslationClient.DetectLanguagesAsync(IEnumerable\<string\>, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_DetectLanguagesAsync_System_Collections_Generic_IEnumerable_System_String__System_Threading_CancellationToken_)

### Dispose()

    public override void Dispose()

Dispose of this instance. See the [AdvancedTranslationClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient) remarks on when this should be called.
**Overrides** [AdvancedTranslationClient.Dispose()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_Dispose)

### ListLanguages(string, string)

    public override IList<Language> ListLanguages(string target = null, string model = null)

Lists the language supported by the Translate API synchronously.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `target` | `https://learn.microsoft.com/dotnet/api/system.string` The target language in which to return the language names in the results, for display purposes. May be null, in which case only the language codes are returned. |
| `model` | `https://learn.microsoft.com/dotnet/api/system.string` The model to request languages for. May be null, in which case [DefaultModel](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_DefaultModel) is used. If the empty string is specified, no model is requested, allowing the server to choose. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.Language` | A list of supported languages. |

**Overrides** [AdvancedTranslationClient.ListLanguages(string, string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_ListLanguages_System_String_System_String_)

### ListLanguagesAsync(string, string, CancellationToken)

    public override Task<IList<Language>> ListLanguagesAsync(string target = null, string model = null, CancellationToken cancellationToken = default)

Lists the language supported by the Translate API asynchronously.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `target` | `https://learn.microsoft.com/dotnet/api/system.string` The target language in which to return the language names in the results, for display purposes. May be null, in which case only the language codes are returned. |
| `model` | `https://learn.microsoft.com/dotnet/api/system.string` The model to request languages for. May be null, in which case [DefaultModel](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_DefaultModel) is used. If the empty string is specified, no model is requested, allowing the server to choose. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` The token to monitor for cancellation requests. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.Language` | A list of supported languages. |

**Overrides** [AdvancedTranslationClient.ListLanguagesAsync(string, string, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_ListLanguagesAsync_System_String_System_String_System_Threading_CancellationToken_)

### TranslateHtml(IEnumerable\<string\>, string, string, string)

    public override IList<TranslationResult> TranslateHtml(IEnumerable<string> htmlItems, string targetLanguage, string sourceLanguage = null, string model = null)

Translates multiple items of HTML synchronously.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `htmlItems` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://learn.microsoft.com/dotnet/api/system.string` The HTML strings to translate. Must not be null or contain null elements. |
| `targetLanguage` | `https://learn.microsoft.com/dotnet/api/system.string` The code for the language to translate into. Must not be null. |
| `sourceLanguage` | `https://learn.microsoft.com/dotnet/api/system.string` The code for the language to translate from. May be null, in which case the server will detect the source language. |
| `model` | `https://learn.microsoft.com/dotnet/api/system.string` The model to request for translation. May be null, in which case [DefaultModel](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_DefaultModel) is used. If the empty string is specified, no model is requested, allowing the server to choose. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.TranslationResult` | A list of translations. This will be the same size as `htmlItems`, in the same order. |

**Overrides** [AdvancedTranslationClient.TranslateHtml(IEnumerable\<string\>, string, string, string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_TranslateHtml_System_Collections_Generic_IEnumerable_System_String__System_String_System_String_System_String_) **Remarks** See the [Translation API documentation](https://cloud.google.com/translate/markup) for more details
on how to translate HTML and the terms of service.

### TranslateHtmlAsync(IEnumerable\<string\>, string, string, string, CancellationToken)

    public override Task<IList<TranslationResult>> TranslateHtmlAsync(IEnumerable<string> htmlItems, string targetLanguage, string sourceLanguage = null, string model = null, CancellationToken cancellationToken = default)

Translates multiple items of HTML asynchronously.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `htmlItems` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://learn.microsoft.com/dotnet/api/system.string` The HTML strings to translate. Must not be null or contain null elements. |
| `targetLanguage` | `https://learn.microsoft.com/dotnet/api/system.string` The code for the language to translate into. Must not be null. |
| `sourceLanguage` | `https://learn.microsoft.com/dotnet/api/system.string` The code for the language to translate from. May be null, in which case the server will detect the source language. |
| `model` | `https://learn.microsoft.com/dotnet/api/system.string` The model to request for translation. May be null, in which case [DefaultModel](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_DefaultModel) is used. If the empty string is specified, no model is requested, allowing the server to choose. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` The token to monitor for cancellation requests. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.TranslationResult` | A list of translations. This will be the same size as `htmlItems`, in the same order. |

**Overrides** [AdvancedTranslationClient.TranslateHtmlAsync(IEnumerable\<string\>, string, string, string, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_TranslateHtmlAsync_System_Collections_Generic_IEnumerable_System_String__System_String_System_String_System_String_System_Threading_CancellationToken_) **Remarks** See the [Translation API documentation](https://cloud.google.com/translate/markup) for more details
on how to translate HTML and the terms of service.

### TranslateText(IEnumerable\<string\>, string, string, string)

    public override IList<TranslationResult> TranslateText(IEnumerable<string> textItems, string targetLanguage, string sourceLanguage = null, string model = null)

Translates multiple items of text synchronously.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `textItems` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://learn.microsoft.com/dotnet/api/system.string` The text strings to translate. Must not be null or contain null elements. |
| `targetLanguage` | `https://learn.microsoft.com/dotnet/api/system.string` The code for the language to translate into. Must not be null. |
| `sourceLanguage` | `https://learn.microsoft.com/dotnet/api/system.string` The code for the language to translate from. May be null, in which case the server will detect the source language. |
| `model` | `https://learn.microsoft.com/dotnet/api/system.string` The model to request for translation. May be null, in which case [DefaultModel](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_DefaultModel) is used. If the empty string is specified, no model is requested, allowing the server to choose. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.TranslationResult` | A list of translations. This will be the same size as `textItems`, in the same order. |

**Overrides** [AdvancedTranslationClient.TranslateText(IEnumerable\<string\>, string, string, string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_TranslateText_System_Collections_Generic_IEnumerable_System_String__System_String_System_String_System_String_)

### TranslateTextAsync(IEnumerable\<string\>, string, string, string, CancellationToken)

    public override Task<IList<TranslationResult>> TranslateTextAsync(IEnumerable<string> textItems, string targetLanguage, string sourceLanguage = null, string model = null, CancellationToken cancellationToken = default)

Translates multiple items of text asynchronously.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `textItems` | `https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1https://learn.microsoft.com/dotnet/api/system.string` The text strings to translate. Must not be null or contain null elements. |
| `targetLanguage` | `https://learn.microsoft.com/dotnet/api/system.string` The code for the language to translate into. Must not be null. |
| `sourceLanguage` | `https://learn.microsoft.com/dotnet/api/system.string` The code for the language to translate from. May be null, in which case the server will detect the source language. |
| `model` | `https://learn.microsoft.com/dotnet/api/system.string` The model to request for translation. May be null, in which case [DefaultModel](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_DefaultModel) is used. If the empty string is specified, no model is requested, allowing the server to choose. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` The token to monitor for cancellation requests. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.TranslationResult` | A list of translations. This will be the same size as `textItems`, in the same order. |

**Overrides** [AdvancedTranslationClient.TranslateTextAsync(IEnumerable\<string\>, string, string, string, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Translation.V2/latest/Google.Cloud.Translation.V2.AdvancedTranslationClient#Google_Cloud_Translation_V2_AdvancedTranslationClient_TranslateTextAsync_System_Collections_Generic_IEnumerable_System_String__System_String_System_String_System_String_System_Threading_CancellationToken_)