Les traductions sont fournies par des outils de traduction automatique. En cas de conflit entre le contenu d'une traduction et celui de la version originale en anglais, la version anglaise prévaudra.
Utilisation DescribeTextTranslationJob
avec un AWS SDK ou une CLI
Les exemples de code suivants montrent comment utiliserDescribeTextTranslationJob
.
Les exemples d’actions sont des extraits de code de programmes de plus grande envergure et doivent être exécutés en contexte. Vous pouvez voir cette action en contexte dans l’exemple de code suivant :
- .NET
-
- AWS SDK for .NET
-
using System;
using System.Threading.Tasks;
using Amazon.Translate;
using Amazon.Translate.Model;
/// <summary>
/// The following example shows how to retrieve the details of
/// a text translation job using Amazon Translate.
/// </summary>
public class DescribeTextTranslation
{
public static async Task Main()
{
var client = new AmazonTranslateClient();
// The Job Id is generated when the text translation job is started
// with a call to the StartTextTranslationJob method.
var jobId = "1234567890abcdef01234567890abcde";
var request = new DescribeTextTranslationJobRequest
{
JobId = jobId,
};
var jobProperties = await DescribeTranslationJobAsync(client, request);
DisplayTranslationJobDetails(jobProperties);
}
/// <summary>
/// Retrieve information about an Amazon Translate text translation job.
/// </summary>
/// <param name="client">The initialized Amazon Translate client object.</param>
/// <param name="request">The DescribeTextTranslationJobRequest object.</param>
/// <returns>The TextTranslationJobProperties object containing
/// information about the text translation job..</returns>
public static async Task<TextTranslationJobProperties> DescribeTranslationJobAsync(
AmazonTranslateClient client,
DescribeTextTranslationJobRequest request)
{
var response = await client.DescribeTextTranslationJobAsync(request);
if (response.HttpStatusCode == System.Net.HttpStatusCode.OK)
{
return response.TextTranslationJobProperties;
}
else
{
return null;
}
}
/// <summary>
/// Displays the properties of the text translation job.
/// </summary>
/// <param name="jobProperties">The properties of the text translation
/// job returned by the call to DescribeTextTranslationJobAsync.</param>
public static void DisplayTranslationJobDetails(TextTranslationJobProperties jobProperties)
{
if (jobProperties is null)
{
Console.WriteLine("No text translation job properties found.");
return;
}
// Display the details of the text translation job.
Console.WriteLine($"{jobProperties.JobId}: {jobProperties.JobName}");
}
}
- SAP ABAP
-
- Kit SDK pour SAP ABAP
-
"Gets the properties associated with an asynchronous batch translation job."
"Includes properties such as name, ID, status, source and target languages, and input/output Amazon Simple Storage Service (Amazon S3) buckets."
TRY.
oo_result = lo_xl8->describetexttranslationjob( "oo_result is returned for testing purposes."
EXPORTING
iv_jobid = iv_jobid
).
MESSAGE 'Job description retrieved.' TYPE 'I'.
CATCH /aws1/cx_xl8internalserverex .
MESSAGE 'An internal server error occurred. Retry your request.' TYPE 'E'.
CATCH /aws1/cx_xl8resourcenotfoundex .
MESSAGE 'The resource you are looking for has not been found.' TYPE 'E'.
CATCH /aws1/cx_xl8toomanyrequestsex.
MESSAGE 'You have made too many requests within a short period of time.' TYPE 'E'.
ENDTRY.
Pour obtenir la liste complète des guides de développement du AWS SDK et des exemples de code, consultezUtilisation de ce service avec un AWS SDK. Cette rubrique comprend également des informations sur le démarrage et sur les versions précédentes de SDK.