Skip to content

Commit

Permalink
[documenttranslation] Add default values for parameter in convenienve…
Browse files Browse the repository at this point in the history
… method
  • Loading branch information
nsalem95 committed Mar 3, 2021
1 parent 0052f64 commit 9f57aec
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public virtual async Task<DocumentTranslationOperation> StartTranslationAsync(Li
/// <param name="options"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public virtual DocumentTranslationOperation StartTranslation(Uri sourceUrl, Uri targetUrl, string targetLanguage, List<TranslationGlossary> glossaries, TranslationOperationOptions options, CancellationToken cancellationToken = default)
public virtual DocumentTranslationOperation StartTranslation(Uri sourceUrl, Uri targetUrl, string targetLanguage, List<TranslationGlossary> glossaries = default, TranslationOperationOptions options = default, CancellationToken cancellationToken = default)
{
var source = new SourceConfiguration(sourceUrl.AbsoluteUri)
{
Expand Down Expand Up @@ -207,7 +207,7 @@ public virtual DocumentTranslationOperation StartTranslation(Uri sourceUrl, Uri
/// <param name="options"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public virtual async Task<DocumentTranslationOperation> StartTranslationAsync(Uri sourceUrl, Uri targetUrl, string targetLanguage, List<TranslationGlossary> glossaries, TranslationOperationOptions options, CancellationToken cancellationToken = default)
public virtual async Task<DocumentTranslationOperation> StartTranslationAsync(Uri sourceUrl, Uri targetUrl, string targetLanguage, List<TranslationGlossary> glossaries = default, TranslationOperationOptions options = default, CancellationToken cancellationToken = default)
{
var source = new SourceConfiguration(sourceUrl.AbsoluteUri)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,7 @@ public void TranslateOperation()

var client = new DocumentTranslationClient(new Uri(endpoint), new AzureKeyCredential(apiKey));

var glossaries = new List<TranslationGlossary>()
{
new TranslationGlossary(glossaryUrl)
};

var options = new TranslationOperationOptions
{
StorageType = StorageType.Folder
};

DocumentTranslationOperation operation = client.StartTranslation(sourceUrl, targetUrl, "it", glossaries, options);
DocumentTranslationOperation operation = client.StartTranslation(sourceUrl, targetUrl, "it");

TimeSpan pollingInterval = new TimeSpan(1000);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,7 @@ public async Task TranslateOperationAsync()

var client = new DocumentTranslationClient(new Uri(endpoint), new AzureKeyCredential(apiKey));

var glossaries = new List<TranslationGlossary>()
{
new TranslationGlossary(glossaryUrl)
};

var options = new TranslationOperationOptions
{
StorageType = StorageType.Folder
};

DocumentTranslationOperation operation = client.StartTranslation(sourceUrl, targetUrl, "it", glossaries, options);
DocumentTranslationOperation operation = client.StartTranslation(sourceUrl, targetUrl, "it");

Response<AsyncPageable<DocumentStatusDetail>> operationResult = await operation.WaitForCompletionAsync();

Expand Down

0 comments on commit 9f57aec

Please sign in to comment.