inputTextElements = new[]
+ {
+ "This will not be translated.
This will be translated.
"
+ };
+
+ Response> response = await client.TranslateAsync(targetLanguages, inputTextElements, textType: TextTypes.Html, from: from).ConfigureAwait(false);
+ IReadOnlyList translations = response.Value;
+ TranslatedTextElement translation = translations.FirstOrDefault();
+
+ Console.WriteLine($"Detected languages of the input text: {translation?.DetectedLanguage?.Language} with score: {translation?.DetectedLanguage?.Score}.");
+ Console.WriteLine($"Text was translated to: '{translation?.Translations?.FirstOrDefault().To}' and the result is: '{translation?.Translations?.FirstOrDefault()?.Text}'.");
+}
+catch (RequestFailedException exception)
+{
+ Console.WriteLine($"Error Code: {exception.ErrorCode}");
+ Console.WriteLine($"Message: {exception.Message}");
+}
+```
+
+## Translate specific entity name in a text applying a dictionary
+
+If you already know the translation you want to apply to a word or a phrase, you can supply it as markup within the request. The dynamic dictionary is safe only for compound nouns like proper names and product names.
+
+> Note You must include the From parameter in your API translation request instead of using the autodetect feature.
+
+```C#
+try
+{
+ string from = "en";
+ IEnumerable targetLanguages = new[] { "cs" };
+ IEnumerable inputTextElements = new[]
+ {
+ "The word wordomatic is a dictionary entry."
+ };
+
+ Response> response = await client.TranslateAsync(targetLanguages, inputTextElements, from: from).ConfigureAwait(false);
+ IReadOnlyList translations = response.Value;
+ TranslatedTextElement translation = translations.FirstOrDefault();
+
+ Console.WriteLine($"Detected languages of the input text: {translation?.DetectedLanguage?.Language} with score: {translation?.DetectedLanguage?.Score}.");
+ Console.WriteLine($"Text was translated to: '{translation?.Translations?.FirstOrDefault().To}' and the result is: '{translation?.Translations?.FirstOrDefault()?.Text}'.");
+}
+catch (RequestFailedException exception)
+{
+ Console.WriteLine($"Error Code: {exception.ErrorCode}");
+ Console.WriteLine($"Message: {exception.Message}");
+}
+```
+
+## Profanity handling
+
+[Profanity handling](https://learn.microsoft.com/azure/cognitive-services/translator/reference/v3-0-translate#handle-profanity). Normally the Translator service will retain profanity that is present in the source in the translation. The degree of profanity and the context that makes words profane differ between cultures, and as a result the degree of profanity in the target language may be amplified or reduced.
+
+If you want to avoid getting profanity in the translation, regardless of the presence of profanity in the source text, you can use the profanity filtering option. The option allows you to choose whether you want to see profanity deleted, whether you want to mark profanities with appropriate tags (giving you the option to add your own post-processing), or you want no action taken. The accepted values of `ProfanityAction` are `Deleted`, `Marked` and `NoAction` (default).
+
+```C#
+try
+{
+ ProfanityActions profanityAction = ProfanityActions.Marked;
+ ProfanityMarkers profanityMarkers = ProfanityMarkers.Asterisk;
+
+ IEnumerable targetLanguages = new[] { "cs" };
+ IEnumerable inputTextElements = new[]
+ {
+ "This is ***."
+ };
+
+ Response> response = await client.TranslateAsync(targetLanguages, inputTextElements, profanityAction: profanityAction, profanityMarker: profanityMarkers).ConfigureAwait(false);
+ IReadOnlyList translations = response.Value;
+ TranslatedTextElement translation = translations.FirstOrDefault();
+
+ Console.WriteLine($"Detected languages of the input text: {translation?.DetectedLanguage?.Language} with score: {translation?.DetectedLanguage?.Score}.");
+ Console.WriteLine($"Text was translated to: '{translation?.Translations?.FirstOrDefault().To}' and the result is: '{translation?.Translations?.FirstOrDefault()?.Text}'.");
+}
+catch (RequestFailedException exception)
+{
+ Console.WriteLine($"Error Code: {exception.ErrorCode}");
+ Console.WriteLine($"Message: {exception.Message}");
+}
+```
+
+## Include alignments into translations
+
+You can ask translation service to include alignment projection from source text to translated text.
+
+```C#
+try
+{
+ bool includeAlignment = true;
+
+ IEnumerable targetLanguages = new[] { "cs" };
+ IEnumerable inputTextElements = new[]
+ {
+ "The answer lies in machine translation."
+ };
+
+ Response> response = await client.TranslateAsync(targetLanguages, inputTextElements, includeAlignment: includeAlignment).ConfigureAwait(false);
+ IReadOnlyList translations = response.Value;
+ TranslatedTextElement translation = translations.FirstOrDefault();
+
+ Console.WriteLine($"Detected languages of the input text: {translation?.DetectedLanguage?.Language} with score: {translation?.DetectedLanguage?.Score}.");
+ Console.WriteLine($"Text was translated to: '{translation?.Translations?.FirstOrDefault().To}' and the result is: '{translation?.Translations?.FirstOrDefault()?.Text}'.");
+ Console.WriteLine($"Alignments: {translation?.Translations?.FirstOrDefault()?.Alignment?.Proj}");
+
+}
+catch (RequestFailedException exception)
+{
+ Console.WriteLine($"Error Code: {exception.ErrorCode}");
+ Console.WriteLine($"Message: {exception.Message}");
+}
+```
+
+## Include sentence lenght
+
+You can ask translator service to include sentence boundaries for the input text and the translated text.
+
+```C#
+try
+{
+ bool includeSentenceLength = true;
+
+ IEnumerable targetLanguages = new[] { "cs" };
+ IEnumerable inputTextElements = new[]
+ {
+ "The answer lies in machine translation. This is a test."
+ };
+
+ Response> response = await client.TranslateAsync(targetLanguages, inputTextElements, includeSentenceLength: includeSentenceLength).ConfigureAwait(false);
+ IReadOnlyList translations = response.Value;
+ TranslatedTextElement translation = translations.FirstOrDefault();
+
+ Console.WriteLine($"Detected languages of the input text: {translation?.DetectedLanguage?.Language} with score: {translation?.DetectedLanguage?.Score}.");
+ Console.WriteLine($"Text was translated to: '{translation?.Translations?.FirstOrDefault().To}' and the result is: '{translation?.Translations?.FirstOrDefault()?.Text}'.");
+ Console.WriteLine($"Source Sentece length: {string.Join(",", translation?.Translations?.FirstOrDefault()?.SentLen?.SrcSentLen)}");
+ Console.WriteLine($"Translated Sentece length: {string.Join(",", translation?.Translations?.FirstOrDefault()?.SentLen?.TransSentLen)}");
+
+
+}
+catch (RequestFailedException exception)
+{
+ Console.WriteLine($"Error Code: {exception.ErrorCode}");
+ Console.WriteLine($"Message: {exception.Message}");
+}
+```
+
+## Custom Translator
+
+You can get translations from a customized system built with [Custom Translator](https://learn.microsoft.com/azure/cognitive-services/translator/customization). Add the Category ID from your Custom Translator [project details](https://learn.microsoft.com/azure/cognitive-services/translator/custom-translator/how-to-create-project#view-project-details) to this parameter to use your deployed customized system.
+
+It is possible to set `allowFalback` paramter. It specifies that the service is allowed to fall back to a general system when a custom system doesn't exist. Possible values are: `true` (default) or `false`.
+
+`allowFallback=false` specifies that the translation should only use systems trained for the category specified by the request. If a translation for language X to language Y requires chaining through a pivot language E, then all the systems in the chain (X → E and E → Y) will need to be custom and have the same category. If no system is found with the specific category, the request will return a 400 status code. `allowFallback=true` specifies that the service is allowed to fall back to a general system when a custom system doesn't exist.
+
+```C#
+try
+{
+ string category = "<>";
+ IEnumerable targetLanguages = new[] { "cs" };
+ IEnumerable inputTextElements = new[]
+ {
+ "This is a test."
+ };
+
+ Response> response = await client.TranslateAsync(targetLanguages, inputTextElements, category: category).ConfigureAwait(false);
+ IReadOnlyList translations = response.Value;
+ TranslatedTextElement translation = translations.FirstOrDefault();
+
+ Console.WriteLine($"Detected languages of the input text: {translation?.DetectedLanguage?.Language} with score: {translation?.DetectedLanguage?.Score}.");
+ Console.WriteLine($"Text was translated to: '{translation?.Translations?.FirstOrDefault().To}' and the result is: '{translation?.Translations?.FirstOrDefault()?.Text}'.");
+}
+catch (RequestFailedException exception)
+{
+ Console.WriteLine($"Error Code: {exception.ErrorCode}");
+ Console.WriteLine($"Message: {exception.Message}");
+}
+```
+
+See the [README] of the Text Translation client library for more information, including useful links and instructions.
+
+[README]: https://aka.ms/https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/translation/Azure.AI.Translation.Text/README.md
+[create_client_sample]: https://aka.ms/https://github.com/azure-sdk-for-net/tree/main/sdk/translation/Azure.AI.Translation.Text/samples/Sample0_CreateClient.md
diff --git a/sdk/translation/Azure.AI.Translation.Text/samples/Sample3_Transliterate.md b/sdk/translation/Azure.AI.Translation.Text/samples/Sample3_Transliterate.md
new file mode 100644
index 0000000000000..90ddda42a501d
--- /dev/null
+++ b/sdk/translation/Azure.AI.Translation.Text/samples/Sample3_Transliterate.md
@@ -0,0 +1,37 @@
+# Transliterate
+
+All samples are using `client` created in [Create a `TextTranslationClient`][create_client_sample] samples.
+
+## Transliterate Text
+
+Converts characters or letters of a source language to the corresponding characters or letters of a target language.
+
+```C#
+try
+{
+ string language = "zh-Hans";
+ string fromScript = "Hans";
+ string toScript = "Latn";
+
+ IEnumerable inputTextElements = new[]
+ {
+ "这是个测试。"
+ };
+
+ Response> response = await client.TransliterateAsync(language, fromScript, toScript, inputTextElements).ConfigureAwait(false);
+ IReadOnlyList transliterations = response.Value;
+ TransliteratedText transliteration = transliterations.FirstOrDefault();
+
+ Console.WriteLine($"Input text was transliterated to '{transliteration?.Script}' script. Transliterated text: '{transliteration?.Text}'.");
+}
+catch (RequestFailedException exception)
+{
+ Console.WriteLine($"Error Code: {exception.ErrorCode}");
+ Console.WriteLine($"Message: {exception.Message}");
+}
+```
+
+See the [README] of the Text Translation client library for more information, including useful links and instructions.
+
+[README]: https://aka.ms/https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/translation/Azure.AI.Translation.Text/README.md
+[create_client_sample]: https://aka.ms/https://github.com/azure-sdk-for-net/tree/main/sdk/translation/Azure.AI.Translation.Text/samples/Sample0_CreateClient.md
diff --git a/sdk/translation/Azure.AI.Translation.Text/samples/Sample4_BreakSentence.md b/sdk/translation/Azure.AI.Translation.Text/samples/Sample4_BreakSentence.md
new file mode 100644
index 0000000000000..d3e7db836c6db
--- /dev/null
+++ b/sdk/translation/Azure.AI.Translation.Text/samples/Sample4_BreakSentence.md
@@ -0,0 +1,65 @@
+# Break Sentence
+
+All samples are using `client` created in [Create a `TextTranslationClient`][create_client_sample] samples.
+
+## Break Sentence with language and script parameters
+
+When the input language is known, you can provide those to the service call.
+
+```C#
+try
+{
+ string sourceLanguage = "zh-Hans";
+ string sourceScript = "Latn";
+ IEnumerable inputTextElements = new[]
+ {
+ "zhè shì gè cè shì。"
+ };
+
+ Response> response = await client.FindSentenceBoundariesAsync(inputTextElements, language: sourceLanguage, script: sourceScript).ConfigureAwait(false);
+ IReadOnlyList brokenSentences = response.Value;
+ BreakSentenceElement brokenSentence = brokenSentences.FirstOrDefault();
+
+ Console.WriteLine($"Detected languages of the input text: {brokenSentence?.DetectedLanguage?.Language} with score: {brokenSentence?.DetectedLanguage?.Score}.");
+ Console.WriteLine($"The detected sentece boundaries: '{string.Join(",", brokenSentence?.SentLen)}'.");
+
+
+}
+catch (RequestFailedException exception)
+{
+ Console.WriteLine($"Error Code: {exception.ErrorCode}");
+ Console.WriteLine($"Message: {exception.Message}");
+}
+```
+
+## Break Sentence with auto-detection
+
+You can ommit source languge of the input text. In this case, API will try to auto-detect the language.
+
+```C#
+try
+{
+ IEnumerable inputTextElements = new[]
+ {
+ "How are you? I am fine. What did you do today?"
+ };
+
+ Response> response = await client.FindSentenceBoundariesAsync(inputTextElements).ConfigureAwait(false);
+ IReadOnlyList brokenSentences = response.Value;
+ BreakSentenceElement brokenSentence = brokenSentences.FirstOrDefault();
+
+ Console.WriteLine($"Detected languages of the input text: {brokenSentence?.DetectedLanguage?.Language} with score: {brokenSentence?.DetectedLanguage?.Score}.");
+ Console.WriteLine($"The detected sentece boundaries: '{string.Join(",", brokenSentence?.SentLen)}'.");
+
+}
+catch (RequestFailedException exception)
+{
+ Console.WriteLine($"Error Code: {exception.ErrorCode}");
+ Console.WriteLine($"Message: {exception.Message}");
+}
+```
+
+See the [README] of the Text Translation client library for more information, including useful links and instructions.
+
+[README]: https://aka.ms/https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/translation/Azure.AI.Translation.Text/README.md
+[create_client_sample]: https://aka.ms/https://github.com/azure-sdk-for-net/tree/main/sdk/translation/Azure.AI.Translation.Text/samples/Sample0_CreateClient.md
diff --git a/sdk/translation/Azure.AI.Translation.Text/samples/Sample5_DictionaryLookup.md b/sdk/translation/Azure.AI.Translation.Text/samples/Sample5_DictionaryLookup.md
new file mode 100644
index 0000000000000..e932e27043a06
--- /dev/null
+++ b/sdk/translation/Azure.AI.Translation.Text/samples/Sample5_DictionaryLookup.md
@@ -0,0 +1,37 @@
+# Dictionary Lookup
+
+All samples are using `client` created in [Create a `TextTranslationClient`][create_client_sample] samples.
+
+## Lookup Dictionary Entries
+
+Returns equivalent words for the source term in the target language.
+
+```C#
+try
+{
+ string sourceLanguage = "en";
+ string targetLanguage = "es";
+ IEnumerable inputTextElements = new[]
+ {
+ "fly"
+ };
+
+ Response> response = await client.LookupDictionaryEntriesAsync(sourceLanguage, targetLanguage, inputTextElements).ConfigureAwait(false);
+ IReadOnlyList dictionaryEntries = response.Value;
+ DictionaryLookupElement dictionaryEntry = dictionaryEntries.FirstOrDefault();
+
+ Console.WriteLine($"For the given input {dictionaryEntry?.Translations?.Count} entries were found in the dictionary.");
+ Console.WriteLine($"First entry: '{dictionaryEntry?.Translations?.FirstOrDefault()?.DisplayTarget}', confidence: {dictionaryEntry?.Translations?.FirstOrDefault()?.Confidence}.");
+
+}
+catch (RequestFailedException exception)
+{
+ Console.WriteLine($"Error Code: {exception.ErrorCode}");
+ Console.WriteLine($"Message: {exception.Message}");
+}
+```
+
+See the [README] of the Text Translation client library for more information, including useful links and instructions.
+
+[README]: https://aka.ms/https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/translation/Azure.AI.Translation.Text/README.md
+[create_client_sample]: https://aka.ms/https://github.com/azure-sdk-for-net/tree/main/sdk/translation/Azure.AI.Translation.Text/samples/Sample0_CreateClient.md
diff --git a/sdk/translation/Azure.AI.Translation.Text/samples/Sample6_DictionaryExamples.md b/sdk/translation/Azure.AI.Translation.Text/samples/Sample6_DictionaryExamples.md
new file mode 100644
index 0000000000000..dd31e94dfcd87
--- /dev/null
+++ b/sdk/translation/Azure.AI.Translation.Text/samples/Sample6_DictionaryExamples.md
@@ -0,0 +1,38 @@
+# Dictionary Examples
+
+All samples are using `client` created in [Create a `TextTranslationClient`][create_client_sample] samples.
+
+## Lookup Dictionary Examples
+
+Returns grammatical structure and context examples for the source term and target term pair.
+
+```C#
+try
+{
+ string sourceLanguage = "en";
+ string targetLanguage = "es";
+ IEnumerable inputTextElements = new[]
+ {
+ new InputTextWithTranslation { Text = "fly", Translation = "volar" }
+ };
+
+ Response> response = await client.LookupDictionaryExamplesAsync(sourceLanguage, targetLanguage, inputTextElements).ConfigureAwait(false);
+ IReadOnlyList dictionaryEntries = response.Value;
+ DictionaryExampleElement dictionaryEntry = dictionaryEntries.FirstOrDefault();
+
+ Console.WriteLine($"For the given input {dictionaryEntry?.Examples?.Count} examples were found in the dictionary.");
+ Example firstExample = dictionaryEntry?.Examples?.FirstOrDefault();
+ Console.WriteLine($"Example: '{string.Concat(firstExample.TargetPrefix, firstExample.TargetTerm, firstExample.TargetSuffix)}'.");
+
+}
+catch (RequestFailedException exception)
+{
+ Console.WriteLine($"Error Code: {exception.ErrorCode}");
+ Console.WriteLine($"Message: {exception.Message}");
+}
+```
+
+See the [README] of the Text Translation client library for more information, including useful links and instructions.
+
+[README]: https://aka.ms/https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/translation/Azure.AI.Translation.Text/README.md
+[create_client_sample]: https://aka.ms/https://github.com/azure-sdk-for-net/tree/main/sdk/translation/Azure.AI.Translation.Text/samples/Sample0_CreateClient.md
diff --git a/sdk/translation/Azure.AI.Translation.Text/src/Azure.AI.Translation.Text.csproj b/sdk/translation/Azure.AI.Translation.Text/src/Azure.AI.Translation.Text.csproj
new file mode 100644
index 0000000000000..c92bced69ec3f
--- /dev/null
+++ b/sdk/translation/Azure.AI.Translation.Text/src/Azure.AI.Translation.Text.csproj
@@ -0,0 +1,22 @@
+
+
+ This is the Text Translation client library for developing .NET applications with rich experience.
+ Azure SDK Code Generation Text Translation for Azure Data Plane
+ 1.0.0-beta.1
+ Azure Text Translation;$(PackageCommonTags)
+ $(RequiredTargetFrameworks)
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationClient.cs b/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationClient.cs
new file mode 100644
index 0000000000000..c3f7a274e9343
--- /dev/null
+++ b/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationClient.cs
@@ -0,0 +1,1751 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using Azure.Core.Pipeline;
+using Azure.Core;
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using System.Threading;
+using System.Linq;
+using Azure.AI.Translation.Text.Models;
+using System.Text.Json;
+
+namespace Azure.AI.Translation.Text
+{
+ /// The Translator service client.
+ public partial class TextTranslationClient
+ {
+ private const string KEY_HEADER_NAME = "Ocp-Apim-Subscription-Key";
+ private const string TOKEN_SCOPE = "https://cognitiveservices.azure.com/.default";
+ private const string PLATFORM_PATH = "/translator/text/v3.0";
+ private const string DEFAULT_REGION = "global";
+
+ private static readonly Uri DEFAULT_ENDPOINT = new Uri("https://api.cognitive.microsofttranslator.com");
+
+ /// Initializes a new instance of TextTranslationClient.
+ ///
+ /// Supported Text Translation endpoints (protocol and hostname, for example:
+ /// https://api.cognitive.microsofttranslator.com).
+ ///
+ /// is null.
+ protected TextTranslationClient(Uri endpoint) : this(endpoint, new TextTranslationClientOptions())
+ {
+ }
+
+ /// Initializes a new instance of TextTranslationClient.
+ ///
+ /// Supported Text Translation endpoints (protocol and hostname, for example:
+ /// https://api.cognitive.microsofttranslator.com).
+ ///
+ /// The options for configuring the client.
+ /// is null.
+ protected TextTranslationClient(Uri endpoint, TextTranslationClientOptions options)
+ {
+ Argument.AssertNotNull(endpoint, nameof(endpoint));
+ options ??= new TextTranslationClientOptions();
+
+ ClientDiagnostics = new ClientDiagnostics(options, true);
+ _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), Array.Empty(), new ResponseClassifier());
+ _endpoint = endpoint;
+ _apiVersion = options.Version;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Azure Key Credential
+ /// Azure Resource Region
+ /// Translate Client Options
+ public TextTranslationClient(AzureKeyCredential credential, string region = DEFAULT_REGION, TextTranslationClientOptions options = default) : this(credential, DEFAULT_ENDPOINT, region, options)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Azure Key Credential
+ /// Service Endpoint
+ /// Azure Resource Region
+ /// Translate Client Options
+ public TextTranslationClient(AzureKeyCredential credential, Uri endpoint, string region = DEFAULT_REGION, TextTranslationClientOptions options = default) : this(endpoint, options)
+ {
+ options = options ?? new TextTranslationClientOptions();
+
+ List authenticationPolicies = new List()
+ {
+ new AzureKeyCredentialPolicy(credential, KEY_HEADER_NAME)
+ };
+
+ if (!string.IsNullOrWhiteSpace(region) && !string.Equals(DEFAULT_REGION, region, StringComparison.InvariantCultureIgnoreCase))
+ {
+ authenticationPolicies.Add(new TranslatorRegionalEndpointAuthenticationPolicy(region));
+ }
+
+ this._pipeline = HttpPipelineBuilder.Build(options, authenticationPolicies.ToArray(), Array.Empty(), new ResponseClassifier());
+
+ if (endpoint.IsPlatformHost())
+ {
+ this._endpoint = new Uri(endpoint, PLATFORM_PATH);
+ }
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Cognitive Services Token
+ /// Translate Client Options
+ public TextTranslationClient(TokenCredential credential, TextTranslationClientOptions options = default) : this(credential, DEFAULT_ENDPOINT, options)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Cognitive Services Token
+ /// Service Endpoint
+ /// Translate Client Options
+ public TextTranslationClient(TokenCredential credential, Uri endpoint, TextTranslationClientOptions options = default) : this(endpoint, options)
+ {
+ var policy = new BearerTokenAuthenticationPolicy(credential, TOKEN_SCOPE);
+ options = options ?? new TextTranslationClientOptions();
+
+ this._pipeline = HttpPipelineBuilder.Build(options, new[] { policy }, Array.Empty(), new ResponseClassifier());
+
+ if (endpoint.IsPlatformHost())
+ {
+ this._endpoint = new Uri(endpoint, PLATFORM_PATH);
+ }
+ }
+
+ /// Translate Text.
+ ///
+ /// Specifies the language of the output text. The target language must be one of the supported languages included
+ /// in the translation scope. For example, use to=de to translate to German.
+ /// It's possible to translate to multiple languages simultaneously by repeating the parameter in the query string.
+ /// For example, use to=de&to=it to translate to German and Italian.
+ ///
+ /// Array of the text to be translated.
+ /// A client-generated GUID to uniquely identify the request.
+ ///
+ /// Specifies the language of the input text. Find which languages are available to translate from by
+ /// looking up supported languages using the translation scope. If the from parameter isn't specified,
+ /// automatic language detection is applied to determine the source language.
+ ///
+ /// You must use the from parameter rather than autodetection when using the dynamic dictionary feature.
+ /// Note: the dynamic dictionary feature is case-sensitive.
+ ///
+ ///
+ /// Defines whether the text being translated is plain text or HTML text. Any HTML needs to be a well-formed,
+ /// complete element. Possible values are: plain (default) or html.
+ ///
+ ///
+ /// A string specifying the category (domain) of the translation. This parameter is used to get translations
+ /// from a customized system built with Custom Translator. Add the Category ID from your Custom Translator
+ /// project details to this parameter to use your deployed customized system. Default value is: general.
+ ///
+ ///
+ /// Specifies how profanities should be treated in translations.
+ /// Possible values are: NoAction (default), Marked or Deleted.
+ ///
+ ///
+ /// Specifies how profanities should be marked in translations.
+ /// Possible values are: Asterisk (default) or Tag.
+ ///
+ ///
+ /// Specifies whether to include alignment projection from source text to translated text.
+ /// Possible values are: true or false (default).
+ ///
+ ///
+ /// Specifies whether to include sentence boundaries for the input text and the translated text.
+ /// Possible values are: true or false (default).
+ ///
+ ///
+ /// Specifies a fallback language if the language of the input text can't be identified.
+ /// Language autodetection is applied when the from parameter is omitted. If detection fails,
+ /// the suggestedFrom language will be assumed.
+ ///
+ /// Specifies the script of the input text.
+ /// Specifies the script of the translated text.
+ ///
+ /// Specifies that the service is allowed to fall back to a general system when a custom system doesn't exist.
+ /// Possible values are: true (default) or false.
+ ///
+ /// allowFallback=false specifies that the translation should only use systems trained for the category specified
+ /// by the request. If a translation for language X to language Y requires chaining through a pivot language E,
+ /// then all the systems in the chain (X → E and E → Y) will need to be custom and have the same category.
+ /// If no system is found with the specific category, the request will return a 400 status code. allowFallback=true
+ /// specifies that the service is allowed to fall back to a general system when a custom system doesn't exist.
+ ///
+ /// The cancellation token to use.
+ /// or is null.
+ public virtual Task>> TranslateAsync(IEnumerable targetLanguages, IEnumerable content, string clientTraceId = null, string sourceLanguage = null, TextType? textType = null, string category = null, ProfanityAction? profanityAction = null, ProfanityMarker? profanityMarker = null, bool? includeAlignment = null, bool? includeSentenceLength = null, string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(targetLanguages, nameof(targetLanguages));
+ Argument.AssertNotNull(content, nameof(content));
+
+ return this.TranslateAsync(targetLanguages, content.Select(input => new InputText(input)) as object, clientTraceId, sourceLanguage, textType?.ToString(), category, profanityAction?.ToString(), profanityMarker?.ToString(), includeAlignment, includeSentenceLength, suggestedFrom, fromScript, toScript, allowFallback, cancellationToken);
+ }
+
+ /// Translate Text.
+ ///
+ /// Specifies the language of the output text. The target language must be one of the supported languages included
+ /// in the translation scope. For example, use to=de to translate to German.
+ /// It's possible to translate to multiple languages simultaneously by repeating the parameter in the query string.
+ /// For example, use to=de&to=it to translate to German and Italian.
+ ///
+ /// Array of the text to be translated.
+ ///
+ /// Specifies the language of the input text. Find which languages are available to translate from by
+ /// looking up supported languages using the translation scope. If the from parameter isn't specified,
+ /// automatic language detection is applied to determine the source language.
+ ///
+ /// You must use the from parameter rather than autodetection when using the dynamic dictionary feature.
+ /// Note: the dynamic dictionary feature is case-sensitive.
+ ///
+ /// The cancellation token to use.
+ /// or is null.
+ public virtual Task>> TranslateAsync(string targetLanguage, IEnumerable content, string sourceLanguage = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(targetLanguage, nameof(targetLanguage));
+ Argument.AssertNotNull(content, nameof(content));
+
+ return this.TranslateAsync(new[] { targetLanguage }, content.Select(input => new InputText(input)) as object, from: sourceLanguage, cancellationToken: cancellationToken);
+ }
+
+ /// Translate Text.
+ ///
+ /// Specifies the language of the output text. The target language must be one of the supported languages included
+ /// in the translation scope. For example, use to=de to translate to German.
+ /// It's possible to translate to multiple languages simultaneously by repeating the parameter in the query string.
+ /// For example, use to=de&to=it to translate to German and Italian.
+ ///
+ /// Text to be translated.
+ ///
+ /// Specifies the language of the input text. Find which languages are available to translate from by
+ /// looking up supported languages using the translation scope. If the from parameter isn't specified,
+ /// automatic language detection is applied to determine the source language.
+ ///
+ /// You must use the from parameter rather than autodetection when using the dynamic dictionary feature.
+ /// Note: the dynamic dictionary feature is case-sensitive.
+ ///
+ /// The cancellation token to use.
+ /// or is null.
+ public virtual Task>> TranslateAsync(string targetLanguage, string text, string sourceLanguage = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(targetLanguage, nameof(targetLanguage));
+ Argument.AssertNotNull(text, nameof(text));
+
+ return this.TranslateAsync(new[] { targetLanguage }, new[] { new InputText(text) } as object, from: sourceLanguage, cancellationToken: cancellationToken);
+ }
+
+ /// Translate Text.
+ ///
+ /// Specifies the language of the output text. The target language must be one of the supported languages included
+ /// in the translation scope. For example, use to=de to translate to German.
+ /// It's possible to translate to multiple languages simultaneously by repeating the parameter in the query string.
+ /// For example, use to=de&to=it to translate to German and Italian.
+ ///
+ /// Array of the text to be translated.
+ /// A client-generated GUID to uniquely identify the request.
+ ///
+ /// Specifies the language of the input text. Find which languages are available to translate from by
+ /// looking up supported languages using the translation scope. If the from parameter isn't specified,
+ /// automatic language detection is applied to determine the source language.
+ ///
+ /// You must use the from parameter rather than autodetection when using the dynamic dictionary feature.
+ /// Note: the dynamic dictionary feature is case-sensitive.
+ ///
+ ///
+ /// Defines whether the text being translated is plain text or HTML text. Any HTML needs to be a well-formed,
+ /// complete element. Possible values are: plain (default) or html.
+ ///
+ ///
+ /// A string specifying the category (domain) of the translation. This parameter is used to get translations
+ /// from a customized system built with Custom Translator. Add the Category ID from your Custom Translator
+ /// project details to this parameter to use your deployed customized system. Default value is: general.
+ ///
+ ///
+ /// Specifies how profanities should be treated in translations.
+ /// Possible values are: NoAction (default), Marked or Deleted.
+ ///
+ ///
+ /// Specifies how profanities should be marked in translations.
+ /// Possible values are: Asterisk (default) or Tag.
+ ///
+ ///
+ /// Specifies whether to include alignment projection from source text to translated text.
+ /// Possible values are: true or false (default).
+ ///
+ ///
+ /// Specifies whether to include sentence boundaries for the input text and the translated text.
+ /// Possible values are: true or false (default).
+ ///
+ ///
+ /// Specifies a fallback language if the language of the input text can't be identified.
+ /// Language autodetection is applied when the from parameter is omitted. If detection fails,
+ /// the suggestedFrom language will be assumed.
+ ///
+ /// Specifies the script of the input text.
+ /// Specifies the script of the translated text.
+ ///
+ /// Specifies that the service is allowed to fall back to a general system when a custom system doesn't exist.
+ /// Possible values are: true (default) or false.
+ ///
+ /// allowFallback=false specifies that the translation should only use systems trained for the category specified
+ /// by the request. If a translation for language X to language Y requires chaining through a pivot language E,
+ /// then all the systems in the chain (X → E and E → Y) will need to be custom and have the same category.
+ /// If no system is found with the specific category, the request will return a 400 status code. allowFallback=true
+ /// specifies that the service is allowed to fall back to a general system when a custom system doesn't exist.
+ ///
+ /// The cancellation token to use.
+ /// or is null.
+ public virtual Response> Translate(IEnumerable targetLanguages, IEnumerable content, string clientTraceId = null, string sourceLanguage = null, TextType? textType = null, string category = null, ProfanityAction? profanityAction = null, ProfanityMarker? profanityMarker = null, bool? includeAlignment = null, bool? includeSentenceLength = null, string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(targetLanguages, nameof(targetLanguages));
+ Argument.AssertNotNull(content, nameof(content));
+
+ return this.Translate(targetLanguages, content.Select(input => new InputText(input)) as object, clientTraceId, sourceLanguage, textType?.ToString(), category, profanityAction?.ToString(), profanityMarker?.ToString(), includeAlignment, includeSentenceLength, suggestedFrom, fromScript, toScript, allowFallback, cancellationToken);
+ }
+
+ /// Translate Text.
+ ///
+ /// Specifies the language of the output text. The target language must be one of the supported languages included
+ /// in the translation scope. For example, use to=de to translate to German.
+ /// It's possible to translate to multiple languages simultaneously by repeating the parameter in the query string.
+ /// For example, use to=de&to=it to translate to German and Italian.
+ ///
+ /// Array of the text to be translated.
+ ///
+ /// Specifies the language of the input text. Find which languages are available to translate from by
+ /// looking up supported languages using the translation scope. If the from parameter isn't specified,
+ /// automatic language detection is applied to determine the source language.
+ ///
+ /// You must use the from parameter rather than autodetection when using the dynamic dictionary feature.
+ /// Note: the dynamic dictionary feature is case-sensitive.
+ ///
+ /// The cancellation token to use.
+ /// or is null.
+ public virtual Response> Translate(string targetLanguage, IEnumerable content, string sourceLanguage = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(targetLanguage, nameof(targetLanguage));
+ Argument.AssertNotNull(content, nameof(content));
+
+ return this.Translate(new[] { targetLanguage }, content.Select(input => new InputText(input)) as object, from: sourceLanguage, cancellationToken: cancellationToken);
+ }
+
+ /// Translate Text.
+ ///
+ /// Specifies the language of the output text. The target language must be one of the supported languages included
+ /// in the translation scope. For example, use to=de to translate to German.
+ /// It's possible to translate to multiple languages simultaneously by repeating the parameter in the query string.
+ /// For example, use to=de&to=it to translate to German and Italian.
+ ///
+ /// Text to be translated.
+ ///
+ /// Specifies the language of the input text. Find which languages are available to translate from by
+ /// looking up supported languages using the translation scope. If the from parameter isn't specified,
+ /// automatic language detection is applied to determine the source language.
+ ///
+ /// You must use the from parameter rather than autodetection when using the dynamic dictionary feature.
+ /// Note: the dynamic dictionary feature is case-sensitive.
+ ///
+ /// The cancellation token to use.
+ /// or is null.
+ public virtual Response> Translate(string targetLanguage, string text, string sourceLanguage = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(targetLanguage, nameof(targetLanguage));
+ Argument.AssertNotNull(text, nameof(text));
+
+ return this.Translate(new[] { targetLanguage }, new[] { new InputText(text) } as object, from: sourceLanguage, cancellationToken: cancellationToken);
+ }
+
+ /// Transliterate Text.
+ ///
+ /// Specifies the language of the text to convert from one script to another.
+ /// Possible languages are listed in the transliteration scope obtained by querying the service
+ /// for its supported languages.
+ ///
+ ///
+ /// Specifies the script used by the input text. Look up supported languages using the transliteration scope,
+ /// to find input scripts available for the selected language.
+ ///
+ ///
+ /// Specifies the output script. Look up supported languages using the transliteration scope, to find output
+ /// scripts available for the selected combination of input language and input script.
+ ///
+ /// Array of the text to be transliterated.
+ /// A client-generated GUID to uniquely identify the request.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public virtual Task>> TransliterateAsync(string language, string fromScript, string toScript, IEnumerable content, string clientTraceId = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(language, nameof(language));
+ Argument.AssertNotNull(fromScript, nameof(fromScript));
+ Argument.AssertNotNull(toScript, nameof(toScript));
+ Argument.AssertNotNull(content, nameof(content));
+
+ return this.TransliterateAsync(language, fromScript, toScript, content.Select(input => new InputText(input)) as object, clientTraceId, cancellationToken);
+ }
+
+ /// Transliterate Text.
+ ///
+ /// Specifies the language of the text to convert from one script to another.
+ /// Possible languages are listed in the transliteration scope obtained by querying the service
+ /// for its supported languages.
+ ///
+ ///
+ /// Specifies the script used by the input text. Look up supported languages using the transliteration scope,
+ /// to find input scripts available for the selected language.
+ ///
+ ///
+ /// Specifies the output script. Look up supported languages using the transliteration scope, to find output
+ /// scripts available for the selected combination of input language and input script.
+ ///
+ /// Text to be transliterated.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public virtual Task>> TransliterateAsync(string language, string fromScript, string toScript, string text, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(language, nameof(language));
+ Argument.AssertNotNull(fromScript, nameof(fromScript));
+ Argument.AssertNotNull(toScript, nameof(toScript));
+ Argument.AssertNotNull(text, nameof(text));
+
+ return this.TransliterateAsync(language, fromScript, toScript, new[] { new InputText(text) } as object, cancellationToken: cancellationToken);
+ }
+
+ /// Transliterate Text.
+ ///
+ /// Specifies the language of the text to convert from one script to another.
+ /// Possible languages are listed in the transliteration scope obtained by querying the service
+ /// for its supported languages.
+ ///
+ ///
+ /// Specifies the script used by the input text. Look up supported languages using the transliteration scope,
+ /// to find input scripts available for the selected language.
+ ///
+ ///
+ /// Specifies the output script. Look up supported languages using the transliteration scope, to find output
+ /// scripts available for the selected combination of input language and input script.
+ ///
+ /// Array of the text to be transliterated.
+ /// A client-generated GUID to uniquely identify the request.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public virtual Response> Transliterate(string language, string fromScript, string toScript, IEnumerable content, string clientTraceId = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(language, nameof(language));
+ Argument.AssertNotNull(fromScript, nameof(fromScript));
+ Argument.AssertNotNull(toScript, nameof(toScript));
+ Argument.AssertNotNull(content, nameof(content));
+
+ return this.Transliterate(language, fromScript, toScript, content.Select(input => new InputText(input)) as object, clientTraceId, cancellationToken);
+ }
+
+ /// Transliterate Text.
+ ///
+ /// Specifies the language of the text to convert from one script to another.
+ /// Possible languages are listed in the transliteration scope obtained by querying the service
+ /// for its supported languages.
+ ///
+ ///
+ /// Specifies the script used by the input text. Look up supported languages using the transliteration scope,
+ /// to find input scripts available for the selected language.
+ ///
+ ///
+ /// Specifies the output script. Look up supported languages using the transliteration scope, to find output
+ /// scripts available for the selected combination of input language and input script.
+ ///
+ /// Text to be transliterated.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public virtual Response> Transliterate(string language, string fromScript, string toScript, string text, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(language, nameof(language));
+ Argument.AssertNotNull(fromScript, nameof(fromScript));
+ Argument.AssertNotNull(toScript, nameof(toScript));
+ Argument.AssertNotNull(text, nameof(text));
+
+ return this.Transliterate(language, fromScript, toScript, new[] { new InputText(text) } as object, cancellationToken: cancellationToken);
+ }
+
+ /// Break Sentence.
+ /// Array of the text for which values the sentence boundaries will be calculated.
+ /// A client-generated GUID to uniquely identify the request.
+ ///
+ /// Language tag identifying the language of the input text.
+ /// If a code isn't specified, automatic language detection will be applied.
+ ///
+ ///
+ /// Script tag identifying the script used by the input text.
+ /// If a script isn't specified, the default script of the language will be assumed.
+ ///
+ /// The cancellation token to use.
+ /// is null.
+ public virtual Task>> FindSentenceBoundariesAsync(IEnumerable content, string clientTraceId = null, string language = null, string script = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ return this.FindSentenceBoundariesAsync(content.Select(input => new InputText(input)) as object, clientTraceId, language, script, cancellationToken);
+ }
+
+ /// Break Sentence.
+ /// Array of the text for which values the sentence boundaries will be calculated.
+ /// A client-generated GUID to uniquely identify the request.
+ ///
+ /// Language tag identifying the language of the input text.
+ /// If a code isn't specified, automatic language detection will be applied.
+ ///
+ ///
+ /// Script tag identifying the script used by the input text.
+ /// If a script isn't specified, the default script of the language will be assumed.
+ ///
+ /// The cancellation token to use.
+ /// is null.
+ public virtual Task>> FindSentenceBoundariesAsync(string text, string clientTraceId = null, string language = null, string script = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(text, nameof(text));
+
+ return this.FindSentenceBoundariesAsync(new[] { new InputText(text) } as object, clientTraceId, language, script, cancellationToken);
+ }
+
+ /// Break Sentence.
+ /// Array of the text for which values the sentence boundaries will be calculated.
+ /// A client-generated GUID to uniquely identify the request.
+ ///
+ /// Language tag identifying the language of the input text.
+ /// If a code isn't specified, automatic language detection will be applied.
+ ///
+ ///
+ /// Script tag identifying the script used by the input text.
+ /// If a script isn't specified, the default script of the language will be assumed.
+ ///
+ /// The cancellation token to use.
+ /// is null.
+ public virtual Response> FindSentenceBoundaries(IEnumerable content, string clientTraceId = null, string language = null, string script = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ return this.FindSentenceBoundaries(content.Select(input => new InputText(input)) as object, clientTraceId, language, script, cancellationToken);
+ }
+
+ /// Break Sentence.
+ /// Array of the text for which values the sentence boundaries will be calculated.
+ /// A client-generated GUID to uniquely identify the request.
+ ///
+ /// Language tag identifying the language of the input text.
+ /// If a code isn't specified, automatic language detection will be applied.
+ ///
+ ///
+ /// Script tag identifying the script used by the input text.
+ /// If a script isn't specified, the default script of the language will be assumed.
+ ///
+ /// The cancellation token to use.
+ /// is null.
+ public virtual Response> FindSentenceBoundaries(string text, string clientTraceId = null, string language = null, string script = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(text, nameof(text));
+
+ return this.FindSentenceBoundaries(new[] { new InputText(text) } as object, clientTraceId, language, script, cancellationToken);
+ }
+
+ /// Dictionary Lookup.
+ ///
+ /// Specifies the language of the input text.
+ /// The source language must be one of the supported languages included in the dictionary scope.
+ ///
+ ///
+ /// Specifies the language of the output text.
+ /// The target language must be one of the supported languages included in the dictionary scope.
+ ///
+ /// Array of the words to lookup in the dictionary.
+ /// A client-generated GUID to uniquely identify the request.
+ /// The cancellation token to use.
+ /// , or is null.
+ public virtual Task>> LookupDictionaryEntriesAsync(string @from, string to, IEnumerable words, string clientTraceId = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(@from, nameof(@from));
+ Argument.AssertNotNull(to, nameof(to));
+ Argument.AssertNotNull(words, nameof(words));
+
+ return this.LookupDictionaryEntriesAsync(from, to, words.Select(input => new InputText(input)) as object, clientTraceId, cancellationToken);
+ }
+
+ /// Dictionary Lookup.
+ ///
+ /// Specifies the language of the input text.
+ /// The source language must be one of the supported languages included in the dictionary scope.
+ ///
+ ///
+ /// Specifies the language of the output text.
+ /// The target language must be one of the supported languages included in the dictionary scope.
+ ///
+ /// A word to lookup in the dictionary.
+ /// A client-generated GUID to uniquely identify the request.
+ /// The cancellation token to use.
+ /// , or is null.
+ public virtual Task>> LookupDictionaryEntriesAsync(string @from, string to, string word, string clientTraceId = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(@from, nameof(@from));
+ Argument.AssertNotNull(to, nameof(to));
+ Argument.AssertNotNull(word, nameof(word));
+
+ return this.LookupDictionaryEntriesAsync(from, to, new[] { new InputText(word) } as object, clientTraceId, cancellationToken);
+ }
+
+ /// Dictionary Lookup.
+ ///
+ /// Specifies the language of the input text.
+ /// The source language must be one of the supported languages included in the dictionary scope.
+ ///
+ ///
+ /// Specifies the language of the output text.
+ /// The target language must be one of the supported languages included in the dictionary scope.
+ ///
+ /// Array of the words to lookup in the dictionary.
+ /// A client-generated GUID to uniquely identify the request.
+ /// The cancellation token to use.
+ /// , or is null.
+ public virtual Response> LookupDictionaryEntries(string @from, string to, IEnumerable words, string clientTraceId = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(@from, nameof(@from));
+ Argument.AssertNotNull(to, nameof(to));
+ Argument.AssertNotNull(words, nameof(words));
+
+ return this.LookupDictionaryEntries(from, to, words.Select(input => new InputText(input)) as object, clientTraceId, cancellationToken);
+ }
+
+ /// Dictionary Lookup.
+ ///
+ /// Specifies the language of the input text.
+ /// The source language must be one of the supported languages included in the dictionary scope.
+ ///
+ ///
+ /// Specifies the language of the output text.
+ /// The target language must be one of the supported languages included in the dictionary scope.
+ ///
+ /// A word to lookup in the dictionary.
+ /// A client-generated GUID to uniquely identify the request.
+ /// The cancellation token to use.
+ /// , or is null.
+ public virtual Response> LookupDictionaryEntries(string @from, string to, string word, string clientTraceId = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(@from, nameof(@from));
+ Argument.AssertNotNull(to, nameof(to));
+ Argument.AssertNotNull(word, nameof(word));
+
+ return this.LookupDictionaryEntries(from, to, new[] { new InputText(word) } as object, clientTraceId, cancellationToken);
+ }
+
+ /// Dictionary Examples.
+ ///
+ /// Specifies the language of the input text.
+ /// The source language must be one of the supported languages included in the dictionary scope.
+ ///
+ ///
+ /// Specifies the language of the output text.
+ /// The target language must be one of the supported languages included in the dictionary scope.
+ ///
+ /// Array of the text to be sent to dictionary.
+ /// A client-generated GUID to uniquely identify the request.
+ /// The cancellation token to use.
+ /// , or is null.
+ public virtual Task>> LookupDictionaryExamplesAsync(string @from, string to, IEnumerable content, string clientTraceId = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(@from, nameof(@from));
+ Argument.AssertNotNull(to, nameof(to));
+ Argument.AssertNotNull(content, nameof(content));
+
+ return this.LookupDictionaryExamplesAsync(from, to, content as object, clientTraceId, cancellationToken);
+ }
+
+ /// Dictionary Examples.
+ ///
+ /// Specifies the language of the input text.
+ /// The source language must be one of the supported languages included in the dictionary scope.
+ ///
+ ///
+ /// Specifies the language of the output text.
+ /// The target language must be one of the supported languages included in the dictionary scope.
+ ///
+ /// Array of the text to be sent to dictionary.
+ /// A client-generated GUID to uniquely identify the request.
+ /// The cancellation token to use.
+ /// , or is null.
+ public virtual Task>> LookupDictionaryExamplesAsync(string @from, string to, InputTextWithTranslation content, string clientTraceId = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(@from, nameof(@from));
+ Argument.AssertNotNull(to, nameof(to));
+ Argument.AssertNotNull(content, nameof(content));
+
+ return this.LookupDictionaryExamplesAsync(from, to, new[] { content } as object, clientTraceId, cancellationToken);
+ }
+
+ /// Dictionary Examples.
+ ///
+ /// Specifies the language of the input text.
+ /// The source language must be one of the supported languages included in the dictionary scope.
+ ///
+ ///
+ /// Specifies the language of the output text.
+ /// The target language must be one of the supported languages included in the dictionary scope.
+ ///
+ /// Array of the text to be sent to dictionary.
+ /// A client-generated GUID to uniquely identify the request.
+ /// The cancellation token to use.
+ /// , or is null.
+ public virtual Response> LookupDictionaryExamples(string @from, string to, IEnumerable content, string clientTraceId = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(@from, nameof(@from));
+ Argument.AssertNotNull(to, nameof(to));
+ Argument.AssertNotNull(content, nameof(content));
+
+ return this.LookupDictionaryExamples(from, to, content as object, clientTraceId, cancellationToken);
+ }
+
+ /// Dictionary Examples.
+ ///
+ /// Specifies the language of the input text.
+ /// The source language must be one of the supported languages included in the dictionary scope.
+ ///
+ ///
+ /// Specifies the language of the output text.
+ /// The target language must be one of the supported languages included in the dictionary scope.
+ ///
+ /// Array of the text to be sent to dictionary.
+ /// A client-generated GUID to uniquely identify the request.
+ /// The cancellation token to use.
+ /// , or is null.
+ public virtual Response> LookupDictionaryExamples(string @from, string to, InputTextWithTranslation content, string clientTraceId = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(@from, nameof(@from));
+ Argument.AssertNotNull(to, nameof(to));
+ Argument.AssertNotNull(content, nameof(content));
+
+ return this.LookupDictionaryExamples(from, to, new[] { content } as object, clientTraceId, cancellationToken);
+ }
+
+ /// Gets the set of languages currently supported by other operations of the Translator.
+ /// A client-generated GUID to uniquely identify the request.
+ ///
+ /// A comma-separated list of names defining the group of languages to return.
+ /// Allowed group names are: `translation`, `transliteration` and `dictionary`.
+ /// If no scope is given, then all groups are returned, which is equivalent to passing
+ /// `scope=translation,transliteration,dictionary`. To decide which set of supported languages
+ /// is appropriate for your scenario, see the description of the [response object](#response-body).
+ ///
+ ///
+ /// The language to use for user interface strings. Some of the fields in the response are names of languages or
+ /// names of regions. Use this parameter to define the language in which these names are returned.
+ /// The language is specified by providing a well-formed BCP 47 language tag. For instance, use the value `fr`
+ /// to request names in French or use the value `zh-Hant` to request names in Chinese Traditional.
+ /// Names are provided in the English language when a target language is not specified or when localization
+ /// is not available.
+ ///
+ ///
+ /// Passing the value of the ETag response header in an If-None-Match field will allow the service to optimize the response.
+ /// If the resource has not been modified, the service will return status code 304 and an empty response body.
+ ///
+ /// Request context.
+ internal virtual async Task GetLanguagesAsync(string clientTraceId = null, string scope = null, string acceptLanguage = null, string ifNoneMatch = null, RequestContext context = default)
+ {
+ ETag? eTag = null;
+ if (ifNoneMatch != null)
+ {
+ eTag = new ETag(ifNoneMatch);
+ }
+
+ return await this.GetLanguagesAsync(clientTraceId, scope, acceptLanguage, eTag, context).ConfigureAwait(false);
+ }
+
+ /// Gets the set of languages currently supported by other operations of the Translator.
+ /// A client-generated GUID to uniquely identify the request.
+ ///
+ /// A comma-separated list of names defining the group of languages to return.
+ /// Allowed group names are: `translation`, `transliteration` and `dictionary`.
+ /// If no scope is given, then all groups are returned, which is equivalent to passing
+ /// `scope=translation,transliteration,dictionary`. To decide which set of supported languages
+ /// is appropriate for your scenario, see the description of the [response object](#response-body).
+ ///
+ ///
+ /// The language to use for user interface strings. Some of the fields in the response are names of languages or
+ /// names of regions. Use this parameter to define the language in which these names are returned.
+ /// The language is specified by providing a well-formed BCP 47 language tag. For instance, use the value `fr`
+ /// to request names in French or use the value `zh-Hant` to request names in Chinese Traditional.
+ /// Names are provided in the English language when a target language is not specified or when localization
+ /// is not available.
+ ///
+ ///
+ /// Passing the value of the ETag response header in an If-None-Match field will allow the service to optimize the response.
+ /// If the resource has not been modified, the service will return status code 304 and an empty response body.
+ ///
+ /// Request context.
+ internal virtual Response GetLanguages(string clientTraceId = null, string scope = null, string acceptLanguage = null, string ifNoneMatch = null, RequestContext context = default)
+ {
+ ETag? eTag = null;
+ if (ifNoneMatch != null)
+ {
+ eTag = new ETag(ifNoneMatch);
+ }
+
+ return this.GetLanguages(clientTraceId, scope, acceptLanguage, eTag, context);
+ }
+
+ // Overrides for generated class
+
+ /// Gets the set of languages currently supported by other operations of the Translator.
+ /// A client-generated GUID to uniquely identify the request.
+ ///
+ /// A comma-separated list of names defining the group of languages to return.
+ /// Allowed group names are: `translation`, `transliteration` and `dictionary`.
+ /// If no scope is given, then all groups are returned, which is equivalent to passing
+ /// `scope=translation,transliteration,dictionary`. To decide which set of supported languages
+ /// is appropriate for your scenario, see the description of the [response object](#response-body).
+ ///
+ ///
+ /// The language to use for user interface strings. Some of the fields in the response are names of languages or
+ /// names of regions. Use this parameter to define the language in which these names are returned.
+ /// The language is specified by providing a well-formed BCP 47 language tag. For instance, use the value `fr`
+ /// to request names in French or use the value `zh-Hant` to request names in Chinese Traditional.
+ /// Names are provided in the English language when a target language is not specified or when localization
+ /// is not available.
+ ///
+ ///
+ /// Passing the value of the ETag response header in an If-None-Match field will allow the service to optimize the response.
+ /// If the resource has not been modified, the service will return status code 304 and an empty response body.
+ ///
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// Service returned a non-success status code.
+ /// The response returned from the service. Details of the response body schema are in the Remarks section below.
+ internal virtual async Task GetLanguagesAsync(string clientTraceId = null, string scope = null, string acceptLanguage = null, ETag? ifNoneMatch = null, RequestContext context = null)
+ {
+ using var scope0 = ClientDiagnostics.CreateScope("TextTranslationClient.GetLanguages");
+ scope0.Start();
+ try
+ {
+ using HttpMessage message = CreateGetLanguagesRequest(clientTraceId, scope, acceptLanguage, ifNoneMatch, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope0.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets the set of languages currently supported by other operations of the Translator.
+ /// A client-generated GUID to uniquely identify the request.
+ ///
+ /// A comma-separated list of names defining the group of languages to return.
+ /// Allowed group names are: `translation`, `transliteration` and `dictionary`.
+ /// If no scope is given, then all groups are returned, which is equivalent to passing
+ /// `scope=translation,transliteration,dictionary`. To decide which set of supported languages
+ /// is appropriate for your scenario, see the description of the [response object](#response-body).
+ ///
+ ///
+ /// The language to use for user interface strings. Some of the fields in the response are names of languages or
+ /// names of regions. Use this parameter to define the language in which these names are returned.
+ /// The language is specified by providing a well-formed BCP 47 language tag. For instance, use the value `fr`
+ /// to request names in French or use the value `zh-Hant` to request names in Chinese Traditional.
+ /// Names are provided in the English language when a target language is not specified or when localization
+ /// is not available.
+ ///
+ ///
+ /// Passing the value of the ETag response header in an If-None-Match field will allow the service to optimize the response.
+ /// If the resource has not been modified, the service will return status code 304 and an empty response body.
+ ///
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// Service returned a non-success status code.
+ /// The response returned from the service. Details of the response body schema are in the Remarks section below.
+ internal virtual Response GetLanguages(string clientTraceId = null, string scope = null, string acceptLanguage = null, ETag? ifNoneMatch = null, RequestContext context = null)
+ {
+ using var scope0 = ClientDiagnostics.CreateScope("TextTranslationClient.GetLanguages");
+ scope0.Start();
+ try
+ {
+ using HttpMessage message = CreateGetLanguagesRequest(clientTraceId, scope, acceptLanguage, ifNoneMatch, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope0.Failed(e);
+ throw;
+ }
+ }
+
+ /// Translate Text.
+ ///
+ /// Specifies the language of the output text. The target language must be one of the supported languages included
+ /// in the translation scope. For example, use to=de to translate to German.
+ /// It's possible to translate to multiple languages simultaneously by repeating the parameter in the query string.
+ /// For example, use to=de&to=it to translate to German and Italian.
+ ///
+ /// Array of the text to be translated.
+ /// A client-generated GUID to uniquely identify the request.
+ ///
+ /// Specifies the language of the input text. Find which languages are available to translate from by
+ /// looking up supported languages using the translation scope. If the from parameter isn't specified,
+ /// automatic language detection is applied to determine the source language.
+ ///
+ /// You must use the from parameter rather than autodetection when using the dynamic dictionary feature.
+ /// Note: the dynamic dictionary feature is case-sensitive.
+ ///
+ ///
+ /// Defines whether the text being translated is plain text or HTML text. Any HTML needs to be a well-formed,
+ /// complete element. Possible values are: plain (default) or html. Allowed values: "plain" | "html"
+ ///
+ ///
+ /// A string specifying the category (domain) of the translation. This parameter is used to get translations
+ /// from a customized system built with Custom Translator. Add the Category ID from your Custom Translator
+ /// project details to this parameter to use your deployed customized system. Default value is: general.
+ ///
+ ///
+ /// Specifies how profanities should be treated in translations.
+ /// Possible values are: NoAction (default), Marked or Deleted. Allowed values: "NoAction" | "Marked" | "Deleted"
+ ///
+ ///
+ /// Specifies how profanities should be marked in translations.
+ /// Possible values are: Asterisk (default) or Tag. . Allowed values: "Asterisk" | "Tag"
+ ///
+ ///
+ /// Specifies whether to include alignment projection from source text to translated text.
+ /// Possible values are: true or false (default).
+ ///
+ ///
+ /// Specifies whether to include sentence boundaries for the input text and the translated text.
+ /// Possible values are: true or false (default).
+ ///
+ ///
+ /// Specifies a fallback language if the language of the input text can't be identified.
+ /// Language autodetection is applied when the from parameter is omitted. If detection fails,
+ /// the suggestedFrom language will be assumed.
+ ///
+ /// Specifies the script of the input text.
+ /// Specifies the script of the translated text.
+ ///
+ /// Specifies that the service is allowed to fall back to a general system when a custom system doesn't exist.
+ /// Possible values are: true (default) or false.
+ ///
+ /// allowFallback=false specifies that the translation should only use systems trained for the category specified
+ /// by the request. If a translation for language X to language Y requires chaining through a pivot language E,
+ /// then all the systems in the chain (X → E and E → Y) will need to be custom and have the same category.
+ /// If no system is found with the specific category, the request will return a 400 status code. allowFallback=true
+ /// specifies that the service is allowed to fall back to a general system when a custom system doesn't exist.
+ ///
+ /// The cancellation token to use.
+ /// or is null.
+ internal virtual async Task>> TranslateAsync(IEnumerable to, object content, string clientTraceId = null, string @from = null, string textType = null, string category = null, string profanityAction = null, string profanityMarker = null, bool? includeAlignment = null, bool? includeSentenceLength = null, string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(to, nameof(to));
+ Argument.AssertNotNull(content, nameof(content));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await TranslateAsync(to, RequestContent.Create(content), clientTraceId, @from, textType, category, profanityAction, profanityMarker, includeAlignment, includeSentenceLength, suggestedFrom, fromScript, toScript, allowFallback, context).ConfigureAwait(false);
+ IReadOnlyList value = default;
+ using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ List array = new List();
+ foreach (var item in document.RootElement.EnumerateArray())
+ {
+ array.Add(TranslatedTextItem.DeserializeTranslatedTextItem(item));
+ }
+ value = array;
+ return Response.FromValue(value, response);
+ }
+
+ /// Translate Text.
+ ///
+ /// Specifies the language of the output text. The target language must be one of the supported languages included
+ /// in the translation scope. For example, use to=de to translate to German.
+ /// It's possible to translate to multiple languages simultaneously by repeating the parameter in the query string.
+ /// For example, use to=de&to=it to translate to German and Italian.
+ ///
+ /// Array of the text to be translated.
+ /// A client-generated GUID to uniquely identify the request.
+ ///
+ /// Specifies the language of the input text. Find which languages are available to translate from by
+ /// looking up supported languages using the translation scope. If the from parameter isn't specified,
+ /// automatic language detection is applied to determine the source language.
+ ///
+ /// You must use the from parameter rather than autodetection when using the dynamic dictionary feature.
+ /// Note: the dynamic dictionary feature is case-sensitive.
+ ///
+ ///
+ /// Defines whether the text being translated is plain text or HTML text. Any HTML needs to be a well-formed,
+ /// complete element. Possible values are: plain (default) or html. Allowed values: "plain" | "html"
+ ///
+ ///
+ /// A string specifying the category (domain) of the translation. This parameter is used to get translations
+ /// from a customized system built with Custom Translator. Add the Category ID from your Custom Translator
+ /// project details to this parameter to use your deployed customized system. Default value is: general.
+ ///
+ ///
+ /// Specifies how profanities should be treated in translations.
+ /// Possible values are: NoAction (default), Marked or Deleted. Allowed values: "NoAction" | "Marked" | "Deleted"
+ ///
+ ///
+ /// Specifies how profanities should be marked in translations.
+ /// Possible values are: Asterisk (default) or Tag. . Allowed values: "Asterisk" | "Tag"
+ ///
+ ///
+ /// Specifies whether to include alignment projection from source text to translated text.
+ /// Possible values are: true or false (default).
+ ///
+ ///
+ /// Specifies whether to include sentence boundaries for the input text and the translated text.
+ /// Possible values are: true or false (default).
+ ///
+ ///
+ /// Specifies a fallback language if the language of the input text can't be identified.
+ /// Language autodetection is applied when the from parameter is omitted. If detection fails,
+ /// the suggestedFrom language will be assumed.
+ ///
+ /// Specifies the script of the input text.
+ /// Specifies the script of the translated text.
+ ///
+ /// Specifies that the service is allowed to fall back to a general system when a custom system doesn't exist.
+ /// Possible values are: true (default) or false.
+ ///
+ /// allowFallback=false specifies that the translation should only use systems trained for the category specified
+ /// by the request. If a translation for language X to language Y requires chaining through a pivot language E,
+ /// then all the systems in the chain (X → E and E → Y) will need to be custom and have the same category.
+ /// If no system is found with the specific category, the request will return a 400 status code. allowFallback=true
+ /// specifies that the service is allowed to fall back to a general system when a custom system doesn't exist.
+ ///
+ /// The cancellation token to use.
+ /// or is null.
+ internal virtual Response> Translate(IEnumerable to, object content, string clientTraceId = null, string @from = null, string textType = null, string category = null, string profanityAction = null, string profanityMarker = null, bool? includeAlignment = null, bool? includeSentenceLength = null, string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(to, nameof(to));
+ Argument.AssertNotNull(content, nameof(content));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = Translate(to, RequestContent.Create(content), clientTraceId, @from, textType, category, profanityAction, profanityMarker, includeAlignment, includeSentenceLength, suggestedFrom, fromScript, toScript, allowFallback, context);
+ IReadOnlyList value = default;
+ using var document = JsonDocument.Parse(response.ContentStream);
+ List array = new List();
+ foreach (var item in document.RootElement.EnumerateArray())
+ {
+ array.Add(TranslatedTextItem.DeserializeTranslatedTextItem(item));
+ }
+ value = array;
+ return Response.FromValue(value, response);
+ }
+
+ /// Translate Text.
+ ///
+ /// Specifies the language of the output text. The target language must be one of the supported languages included
+ /// in the translation scope. For example, use to=de to translate to German.
+ /// It's possible to translate to multiple languages simultaneously by repeating the parameter in the query string.
+ /// For example, use to=de&to=it to translate to German and Italian.
+ ///
+ /// The content to send as the body of the request. Details of the request body schema are in the Remarks section below.
+ /// A client-generated GUID to uniquely identify the request.
+ ///
+ /// Specifies the language of the input text. Find which languages are available to translate from by
+ /// looking up supported languages using the translation scope. If the from parameter isn't specified,
+ /// automatic language detection is applied to determine the source language.
+ ///
+ /// You must use the from parameter rather than autodetection when using the dynamic dictionary feature.
+ /// Note: the dynamic dictionary feature is case-sensitive.
+ ///
+ ///
+ /// Defines whether the text being translated is plain text or HTML text. Any HTML needs to be a well-formed,
+ /// complete element. Possible values are: plain (default) or html. Allowed values: "plain" | "html"
+ ///
+ ///
+ /// A string specifying the category (domain) of the translation. This parameter is used to get translations
+ /// from a customized system built with Custom Translator. Add the Category ID from your Custom Translator
+ /// project details to this parameter to use your deployed customized system. Default value is: general.
+ ///
+ ///
+ /// Specifies how profanities should be treated in translations.
+ /// Possible values are: NoAction (default), Marked or Deleted. Allowed values: "NoAction" | "Marked" | "Deleted"
+ ///
+ ///
+ /// Specifies how profanities should be marked in translations.
+ /// Possible values are: Asterisk (default) or Tag. . Allowed values: "Asterisk" | "Tag"
+ ///
+ ///
+ /// Specifies whether to include alignment projection from source text to translated text.
+ /// Possible values are: true or false (default).
+ ///
+ ///
+ /// Specifies whether to include sentence boundaries for the input text and the translated text.
+ /// Possible values are: true or false (default).
+ ///
+ ///
+ /// Specifies a fallback language if the language of the input text can't be identified.
+ /// Language autodetection is applied when the from parameter is omitted. If detection fails,
+ /// the suggestedFrom language will be assumed.
+ ///
+ /// Specifies the script of the input text.
+ /// Specifies the script of the translated text.
+ ///
+ /// Specifies that the service is allowed to fall back to a general system when a custom system doesn't exist.
+ /// Possible values are: true (default) or false.
+ ///
+ /// allowFallback=false specifies that the translation should only use systems trained for the category specified
+ /// by the request. If a translation for language X to language Y requires chaining through a pivot language E,
+ /// then all the systems in the chain (X → E and E → Y) will need to be custom and have the same category.
+ /// If no system is found with the specific category, the request will return a 400 status code. allowFallback=true
+ /// specifies that the service is allowed to fall back to a general system when a custom system doesn't exist.
+ ///
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// Service returned a non-success status code.
+ /// The response returned from the service. Details of the response body schema are in the Remarks section below.
+ internal virtual async Task TranslateAsync(IEnumerable to, RequestContent content, string clientTraceId = null, string @from = null, string textType = null, string category = null, string profanityAction = null, string profanityMarker = null, bool? includeAlignment = null, bool? includeSentenceLength = null, string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = null, RequestContext context = null)
+ {
+ Argument.AssertNotNull(to, nameof(to));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("TextTranslationClient.Translate");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateTranslateRequest(to, content, clientTraceId, @from, textType, category, profanityAction, profanityMarker, includeAlignment, includeSentenceLength, suggestedFrom, fromScript, toScript, allowFallback, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Translate Text.
+ ///
+ /// Specifies the language of the output text. The target language must be one of the supported languages included
+ /// in the translation scope. For example, use to=de to translate to German.
+ /// It's possible to translate to multiple languages simultaneously by repeating the parameter in the query string.
+ /// For example, use to=de&to=it to translate to German and Italian.
+ ///
+ /// The content to send as the body of the request. Details of the request body schema are in the Remarks section below.
+ /// A client-generated GUID to uniquely identify the request.
+ ///
+ /// Specifies the language of the input text. Find which languages are available to translate from by
+ /// looking up supported languages using the translation scope. If the from parameter isn't specified,
+ /// automatic language detection is applied to determine the source language.
+ ///
+ /// You must use the from parameter rather than autodetection when using the dynamic dictionary feature.
+ /// Note: the dynamic dictionary feature is case-sensitive.
+ ///
+ ///
+ /// Defines whether the text being translated is plain text or HTML text. Any HTML needs to be a well-formed,
+ /// complete element. Possible values are: plain (default) or html. Allowed values: "plain" | "html"
+ ///
+ ///
+ /// A string specifying the category (domain) of the translation. This parameter is used to get translations
+ /// from a customized system built with Custom Translator. Add the Category ID from your Custom Translator
+ /// project details to this parameter to use your deployed customized system. Default value is: general.
+ ///
+ ///
+ /// Specifies how profanities should be treated in translations.
+ /// Possible values are: NoAction (default), Marked or Deleted. Allowed values: "NoAction" | "Marked" | "Deleted"
+ ///
+ ///
+ /// Specifies how profanities should be marked in translations.
+ /// Possible values are: Asterisk (default) or Tag. . Allowed values: "Asterisk" | "Tag"
+ ///
+ ///
+ /// Specifies whether to include alignment projection from source text to translated text.
+ /// Possible values are: true or false (default).
+ ///
+ ///
+ /// Specifies whether to include sentence boundaries for the input text and the translated text.
+ /// Possible values are: true or false (default).
+ ///
+ ///
+ /// Specifies a fallback language if the language of the input text can't be identified.
+ /// Language autodetection is applied when the from parameter is omitted. If detection fails,
+ /// the suggestedFrom language will be assumed.
+ ///
+ /// Specifies the script of the input text.
+ /// Specifies the script of the translated text.
+ ///
+ /// Specifies that the service is allowed to fall back to a general system when a custom system doesn't exist.
+ /// Possible values are: true (default) or false.
+ ///
+ /// allowFallback=false specifies that the translation should only use systems trained for the category specified
+ /// by the request. If a translation for language X to language Y requires chaining through a pivot language E,
+ /// then all the systems in the chain (X → E and E → Y) will need to be custom and have the same category.
+ /// If no system is found with the specific category, the request will return a 400 status code. allowFallback=true
+ /// specifies that the service is allowed to fall back to a general system when a custom system doesn't exist.
+ ///
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// Service returned a non-success status code.
+ /// The response returned from the service. Details of the response body schema are in the Remarks section below.
+ internal virtual Response Translate(IEnumerable to, RequestContent content, string clientTraceId = null, string @from = null, string textType = null, string category = null, string profanityAction = null, string profanityMarker = null, bool? includeAlignment = null, bool? includeSentenceLength = null, string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = null, RequestContext context = null)
+ {
+ Argument.AssertNotNull(to, nameof(to));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("TextTranslationClient.Translate");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateTranslateRequest(to, content, clientTraceId, @from, textType, category, profanityAction, profanityMarker, includeAlignment, includeSentenceLength, suggestedFrom, fromScript, toScript, allowFallback, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Transliterate Text.
+ ///
+ /// Specifies the language of the text to convert from one script to another.
+ /// Possible languages are listed in the transliteration scope obtained by querying the service
+ /// for its supported languages.
+ ///
+ ///
+ /// Specifies the script used by the input text. Look up supported languages using the transliteration scope,
+ /// to find input scripts available for the selected language.
+ ///
+ ///
+ /// Specifies the output script. Look up supported languages using the transliteration scope, to find output
+ /// scripts available for the selected combination of input language and input script.
+ ///
+ /// Array of the text to be transliterated.
+ /// A client-generated GUID to uniquely identify the request.
+ /// The cancellation token to use.
+ /// , , or is null.
+ internal virtual async Task>> TransliterateAsync(string language, string fromScript, string toScript, object content, string clientTraceId = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(language, nameof(language));
+ Argument.AssertNotNull(fromScript, nameof(fromScript));
+ Argument.AssertNotNull(toScript, nameof(toScript));
+ Argument.AssertNotNull(content, nameof(content));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await TransliterateAsync(language, fromScript, toScript, RequestContent.Create(content), clientTraceId, context).ConfigureAwait(false);
+ IReadOnlyList value = default;
+ using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ List array = new List();
+ foreach (var item in document.RootElement.EnumerateArray())
+ {
+ array.Add(TransliteratedText.DeserializeTransliteratedText(item));
+ }
+ value = array;
+ return Response.FromValue(value, response);
+ }
+
+ /// Transliterate Text.
+ ///
+ /// Specifies the language of the text to convert from one script to another.
+ /// Possible languages are listed in the transliteration scope obtained by querying the service
+ /// for its supported languages.
+ ///
+ ///
+ /// Specifies the script used by the input text. Look up supported languages using the transliteration scope,
+ /// to find input scripts available for the selected language.
+ ///
+ ///
+ /// Specifies the output script. Look up supported languages using the transliteration scope, to find output
+ /// scripts available for the selected combination of input language and input script.
+ ///
+ /// Array of the text to be transliterated.
+ /// A client-generated GUID to uniquely identify the request.
+ /// The cancellation token to use.
+ /// , , or is null.
+ internal virtual Response> Transliterate(string language, string fromScript, string toScript, object content, string clientTraceId = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(language, nameof(language));
+ Argument.AssertNotNull(fromScript, nameof(fromScript));
+ Argument.AssertNotNull(toScript, nameof(toScript));
+ Argument.AssertNotNull(content, nameof(content));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = Transliterate(language, fromScript, toScript, RequestContent.Create(content), clientTraceId, context);
+ IReadOnlyList value = default;
+ using var document = JsonDocument.Parse(response.ContentStream);
+ List array = new List();
+ foreach (var item in document.RootElement.EnumerateArray())
+ {
+ array.Add(TransliteratedText.DeserializeTransliteratedText(item));
+ }
+ value = array;
+ return Response.FromValue(value, response);
+ }
+
+ /// Transliterate Text.
+ ///
+ /// Specifies the language of the text to convert from one script to another.
+ /// Possible languages are listed in the transliteration scope obtained by querying the service
+ /// for its supported languages.
+ ///
+ ///
+ /// Specifies the script used by the input text. Look up supported languages using the transliteration scope,
+ /// to find input scripts available for the selected language.
+ ///
+ ///
+ /// Specifies the output script. Look up supported languages using the transliteration scope, to find output
+ /// scripts available for the selected combination of input language and input script.
+ ///
+ /// The content to send as the body of the request. Details of the request body schema are in the Remarks section below.
+ /// A client-generated GUID to uniquely identify the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// , , or is null.
+ /// Service returned a non-success status code.
+ /// The response returned from the service. Details of the response body schema are in the Remarks section below.
+ internal virtual async Task TransliterateAsync(string language, string fromScript, string toScript, RequestContent content, string clientTraceId = null, RequestContext context = null)
+ {
+ Argument.AssertNotNull(language, nameof(language));
+ Argument.AssertNotNull(fromScript, nameof(fromScript));
+ Argument.AssertNotNull(toScript, nameof(toScript));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("TextTranslationClient.Transliterate");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateTransliterateRequest(language, fromScript, toScript, content, clientTraceId, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Transliterate Text.
+ ///
+ /// Specifies the language of the text to convert from one script to another.
+ /// Possible languages are listed in the transliteration scope obtained by querying the service
+ /// for its supported languages.
+ ///
+ ///
+ /// Specifies the script used by the input text. Look up supported languages using the transliteration scope,
+ /// to find input scripts available for the selected language.
+ ///
+ ///
+ /// Specifies the output script. Look up supported languages using the transliteration scope, to find output
+ /// scripts available for the selected combination of input language and input script.
+ ///
+ /// The content to send as the body of the request. Details of the request body schema are in the Remarks section below.
+ /// A client-generated GUID to uniquely identify the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// , , or is null.
+ /// Service returned a non-success status code.
+ /// The response returned from the service. Details of the response body schema are in the Remarks section below.
+ internal virtual Response Transliterate(string language, string fromScript, string toScript, RequestContent content, string clientTraceId = null, RequestContext context = null)
+ {
+ Argument.AssertNotNull(language, nameof(language));
+ Argument.AssertNotNull(fromScript, nameof(fromScript));
+ Argument.AssertNotNull(toScript, nameof(toScript));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("TextTranslationClient.Transliterate");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateTransliterateRequest(language, fromScript, toScript, content, clientTraceId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Find Sentence Boundaries.
+ /// Array of the text for which values the sentence boundaries will be calculated.
+ /// A client-generated GUID to uniquely identify the request.
+ ///
+ /// Language tag identifying the language of the input text.
+ /// If a code isn't specified, automatic language detection will be applied.
+ ///
+ ///
+ /// Script tag identifying the script used by the input text.
+ /// If a script isn't specified, the default script of the language will be assumed.
+ ///
+ /// The cancellation token to use.
+ /// is null.
+ internal virtual async Task>> FindSentenceBoundariesAsync(object content, string clientTraceId = null, string language = null, string script = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await FindSentenceBoundariesAsync(RequestContent.Create(content), clientTraceId, language, script, context).ConfigureAwait(false);
+ IReadOnlyList value = default;
+ using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ List array = new List();
+ foreach (var item in document.RootElement.EnumerateArray())
+ {
+ array.Add(BreakSentenceItem.DeserializeBreakSentenceItem(item));
+ }
+ value = array;
+ return Response.FromValue(value, response);
+ }
+
+ /// Find Sentence Boundaries.
+ /// Array of the text for which values the sentence boundaries will be calculated.
+ /// A client-generated GUID to uniquely identify the request.
+ ///
+ /// Language tag identifying the language of the input text.
+ /// If a code isn't specified, automatic language detection will be applied.
+ ///
+ ///
+ /// Script tag identifying the script used by the input text.
+ /// If a script isn't specified, the default script of the language will be assumed.
+ ///
+ /// The cancellation token to use.
+ /// is null.
+ internal virtual Response> FindSentenceBoundaries(object content, string clientTraceId = null, string language = null, string script = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = FindSentenceBoundaries(RequestContent.Create(content), clientTraceId, language, script, context);
+ IReadOnlyList value = default;
+ using var document = JsonDocument.Parse(response.ContentStream);
+ List array = new List();
+ foreach (var item in document.RootElement.EnumerateArray())
+ {
+ array.Add(BreakSentenceItem.DeserializeBreakSentenceItem(item));
+ }
+ value = array;
+ return Response.FromValue(value, response);
+ }
+
+ /// Find Sentence Boundaries.
+ /// The content to send as the body of the request. Details of the request body schema are in the Remarks section below.
+ /// A client-generated GUID to uniquely identify the request.
+ ///
+ /// Language tag identifying the language of the input text.
+ /// If a code isn't specified, automatic language detection will be applied.
+ ///
+ ///
+ /// Script tag identifying the script used by the input text.
+ /// If a script isn't specified, the default script of the language will be assumed.
+ ///
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// Service returned a non-success status code.
+ /// The response returned from the service. Details of the response body schema are in the Remarks section below.
+ internal virtual async Task FindSentenceBoundariesAsync(RequestContent content, string clientTraceId = null, string language = null, string script = null, RequestContext context = null)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("TextTranslationClient.FindSentenceBoundaries");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateFindSentenceBoundariesRequest(content, clientTraceId, language, script, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Find Sentence Boundaries.
+ /// The content to send as the body of the request. Details of the request body schema are in the Remarks section below.
+ /// A client-generated GUID to uniquely identify the request.
+ ///
+ /// Language tag identifying the language of the input text.
+ /// If a code isn't specified, automatic language detection will be applied.
+ ///
+ ///
+ /// Script tag identifying the script used by the input text.
+ /// If a script isn't specified, the default script of the language will be assumed.
+ ///
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// Service returned a non-success status code.
+ /// The response returned from the service. Details of the response body schema are in the Remarks section below.
+ internal virtual Response FindSentenceBoundaries(RequestContent content, string clientTraceId = null, string language = null, string script = null, RequestContext context = null)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("TextTranslationClient.FindSentenceBoundaries");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateFindSentenceBoundariesRequest(content, clientTraceId, language, script, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Lookup Dictionary Entries.
+ ///
+ /// Specifies the language of the input text.
+ /// The source language must be one of the supported languages included in the dictionary scope.
+ ///
+ ///
+ /// Specifies the language of the output text.
+ /// The target language must be one of the supported languages included in the dictionary scope.
+ ///
+ /// Array of the text to be sent to dictionary.
+ /// A client-generated GUID to uniquely identify the request.
+ /// The cancellation token to use.
+ /// , or is null.
+ internal virtual async Task>> LookupDictionaryEntriesAsync(string @from, string to, object content, string clientTraceId = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(@from, nameof(@from));
+ Argument.AssertNotNull(to, nameof(to));
+ Argument.AssertNotNull(content, nameof(content));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await LookupDictionaryEntriesAsync(@from, to, RequestContent.Create(content), clientTraceId, context).ConfigureAwait(false);
+ IReadOnlyList value = default;
+ using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ List array = new List();
+ foreach (var item in document.RootElement.EnumerateArray())
+ {
+ array.Add(DictionaryLookupItem.DeserializeDictionaryLookupItem(item));
+ }
+ value = array;
+ return Response.FromValue(value, response);
+ }
+
+ /// Lookup Dictionary Entries.
+ ///
+ /// Specifies the language of the input text.
+ /// The source language must be one of the supported languages included in the dictionary scope.
+ ///
+ ///
+ /// Specifies the language of the output text.
+ /// The target language must be one of the supported languages included in the dictionary scope.
+ ///
+ /// Array of the text to be sent to dictionary.
+ /// A client-generated GUID to uniquely identify the request.
+ /// The cancellation token to use.
+ /// , or is null.
+ internal virtual Response> LookupDictionaryEntries(string @from, string to, object content, string clientTraceId = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(@from, nameof(@from));
+ Argument.AssertNotNull(to, nameof(to));
+ Argument.AssertNotNull(content, nameof(content));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = LookupDictionaryEntries(@from, to, RequestContent.Create(content), clientTraceId, context);
+ IReadOnlyList value = default;
+ using var document = JsonDocument.Parse(response.ContentStream);
+ List array = new List();
+ foreach (var item in document.RootElement.EnumerateArray())
+ {
+ array.Add(DictionaryLookupItem.DeserializeDictionaryLookupItem(item));
+ }
+ value = array;
+ return Response.FromValue(value, response);
+ }
+
+ /// Lookup Dictionary Entries.
+ ///
+ /// Specifies the language of the input text.
+ /// The source language must be one of the supported languages included in the dictionary scope.
+ ///
+ ///
+ /// Specifies the language of the output text.
+ /// The target language must be one of the supported languages included in the dictionary scope.
+ ///
+ /// The content to send as the body of the request. Details of the request body schema are in the Remarks section below.
+ /// A client-generated GUID to uniquely identify the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// , or is null.
+ /// Service returned a non-success status code.
+ /// The response returned from the service. Details of the response body schema are in the Remarks section below.
+ internal virtual async Task LookupDictionaryEntriesAsync(string @from, string to, RequestContent content, string clientTraceId = null, RequestContext context = null)
+ {
+ Argument.AssertNotNull(@from, nameof(@from));
+ Argument.AssertNotNull(to, nameof(to));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("TextTranslationClient.LookupDictionaryEntries");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateLookupDictionaryEntriesRequest(@from, to, content, clientTraceId, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Lookup Dictionary Entries.
+ ///
+ /// Specifies the language of the input text.
+ /// The source language must be one of the supported languages included in the dictionary scope.
+ ///
+ ///
+ /// Specifies the language of the output text.
+ /// The target language must be one of the supported languages included in the dictionary scope.
+ ///
+ /// The content to send as the body of the request. Details of the request body schema are in the Remarks section below.
+ /// A client-generated GUID to uniquely identify the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// , or is null.
+ /// Service returned a non-success status code.
+ /// The response returned from the service. Details of the response body schema are in the Remarks section below.
+ internal virtual Response LookupDictionaryEntries(string @from, string to, RequestContent content, string clientTraceId = null, RequestContext context = null)
+ {
+ Argument.AssertNotNull(@from, nameof(@from));
+ Argument.AssertNotNull(to, nameof(to));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("TextTranslationClient.LookupDictionaryEntries");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateLookupDictionaryEntriesRequest(@from, to, content, clientTraceId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Lookup Dictionary Examples.
+ ///
+ /// Specifies the language of the input text.
+ /// The source language must be one of the supported languages included in the dictionary scope.
+ ///
+ ///
+ /// Specifies the language of the output text.
+ /// The target language must be one of the supported languages included in the dictionary scope.
+ ///
+ /// Array of the text to be sent to dictionary.
+ /// A client-generated GUID to uniquely identify the request.
+ /// The cancellation token to use.
+ /// , or is null.
+ internal virtual async Task>> LookupDictionaryExamplesAsync(string @from, string to, object content, string clientTraceId = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(@from, nameof(@from));
+ Argument.AssertNotNull(to, nameof(to));
+ Argument.AssertNotNull(content, nameof(content));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await LookupDictionaryExamplesAsync(@from, to, RequestContent.Create(content), clientTraceId, context).ConfigureAwait(false);
+ IReadOnlyList value = default;
+ using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ List array = new List();
+ foreach (var item in document.RootElement.EnumerateArray())
+ {
+ array.Add(DictionaryExampleItem.DeserializeDictionaryExampleItem(item));
+ }
+ value = array;
+ return Response.FromValue(value, response);
+ }
+
+ /// Lookup Dictionary Examples.
+ ///
+ /// Specifies the language of the input text.
+ /// The source language must be one of the supported languages included in the dictionary scope.
+ ///
+ ///
+ /// Specifies the language of the output text.
+ /// The target language must be one of the supported languages included in the dictionary scope.
+ ///
+ /// Array of the text to be sent to dictionary.
+ /// A client-generated GUID to uniquely identify the request.
+ /// The cancellation token to use.
+ /// , or is null.
+ internal virtual Response> LookupDictionaryExamples(string @from, string to, object content, string clientTraceId = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(@from, nameof(@from));
+ Argument.AssertNotNull(to, nameof(to));
+ Argument.AssertNotNull(content, nameof(content));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = LookupDictionaryExamples(@from, to, RequestContent.Create(content), clientTraceId, context);
+ IReadOnlyList value = default;
+ using var document = JsonDocument.Parse(response.ContentStream);
+ List array = new List();
+ foreach (var item in document.RootElement.EnumerateArray())
+ {
+ array.Add(DictionaryExampleItem.DeserializeDictionaryExampleItem(item));
+ }
+ value = array;
+ return Response.FromValue(value, response);
+ }
+
+ /// Lookup Dictionary Examples.
+ ///
+ /// Specifies the language of the input text.
+ /// The source language must be one of the supported languages included in the dictionary scope.
+ ///
+ ///
+ /// Specifies the language of the output text.
+ /// The target language must be one of the supported languages included in the dictionary scope.
+ ///
+ /// The content to send as the body of the request. Details of the request body schema are in the Remarks section below.
+ /// A client-generated GUID to uniquely identify the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// , or is null.
+ /// Service returned a non-success status code.
+ /// The response returned from the service. Details of the response body schema are in the Remarks section below.
+ internal virtual async Task LookupDictionaryExamplesAsync(string @from, string to, RequestContent content, string clientTraceId = null, RequestContext context = null)
+ {
+ Argument.AssertNotNull(@from, nameof(@from));
+ Argument.AssertNotNull(to, nameof(to));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("TextTranslationClient.LookupDictionaryExamples");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateLookupDictionaryExamplesRequest(@from, to, content, clientTraceId, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Lookup Dictionary Examples.
+ ///
+ /// Specifies the language of the input text.
+ /// The source language must be one of the supported languages included in the dictionary scope.
+ ///
+ ///
+ /// Specifies the language of the output text.
+ /// The target language must be one of the supported languages included in the dictionary scope.
+ ///
+ /// The content to send as the body of the request. Details of the request body schema are in the Remarks section below.
+ /// A client-generated GUID to uniquely identify the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// , or is null.
+ /// Service returned a non-success status code.
+ /// The response returned from the service. Details of the response body schema are in the Remarks section below.
+ internal virtual Response LookupDictionaryExamples(string @from, string to, RequestContent content, string clientTraceId = null, RequestContext context = null)
+ {
+ Argument.AssertNotNull(@from, nameof(@from));
+ Argument.AssertNotNull(to, nameof(to));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("TextTranslationClient.LookupDictionaryExamples");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateLookupDictionaryExamplesRequest(@from, to, content, clientTraceId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ }
+}
diff --git a/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationClientBuilderExtensions.cs b/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationClientBuilderExtensions.cs
new file mode 100644
index 0000000000000..dd3cb0d90b2b0
--- /dev/null
+++ b/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationClientBuilderExtensions.cs
@@ -0,0 +1,89 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using System;
+using System.Collections.Generic;
+using System.Net;
+using System.Text;
+using Azure;
+using Azure.AI.Translation.Text;
+using Azure.Core;
+using Azure.Core.Extensions;
+
+//TODO: there is no way to only suppress a single memmber of a static class so we need to have everything custom here.
+[assembly: CodeGenSuppressType("TextTranslationClientBuilderExtensions")]
+
+namespace Azure.AI.Translation.Text.Custom
+{
+ /// Extension methods to add to client builder.
+ public static partial class TextTranslationClientBuilderExtensions
+ {
+ /// Registers a instance.
+ /// The builder to register with.
+ /// Azure Credentials
+ public static IAzureClientBuilder AddTextTranslationClient(this TBuilder builder, AzureKeyCredential credential)
+ where TBuilder : IAzureClientFactoryBuilder
+ {
+ return builder.RegisterClientFactory