GroupDocs.Translation-Cloud
WARNING! Breaking changes! GroupDocs.Translation Cloud is a simple SDK used to add translation of Microsoft Word documents, Microsoft Excel workbooks, Microsoft PowerPoint presentations, Adobe PDF documents, Markdown files, OpeDocument files, ResX files, SRT files, text files and plain text to your app with merely a few lines of code. In detail, it's a set of SDKs for document and plain text translation in our Cloud. It supports translaton of .doc, .docx, .docm, .xls, .xlsx, .xlsm, .ppt, .pptx, .pptm, .pdf, .md, .odt, .ods, .odp, .csv, .tsv, .rtf, .txt, .resx, .srt files. Just pass a specific file or text to the GroupDocs.Translation Cloud API, and it will translate to one or several languages and save translated files in our Cloud or will return translated texts.
Install
| Product | Versions |
|---|---|
| .NET Standard |
README
GroupDocs.Translation.Cloud.Sdk.NET (.NET)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
This C# SDK is automatically generated by the OpenAPI Generator project:
- API version: 1.0
- SDK version: 1.0.0
- Build package: org.openapitools.codegen.languages.CSharpNetCoreClientCodegen
Frameworks supported
- .NET Core >=1.0
- .NET Framework >=4.6
- Mono/Xamarin >=vNext
Dependencies
- RestSharp - 106.13.0 or later
- Json.NET - 13.0.2 or later
- JsonSubTypes - 1.8.0 or later
- System.ComponentModel.Annotations - 5.0.0 or later
The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:
Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
Install-Package System.ComponentModel.Annotations
NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742. NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See RestSharp#1406.
Installation
Generate the DLL using your preferred tool (e.g. dotnet build)
Then include the DLL (under the bin folder) in the C# project, and use the namespaces:
using GroupDocs.Translation.Cloud.Sdk.NET.Api;
using GroupDocs.Translation.Cloud.Sdk.NET.Client;
using GroupDocs.Translation.Cloud.Sdk.NET.Model;
Usage
To use the API client with a HTTP proxy, setup a System.Net.WebProxy
Configuration c = new Configuration();
System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/");
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
c.Proxy = webProxy;
Getting Started
using System.Collections.Generic;
using System.Diagnostics;
using GroupDocs.Translation.Cloud.Sdk.NET.Api;
using GroupDocs.Translation.Cloud.Sdk.NET.Client;
using GroupDocs.Translation.Cloud.Sdk.NET.Model;
namespace Example
{
public class Example
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.groupdocs.cloud/v2.0/translation";
// Configure OAuth2 ClientId and ClientSecret: JWT
config.OAuthClientId = "YOU_CLIENT_ID";
config.OAuthClientSecret = "YOU_CLIENT_SECRET";
var apiInstance = new TransportApi(config);
var format = "Unknown"; // string | Input file format (default to Unknown)
var outFormat = "outFormat_example"; // string | output file format
var source = "\"en\""; // string | Language of original file (default to "en")
var targets = new List<string>(); // List<string> | List of target languages
var file = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | File as byte array
var url = "url_example"; // string | Link to file for translation (optional)
var masters = false; // bool? | If translate master slides (optional) (default to false)
var formatting = true; // bool? | If document's formatting should be preserved, default true (optional) (default to true)
var origin = "origin_example"; // string | for analysis only (optional)
var route = "route_example"; // string | endpoints route (optional)
var separator = "separator_example"; // string | Separator in files (optional)
var elements = new List<int>(); // List<int> | List of slides to translate (optional)
var shortCodeList = new List<List<string>>(); // List<List<string>> | Dictiory of short code names and parameters names to translate (optional)
var frontMatterList = new List<List<string>>(); // List<List<string>> | Dictionary where key is zero-based front matter index and value is list of lists of front matter paths (optional)
var savingMode = "Files"; // string | Toggle file saving mode for storage. Is Files by default. (optional)
try
{
// Translate any supported file
StatusResponse result = apiInstance.AllFormatsPost(format, outFormat, source, targets, file, url, masters, formatting, origin, route, separator, elements, shortCodeList, frontMatterList, savingMode);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling TransportApi.AllFormatsPost: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Documentation for API Endpoints
All URIs are relative to https://api.groupdocs.cloud/v2.0/translation
| Class | Method | HTTP request | Description |
|---|---|---|---|
| TransportApi | AllFormatsPost | POST /all-formats | Translate any supported file |
| TransportApi | AvailableLanguagesGet | GET /available-languages | Return list of available language pairs |
| TransportApi | CsvPost | POST /csv | Translate CSV and TSV files |
| TransportApi | DocumentPost | POST /document | Translate Microsoft Word documents, rtf, txt, odt |
| TransportApi | DocumentRequestIdGet | GET /document/{requestId} | Return document translation status. Also return URLs for downloading of translated document if translation was successful |
| TransportApi | HcGet | GET /hc | Health check for all services. |
| TransportApi | HtmlPost | POST /html | Translate HTML files |
| TransportApi | HugoGet | GET /hugo | Get hugo syntax structure from markdown file |
| TransportApi | HugoPost | POST /hugo | Run hugo syntax structure analyzing from markdown file |
| TransportApi | MarkdownPost | POST /markdown | Translate Markdown files |
| TransportApi | OcrFilePost | POST /ocr-file | Translate image or scanned pdf and return file |
| TransportApi | OcrTextPost | POST /ocr-text | Translate text on image or scanned pdf |
| TransportApi | PdfPost | POST /pdf | Translate pdf files |
| TransportApi | PresentationPost | POST /presentation | Translate Microsoft PowerPoint presentations, odp |
| TransportApi | ResourcesPost | POST /resources | Translate RESX files |
| TransportApi | SpreadsheetsPost | POST /spreadsheets | Translate Microsoft Excel workbooks, ods |
| TransportApi | TextPost | POST /text | Translate text |
| TransportApi | TextRequestIdGet | GET /text/{requestId} | Return text translation status. Also return translated text if translation was successful |
Documentation for Models
- Model.CloudFileResponse
- Model.CloudHugoResponse
- Model.CloudTextResponse
- Model.HealthCheckStatus
- Model.LanguagePairData
- Model.StatusResponse
- Model.TextRequest
- Model.UrlFileInfo
Documentation for Authorization
JWT
- Type: OAuth
- Flow: application
- Authorization URL:
- Scopes: N/A
Changes from Previous Version
Adoption Assessment
A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.