@@ -106,7 +106,7 @@ public DocumentTranslationClient(Uri endpoint, AzureKeyCredential credential)
106106 /// <a href="https://docs.microsoft.com/azure/cognitive-services/translator/document-translation/overview"/>.
107107 /// </summary>
108108 /// <param name="configurations">Sets the configurations for the translation operation
109- /// including source and target storage for documents to be translated. </param>
109+ /// including source and target containers for documents to be translated. </param>
110110 /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
111111 /// <exception cref="RequestFailedException">Service returned a non-success status code. </exception>
112112 public virtual DocumentTranslationOperation StartTranslation ( IEnumerable < TranslationConfiguration > configurations , CancellationToken cancellationToken = default )
@@ -133,7 +133,7 @@ public virtual DocumentTranslationOperation StartTranslation(IEnumerable<Transla
133133 /// <a href="https://docs.microsoft.com/azure/cognitive-services/translator/document-translation/overview"/>.
134134 /// </summary>
135135 /// <param name="configurations">Sets the configurations for the translation operation
136- /// including source and target storage for documents to be translated. </param>
136+ /// including source and target containers for documents to be translated. </param>
137137 /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
138138 /// <exception cref="RequestFailedException">Service returned a non-success status code. </exception>
139139 public virtual async Task < DocumentTranslationOperation > StartTranslationAsync ( IEnumerable < TranslationConfiguration > configurations , CancellationToken cancellationToken = default )
@@ -155,49 +155,18 @@ public virtual async Task<DocumentTranslationOperation> StartTranslationAsync(IE
155155 }
156156
157157 /// <summary>
158- /// Starts a translation operation for documents in an Azure Blob Container .
158+ /// Starts a translation operation.
159159 /// For document length limits, maximum batch size, and supported document formats, see
160160 /// <a href="https://docs.microsoft.com/azure/cognitive-services/translator/document-translation/overview"/>.
161161 /// </summary>
162- /// <param name="sourceBlobContainerSas">The SAS URL for the source container containing documents to be translated. </param>
163- /// <param name="targetBlobContainerSas">The SAS URL for the target container to which the translated documents will be written. </param>
164- /// <param name="targetLanguageCode">Language code to translate documents to. For supported languages see
165- /// <a href="https://docs.microsoft.com/azure/cognitive-services/translator/language-support#translate"/>.</param>
166- /// <param name="glossary">Custom translation glossary to be used in the translation operation. For supported file types see
167- /// <see cref="GetGlossaryFormatsAsync(CancellationToken)"/>.</param>
168- /// <param name="options">Set translation options including source language and custom translation category.</param>
162+ /// <param name="configuration">Sets the configurations for the translation operation
163+ /// including source and target containers for documents to be translated. </param>
169164 /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
170- public virtual DocumentTranslationOperation StartTranslation ( Uri sourceBlobContainerSas , Uri targetBlobContainerSas , string targetLanguageCode , TranslationGlossary glossary = default , TranslationOperationOptions options = default , CancellationToken cancellationToken = default )
165+ /// <exception cref="RequestFailedException">Service returned a non-success status code. </exception>
166+ public virtual DocumentTranslationOperation StartTranslation ( TranslationConfiguration configuration , CancellationToken cancellationToken = default )
171167 {
172- var source = new TranslationSource ( sourceBlobContainerSas )
173- {
174- LanguageCode = options ? . SourceLanguage ,
175- Filter = options ? . Filter
176- } ;
177-
178- var target = new TranslationTarget ( targetBlobContainerSas , targetLanguageCode )
179- {
180- CategoryId = options ? . Category
181- } ;
182-
183- if ( glossary != null )
184- {
185- target . Glossaries . Add ( glossary ) ;
186- }
187-
188- var targets = new List < TranslationTarget >
189- {
190- target
191- } ;
192-
193- var request = new BatchSubmissionRequest ( new List < TranslationConfiguration >
194- {
195- new TranslationConfiguration ( source , targets )
196- {
197- StorageType = options ? . StorageType
198- }
199- }
200- ) ;
168+ Argument . AssertNotNull ( configuration , nameof ( configuration ) ) ;
169+ var request = new BatchSubmissionRequest ( new List < TranslationConfiguration > { configuration } ) ;
201170 using DiagnosticScope scope = _clientDiagnostics . CreateScope ( $ "{ nameof ( DocumentTranslationClient ) } .{ nameof ( StartTranslation ) } ") ;
202171 scope . Start ( ) ;
203172
@@ -214,50 +183,18 @@ public virtual DocumentTranslationOperation StartTranslation(Uri sourceBlobConta
214183 }
215184
216185 /// <summary>
217- /// Starts a translation operation for documents in an Azure Blob Container.
186+ /// Starts a translation operation
218187 /// For document length limits, maximum batch size, and supported document formats, see
219188 /// <a href="https://docs.microsoft.com/azure/cognitive-services/translator/document-translation/overview"/>.
220189 /// </summary>
221- /// <param name="sourceBlobContainerSas">The SAS URL for the source container containing documents to be translated. </param>
222- /// <param name="targetBlobContainerSas">The SAS URL for the target container to which the translated documents will be written. </param>
223- /// <param name="targetLanguageCode">Language code to translate documents to. For supported languages see
224- /// <a href="https://docs.microsoft.com/azure/cognitive-services/translator/language-support#translate"/>.</param>
225- /// <param name="glossary">Custom translation glossary to be used in the translation operation. For supported file types see
226- /// <see cref="GetGlossaryFormatsAsync(CancellationToken)"/>.</param>
227- /// <param name="options">Set translation options including source language and custom translation category.</param>
190+ /// <param name="configuration">Sets the configurations for the translation operation
191+ /// including source and target containers for documents to be translated. </param>
228192 /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
229- public virtual async Task < DocumentTranslationOperation > StartTranslationAsync ( Uri sourceBlobContainerSas , Uri targetBlobContainerSas , string targetLanguageCode , TranslationGlossary glossary = default , TranslationOperationOptions options = default , CancellationToken cancellationToken = default )
193+ /// <exception cref="RequestFailedException">Service returned a non-success status code. </exception>
194+ public virtual async Task < DocumentTranslationOperation > StartTranslationAsync ( TranslationConfiguration configuration , CancellationToken cancellationToken = default )
230195 {
231- var source = new TranslationSource ( sourceBlobContainerSas )
232- {
233- LanguageCode = options ? . SourceLanguage ,
234- Filter = options ? . Filter
235- } ;
236-
237- var target = new TranslationTarget ( targetBlobContainerSas , targetLanguageCode )
238- {
239- CategoryId = options ? . Category
240- } ;
241-
242- if ( glossary != null )
243- {
244- target . Glossaries . Add ( glossary ) ;
245- }
246-
247- var targets = new List < TranslationTarget >
248- {
249- target
250- } ;
251-
252- var request = new BatchSubmissionRequest ( new List < TranslationConfiguration >
253- {
254- new TranslationConfiguration ( source , targets )
255- {
256- StorageType = options ? . StorageType
257- }
258- }
259- ) ;
260-
196+ Argument . AssertNotNull ( configuration , nameof ( configuration ) ) ;
197+ var request = new BatchSubmissionRequest ( new List < TranslationConfiguration > { configuration } ) ;
261198 using DiagnosticScope scope = _clientDiagnostics . CreateScope ( $ "{ nameof ( DocumentTranslationClient ) } .{ nameof ( StartTranslationAsync ) } ") ;
262199 scope . Start ( ) ;
263200
0 commit comments