Hi i’m trying to complete my app with your api, but when i send the text that i need to translate, my app goes in loop because the status of the request is 102.
Is there someone to help me? the code is this:
public async Task TextTranslator(string titolo, string source_lang, string target_lang)
{
string resultTraduzione = “”;
Configuration config = new Configuration();
/** Authorize your requests to GroupDocs.Translation Cloud /
config.OAuthFlow = OAuthFlow.APPLICATION;
config.OAuthClientId = “XXXXXXXXXXXXXXXXXXXXX”;
config.OAuthClientSecret = “YYYYYYYYYYYYYYYYYYYY”;
/* Initialize GroupDocs.Translation API /
config.BasePath = “https://api.groupdocs.cloud/v2.0/translation
”;
TranslationApi apiInstance = new TranslationApi(config);
/* Specify translation parameters /
List translateFrom = new List() { “Hello, world! I can read this text in my language.” };
string sourceLanguage = “en”;
List targetLanguages = new List() { “de” };
var request = new TextRequest(
sourceLanguage: sourceLanguage,
targetLanguages: targetLanguages,
texts: translateFrom);
/* Send text to translation /
StatusResponse translationStatus = apiInstance.TextPost(request);
/* Wait for results from translation queue */
if (translationStatus.Status.ToSystemHttpStatusCode() == HttpStatusCode.Accepted)
{
while (true)
{
var result = apiInstance.TextRequestIdGet(translationStatus.Id);
if (result.Status.ToSystemHttpStatusCode() == HttpStatusCode.OK)
{
string ggg = result.Translations[target_lang].First();
break;
}
Thread.Sleep(1000);
}
}
return resultTraduzione;
}
This topic has been moved to the related forum: Status 102 - App goes in a loop - Free Support Forum - groupdocs.cloud