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;
}
@sebas66 your code is correct, the problem is on our side, that request is being in the queue for quite a long time. We’re already working on it, and return back with updates quite soon.
Thank you for your answer, I pause the development of my application and wait for your response to resume work.
Best Regards.
Sebastiano Sassano
Hi i’m trying to complete my app with your api, bu 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<string> translateFrom = new List<string>() { "Hello, world! I can read this text in my language." };
string sourceLanguage = "en";
List<string> targetLanguages = new List<string>() { "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;
}