Προσθέστε λειτουργίες μετάφρασης σε εφαρμογές για συσκευές Android χρησιμοποιώντας το GroupDocs.Translation API. Μεταφέρετε τη μετάφραση σε οποιοδήποτε σύστημα – από netbook αρχικού επιπέδου έως smartphone.
Ξεκινήστε τη δωρεάν δοκιμήGroupDocs.Translation offers real-time machine translation for texts, documents, images and resources. Powerful machine learning algorithms and sophisticated neural networks provide a quality close to that of a professional human translator, but much faster and more cost-effective. Running on a high-performance cloud server hosted by GroupDocs, it can translate PDF, Microsoft Office and OpenOffice documents, Markdown files, and .NET resources into 46 European, Middle East and Asian languages (across 128 language pairs). The API not only translates text, but also accurately preserves metadata, structure, styles, and layout of documents.
This SDK greatly simplifies the interaction with GroupDocs.Translation Cloud services from Android apps, allowing you to focus on business logic rather than the technical details. It handles all the routine operations such as establishing connections, sending API requests, and parsing responses, wrapping all these tasks into a few simple methods. The translation is carried out by high-performance cloud servers. You can use the application on any system – from entry-level netbooks to smartphones.
The Android SDK, demo applications, documentation, and examples are open source distributed under the MIT license. You can use them for any purpose and change any part of the code.
Το GroupDocs.Translation Cloud SDK για Android συνοδεύεται από λεπτομερείς οδηγούς προγραμματιστών και ζωντανά παραδείγματα κώδικα για να ξεκινήσετε να εργάζεστε με τις λειτουργίες API σε ελάχιστο χρόνο. Απλώς δημιουργήστε έναν δωρεάν λογαριασμό στο GroupDocs Cloud, λάβετε πληροφορίες APP SID & Key για να επικοινωνήσετε με το GroupDocs Cloud API.
Το GroupDocs.Translation για το Cloud είναι ένα REST API που μπορεί εύκολα να ενσωματωθεί με οποιαδήποτε γλώσσα ή πλατφόρμα, ικανό να διαχειρίζεται αιτήματα και απαντήσεις HTTP. Υποστηρίζει όλες τις δημοφιλείς υπηρεσίες αποθήκευσης cloud, όπως το Google Cloud, το Drive, το DropBox και το Amazon S3 για αλληλεπίδραση χωρίς εξαρτήσεις.
package com.groupdocs;
// Import classes
import com.groupdocs.model.*;
import org.openapitools.client.api.TranslationApi;
public class TextDemo {
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 translationApi = new TranslationApi(defaultClient);
TextRequest request = new TextRequest();
request.setSourceLanguage("en");
request.addTargetLanguagesItem("de");
request.addTextsItem("Text to translate");
try {
String r = translationApi.textPost(request).getId();
CloudTextResponse response = translationApi.textRequestIdGet(r);
if (!response.getStatus().toString().equals("500")) {
while (true) {
response = translationApi.textRequestIdGet(r);
if (response.getStatus().toString().equals("200")) {
System.out.println(response);
break;
}
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
catch(ApiException e){
System.err.println("Exception when calling TranslationApi#textPost");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Το GroupDocs.Translation Cloud API είναι προστατευμένο με SSL και τα αιτήματα ελέγχου ταυτότητας απαιτούν υπογραφή και παραμέτρους ερωτήματος AppSID ή κεφαλίδα εξουσιοδότησης OAuth 2.0.