<dependency>
<groupId>com.groupdocs</groupId>
<artifactId>groupdocs-translation-cloud</artifactId>
<version>24.3</version>
</dependency>
copied!  
compile(group: 'com.groupdocs', name: 'groupdocs-translation-cloud', version: '24.3')
copied!  
<dependency org="com.groupdocs" name="groupdocs-translation-cloud" rev="24.3">
 <artifact name="groupdocs-translation-cloud" ext="jar"/>
</dependency>
copied!  
libraryDependencies += "com.groupdocs" % "groupdocs-translation-cloud" % "24.3"
copied!  

Java SDK for Translating Cloud Documents

main-banner

GitHub license

Product Page | Docs | Demos | Swagger UI | Examples | Blog | Search | Free Support | Free Trial

GroupDocs.Translation Cloud is Cloud API to translate Word (including RTF and TXT files), Excel (including CSV / TSV files), PowerPoint, PDF, HTML, Markdown (including Markdown with Hugo syntax), OpenDocument, RESX, SRT files, images of JPG, PNG, SVG, BMP and GIF formats and scanned PDFs as well as plain text.

For convenience of our Java customers, we introduce a simple SDK that assists to add translation of all document and image file formats mmentions above 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 translation of .doc, .docx, .docm, .xls, .xlsx, .xlsm, .ppt, .pptx, .pptm, .pdf, .html, .md, .odt, .ods, .odp, .csv, .tsv, .rtf, .txt, .resx, .srt, .png, .jpg, .svg, .bmp and .gif files. Just pass a specific file or text to the GroupDocs.Translation Cloud API, and it will translate and save translated file in S3 or will return translated text.

It is easy to get started with GroupDocs.Translation Cloud and there is nothing to install. Create an account at GroupDocs Cloud and get your application information, then you are ready to use SDKs.

Cloud Document Translation Features

  • Translation of Microsoft Word®, Microsoft Excel®, and Microsoft PowerPoint® documents
  • 46 languages and 106 languages pairs support
  • Translation of tables, headers, footers, footnotes/endnotes, image captions in Word documents and ODT files
  • Translation of cells, charts, tables, pivot tables in Excel documents and ODS files
  • Translation of text frames, tables, headers, footers, charts, comments in PowerPoint presentations and ODP files
  • Translation of PDF files
  • Translation of Markdown files
  • Translation of Hugo syntax in Markdown files
  • Translation of plain text
  • Translation of .NET resources of RESX format
  • Translation of subtitles in SRT format
  • Translation of images and scanned PDFs getting plain text or PDF as a result
  • Translation of scanned tables getting Excel workbook as a result
  • Translation of handwritten text

Supported Translation Formats

You shoukd specify format of document to translate putting in the request’s body the appropriate enum value.

Additionally, user could obtain translated file in any other format available for conversion. Just specify output format of translated document by putting file extension in the request’s body:

  • doc, docx, odt, rtf — docx, rtf, html, odt, txt, md, pdf, tiff, svg, xps
  • xls, xlsx, ods, csv, tsv — xlsx, xlsb, html, pdf, xps, ods, md, docx, pptx, tiff
  • ppt, pptx, odp — pptx, pdf, tiff, html, xps, odp
  • pdf — docx, pptx, html, svg, xps
  • md — html, pdf, docx, tiff, xps
  • html — md, pdf, docx, tiff, xps

Please visit Supported Formats for details.

