Available SDKs

GroupDocs offers software development kits (SDKs) for popular programming languages that make interaction with GroupDocs.Translation cloud services much easier. It allows you to focus on business logic rather than the technical details.

SDKs handle all the routine operations such as establishing connections, sending API requests, and parsing responses, wrapping all these tasks into a few simple methods. The following programming languages are supported:

All SDKs are open-source distributed under MIT License. You can freely use them for any projects, including commercial and proprietary applications, as well as modify any part of the code.

The provided code is fully tested and ready to run out of the box.

SDK usage examples

See the examples below for a quick overview of how SDKs can make your development easier.

Translating the text

using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using GroupDocs.Translation.Cloud.Sdk.Api;
using GroupDocs.Translation.Cloud.Sdk.Client;
using GroupDocs.Translation.Cloud.Sdk.Client.Auth;
using GroupDocs.Translation.Cloud.Sdk.Extensions;
using GroupDocs.Translation.Cloud.Sdk.Model;
using HttpStatusCode = System.Net.HttpStatusCode;

namespace GroupDocs.Translation.Cloud.Sdk
{
	public class TextTranslator
	{
		public TextTranslator()
		{
			Configuration config = new Configuration();
			/** Authorize your requests to GroupDocs.Translation Cloud */
			config.OAuthFlow = OAuthFlow.APPLICATION;
			config.OAuthClientId = "YOU_CLIENT_ID";
			config.OAuthClientSecret = "YOU_CLIENT_SECRET";
			/** Initialize GroupDocs.Translation API */
			config.BasePath = "https://api.groupdocs.cloud/v2.0/translation";
			TranslationApi apiInstance = new TranslationApi(config);
			/** Specify translation parameters */
			string translateFrom = new List<string>() { "Hello, world! I can read this text in my language." };
			string sourceLanguage = "en";
			var targetLanguages = new List<string>() { "de" };
			var request = new TextRequest(sourceLanguage, targetLanguages, translateFrom, origin: "demo");
			/** 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(statusResponse.Id);
					if(result.Status.ToSystemHttpStatusCode() == HttpStatusCode.OK)
					{
						Console.WriteLine(result.Translations[toLang].First());
						break;
					}
					Thread.Sleep(1000);
				}
			}
		}
	}
}

Visit our GitHub repository for a working code and sample files: https://github.com/groupdocs-translation-cloud/groupdocs-translation-cloud-dotnet