Hi!
I got an exception (“Error calling GetTranslateDocument: StatusCode=500 (InternalServerError); One or more errors occurred.”), when I ran following fragment:
string BasePath = "https://api.aspose.cloud/v1.1";
string name = "test.html";
string outPath = @"c:\tmp\";
string outFile = Path.Combine(outPath, $"{Path.GetFileNameWithoutExtension(name)}_EnglishRu.html.zip");
const string srcLang = "en"; // String | Source language.
const string resLang = "ru"; // String | Result language.
string folder = null; // root folder
string storage = null; // default storage
try
{
ITranslationApi transApi = new TranslationApi(AppKey, AppSid, BasePath);
var response = transApi.GetTranslateDocument(name, srcLang, resLang, storage, folder);
if (response is FileStream)
{
if (!Directory.Exists(outPath)) Directory.CreateDirectory(outPath);
using (Stream fstr = new FileStream(outFile, FileMode.Create, FileAccess.Write))
{
response.CopyTo(fstr);
fstr.Flush();
Console.Out.WriteLine($"Result file copied to: {outFile}");
}
}
}
catch (Exception ex)
{
Console.Out.WriteLine($"Error: {ex.Message}");
}