Supported Translation Languages

  • en-fr / fr-en — to translate from English to French or from French to English.
  • en-de / de-en — to translate from English to German or from German to English.
  • en-es / es-en — to translate from English to Spanish or from Spanish to English.
  • en-it / it-en — to translate from English to Italian or from Italian to English.
  • en-zh / zh-en — to translate from English to Chinese or from Chinese to English.
  • en-ru / ru-en — to translate from English to Russian or from Russian to English
  • en-ar / ar-en — to translate from English to Arabic or from Arabic to English
  • en-pt / pt-en — to translate from English to Portuguese or from Portuguese to English
  • en-pl / pl-en — to translate from English to Polish or from Polish to English
  • en-uk / uk-en — to translate from English to Ukrainian or from Ukrainian to English
  • en-vi / vi-en — to translate from English to Vietnamese or from Vietnamese to English
  • en-id / id-en — to translate from English to Indonesian or from Indonesian to English
  • en-hi / hi-en — to translate from English to Hindi or from Hindi to English
  • en-el / el-en — to translate from English to Greek or from Greek to English
  • en-nl / nl-en— to translate from English to Dutch or from Dutch to English
  • en-hu / hu-en — to translate from English to Hunngarian or from Hungarian to English
  • en-sv / sv-en — to translate from English to Swedish or from Swedish to English
  • en-tr / tr-en — to translate from English to Turkish or from Turkish to English
  • en-ja / ja-en — to translate from English to Japanese or from Japanese to English
  • en-ko / ko-en — to translate from English to Korean or from Korean to English
  • en-cs / cs-en — to translate from English to Czech or from Czech to English
  • en-fi / fi-en — to translate from English to Finnish or from Finnish to English
  • en-ga / ga-en — to translate from English to Irish or from Irish to English
  • en-fa / fa-en — to translate from English to Farsi or from Farsi to English
  • en-az / az-en — to translate from English to Azerbaijani or from Azerbaijani to English
  • en-he / he-en — to translate from English to Hebrew or from Hebrew to English
  • en-sk / sk-en — to translate from English to Slovak or from Slovak to English
  • en-th / th-en — to translate from English to Thai or from Thai to English
  • en-ro / ro-en — to translate from English to Romanian or from Romanian to English
  • en-ms / ms-en — to translate from English to Malay or from Malay to English
  • en-bg / bg-en — to translate from English to Bulgarian or from Bulgarian to English
  • en-be / be-en — to translate from English to Bengali or from Bengali to English
  • en-da / da-en — to translate from English to Danish or from Danish to English
  • en-lt / lt-en — to translate from English to Lithuanian or from Lithuanian to English
  • en-lv / lv-en — to translate from English to Latvian or from Latvian to English
  • en-no / no-en — to translate from English to Norwegian or from Norwegian to English
  • en-et / et-en — to translate from English to Estonian or from Estonian to English
  • en-hy / hy-en — to translate from English to Armenian or from Armenian to English
  • en-ca / ca-en — to translate from English to Catalan or from Catalan to English
  • en-hr / hr-en — to translate from English to Croatian or from Croatian to English
  • en-sr / sr-en — to translate from English to Serbian or from Serbian to English
  • en-af / af-en — to translate from English to Afrikaans or from Afrikaans to English
  • en-ur / ur-en — to translate from English to Urdu or from Urdu to English
  • en-tl / tl-en — to translate from English to Tagalog or from Tagalog to English
  • en-ka / ka-en — to translate from English to Georgian or from Georgian to English
  • fr-de / de-fr — to translate from French to German or from German to French
  • fr-it / it-fr — to translate from French to Italian or from Italian to French
  • fr-ar / ar-fr — to translate from French to Arabic or from Arabic to French
  • de-it / it-de — to translate from German to Italian or from Italian to German
  • de-pl / pl-de — to translate from German to Polish or from Polish to German
  • ar-es / es-ar — to translate from Arabic to Spanish or from Spaish to Arabic
  • ar-tr / tr-ar — to translate from Arabic to Turkish or from Turkish to Arabic

JSON Request Details

You can put the following information in the requests body to translate a document:

  • format — format of file for translation
  • outputFormat — format of translated file (e.g. pdf)
  • sourceLanguage — language of original document (e.g. en)
  • targetLanguages — languages of translation as list (e.g. [fr, de])
  • file — file to translate in form of array of bytes
  • url — link to file to translate, either file or url should be provided
  • originalFileName — original name of file to translate, if null or empty request id will be used
  • masters — if masters slides should be translated (only for presentations, pass true or false)
  • elements — slide pages to translate (only for presentations, pass empty list to translate whole presentation)
  • separator — delimiter for CSV files
  • ranges - dictionary of ranges in Excel workbook
  • shortcodedict — dictionary of short code syntax in Hugo to translate, where the key is zero based short code index, and value is a list of parameters names that require translation
  • frontmatterdict — dictionary of front matter syntax in Hugo to translate, where the key is zero based front matter index and value is list of paths to values that require translation, each path is also a list.

To translate plain text the following information should be put in the requests body:

  • sourceLanguage — language of original text (e.g. en)
  • targetLanguages — languages of translation as list (e.g. [fr, de])
  • texts — list of texts to translate (e.g. [hello world])
  • contains-markdown — true if text contains markdown syntax

How to use the SDK?

Our API is completely independent of your operating system, database system, or development language. You can use any language and platform that supports HTTP to interact with our API. However, manually writing client code can be difficult, error-prone, and time-consuming. Therefore, we have provided and support SDKs in many development languages to make it easier for your Cloud Apps to integrate with us.

Get API keys if you haven’t

Make a personal account on GroupDocs Cloud Dashboard and click Get Keys. These keys are useful for all GroupDocs Cloud products. If you have any trouble, look at this detailed manual. Once your keys are received, please follow this article to try GroupDocs.Translation Cloud or familiarize with Developer guide for further details.

Requirements

Building the API client library requires:

  1. Java 1.8+
  2. Maven (3.8.3+)/Gradle (7.2+)

Installation

To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project’s POM:

<dependency>
  <groupId>com.groupdocs</groupId>
  <artifactId>GroupDocs-translation-cloud</artifactId>
  <version>23.10</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project’s build file:

  repositories {
    mavenCentral()     // Needed if the 'GroupDocs-translation-cloud' jar has been published to maven central.
    mavenLocal()       // Needed if the 'GroupDocs-translation-cloud' jar has been published to the local maven repo.
  }

  dependencies {
     implementation "com.groupdocs:GroupDocs-translation-cloud:23.10"
  }

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/GroupDocs-translation-cloud-23.10.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:


// Import classes:
import com.groupdocs.ApiClient;
import com.groupdocs.ApiException;
import com.groupdocs.Configuration;
import com.groupdocs.auth.*;
import com.groupdocs.models.*;
import org.openapitools.client.api.TranslationApi;

public class Example {
    public static void main(String[] args) {
        String basePath = "https://api.groupdocs.cloud/v2.0/translation";
        String cliendId = "YOUR_CLIENT_ID";
        String clientSecret = "YOUR_CLIENT_SECRET";

        ApiClient defaultClient = new ApiClient(basePath, cliendId, clientSecret, null);


        TranslationApi apiInstance = new TranslationApi(defaultClient);
//        FileRequest fileRequest = new FileRequest(); // FileRequest | String in body of request, containing JSON with parameters for translation.

        TextRequest request = new TextRequest();
        request.setSourceLanguage("en");
        request.addTargetLanguagesItem("de");
        request.addTextsItem("Text to translate");

        try {
            CloudTextResponse cloudTextResponse = apiInstance.textRequestIdGet(apiInstance.textPost(request).getId());
            System.out.println(cloudTextResponse);
        } catch (ApiException e) {
            System.err.println("Exception when calling TranslationApi#autoPost");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
  }
}

Documentation for API Endpoints

All URIs are relative to https://api.groupdocs.cloud/v2.0/translation

ClassMethodHTTP requestDescription
TranslationApiautoPostPOST /autoTranslate any supported file
TranslationApicsvPostPOST /csvTranslate CSV and TSV files
TranslationApidocumentPostPOST /documentTranslate Microsoft Word documents, rtf, txt, odt
TranslationApidocumentRequestIdGetGET /document/{requestId}Return document translation status. Also return URLs for downloading of translated document if translation was successful
TranslationApidocumentTrialPostPOST /document/trialTrial translate Microsoft Word documents, rtf, txt, odt without conversation. Translate only first page or 1000 symbols.
TranslationApihcGetGET /hcHealth check for all services.
TranslationApihtmlPostPOST /htmlTranslate HTML files
TranslationApihugoGetGET /hugoGet hugo syntax structure from markdown file
TranslationApihugoPostPOST /hugoRun hugo syntax structure analyzing from markdown file
TranslationApiimageToFilePostPOST /image-to-fileTranslate image or scanned pdf and return file
TranslationApiimageToTextPostPOST /image-to-textTranslate text on image or scanned pdf
TranslationApilanguagesGetGET /languagesReturn list of available language pairs
TranslationApimarkdownPostPOST /markdownTranslate Markdown files
TranslationApipdfPostPOST /pdfTranslate pdf files
TranslationApipdfTrialPostPOST /pdf/trialTrial pdf translation. Translate only first page without conversion to another format.
TranslationApipresentationPostPOST /presentationTranslate Microsoft PowerPoint presentations, odp
TranslationApiresxPostPOST /resxTranslate RESX files
TranslationApispreadsheetPostPOST /spreadsheetTranslate Microsoft Excel workbooks, ods
TranslationApitextPostPOST /textTranslate text
TranslationApitextRequestIdGetGET /text/{requestId}Return text translation status. Also return translated text if translation was successful
TranslationApitextTrialPostPOST /text/trialTrial translate text. Translate only 1000 symbols.

Documentation for Models

.NETJavaPythonAndroid
GitHubGitHubGitHubGitHub
NuGetMavenPIPMaven

Product Page | Docs | Demos | Swagger UI | Examples | Blog | Search | Free Support | Free Trial

VersionRelease Date
24.3March 22, 2024
24.1January 31, 2024
23.10December 11, 2023
23.1January 26, 2023
22.8September 1, 2022
22.5May 24, 2022
22.4April 27, 2022
22.2March 1, 2022
20.8.0January 25, 2022
20.12.0December 22, 2020
20.10.0November 4, 2020

GroupDocs Java REST API Maven SDK Java SDK Cloud REST REST API Cloud API MIT JWT oauth GroupDocs.Total Cloud GroupDocs.Translation Cloud JAR document automation document automation cloud document DOC DOCX DOCM RTF ODT XLS XLSX XLSM CSV TSV ODS PPT PPTX PPTM ODP PDF MD Markdown translate translator multi lingual language language pair translation pair JSON paragraph header footer footnote endnote image caption table pivot cells charts master slide notes comments frames convert conversion converter French English German Deutsch Chinese Spanish Italian Russian Arabic Portuguese Polish Ukrainian Vietnamese Indonesian Hindi Greek Dutch Hungarian Swedish Turkish Japanese Korean Czech Finnish Irish Slovak Farsi Persian Hebrew Azerbaijani Thai Romanian Malay Bulgarian English to French French to English English to German German to English English to Deutsch Deutsch to English English to Chinese Chinese to English English to Spanish Spanish to English English to Italian Italian to English English to Russian Russian to English English to Arabic Arabic to English English to Portuguese Portuguese to English English to Polish Polish to English English to Ukrainian Ukrainian to English English to Vietnamese Vietnamese to English English to Indonesian Indonesian to English English to Hindi Hindi to English English to Greek Greek to English English to Dutch Dutch to English English to Hungarian Hungarian to English English to Swedish Swedish to English English to Turkish Turkish to English English to Japanese Japanese to English English to Korean Korean to English English to Czech Czech to English English to Finnish Finnish to English English to Irish Irish to English English to Slovak Slovak to English English to Farsi Farsi to English English to Persian Persian to English English to Hebrew Hebrew to English English to Azerbaijani Azerbaijani to English English to Thai Thai to English English to Romanian Romanian to English English to Malay Malay to English English to Bulgarian Bulgarian to English French to German German to French French to Deutsch Deutsch to French French to Italian Italian to French French to Arabic Arabic to French