Translate java что это

Яндекс-Перевод в терминале через Java

Используя API переводчика написал для себя простую программу для перевода слов и фраз, и чтобы из любого места работало. Хотел использовать curl, но непонятно почему получал ошибку что такого языка нет.

Теперь вместо скучного, а иногда медленного, а иногда такого ярко-белого нового таба с лишней информацией пишу в терминале trans hello и получаю перевод на русский, а если trans привет — на английский. Разумеется можно вводить и фразы, в кавычках. Работает быстренько.

И сделать его исполняемым: sudo chmod +x trans.sh

Если вы вместо перевода начнете получать сообщение о том что ключ кончился, или мало-ли-что — тут можно получить новый кей — вставьте его куда надо в Java-коде, после чего откомпилируйте (javac YandexTranslate.java) и скопируйте с заменой на /usr/bin.

Также пользователи Firefox могут воспользоваться моим экстеншеном-переводчиком — он интегрирован в контекстное меню, быстрый-минималистичный и не оказывает влияния на DOM, после установки сразу работает и не требует рестарта браузера. На данный момент единственный Яндекс-переводчик для текущих версий Firefox.

UPD: Такие штуки лучше делать сразу на баше, но сразу у меня не получилось, но после того как bockra показал свой скрипт, я его дописал — чтобы не надо было указывать направление перевода, и можно без ковычек писать сразу несколько слов. Так и не смог добиться перевода нескольких слов с амперсантом, но и халера с ним.

Источник

Translate java что это

Google Cloud Translation Client for Java

Java idiomatic client for Cloud Translation.

Translate java что это. google cloud translate. Translate java что это фото. Translate java что это-google cloud translate. картинка Translate java что это. картинка google cloud translate

If you are using Maven with BOM, add this to your pom.xml file

If you are using Maven without BOM, add this to your dependencies:

If you are using Gradle 5.x or later, add this to your dependencies

If you are using Gradle without BOM, add this to your dependencies

If you are using SBT, add this to your dependencies

See the Authentication section in the base directory’s README.

The client application making API calls must be granted authorization scopes required for the desired Cloud Translation APIs, and the authenticated principal must have the IAM role(s) required to access GCP resources using the Cloud Translation API calls.

Installation and setup

You’ll need to obtain the google-cloud-translate library. See the Quickstart section to add google-cloud-translate as a dependency in your code.

About Cloud Translation

Cloud Translation can dynamically translate text between thousands of language pairs. Translation lets websites and programs programmatically integrate with the translation service.

See the Cloud Translation client library docs to learn how to use this Cloud Translation Client Library.

TranslateExample is a simple command line interface that provides some of Google Translation’s functionality.

Creating an authorized service object

To make authenticated requests to Google Translation, you must create a service object with credentials or use an API key. The simplest way to authenticate is to use Application Default Credentials. These credentials are automatically inferred from your environment, so you only need the following code to create your service object:

You can also explicitly set the API key as follows:

With Google Translation you can detect the language of some text. The service will provide you with the code of the detected language and a level of confidence.

Add the following import at the top of your file:

Then pick a text sample:

Then add the following code to detect the text’s language:

Google translation allows you to translate some text. When translating one or more texts you can either provide the source language or let the service detect it for you.

Add the following imports at the top of your file:

Then add the following code to translate the text, specifying the previously detected language ( detectedLanguage ) as its source language and English as the target language (providing the source language is optional, if it is not specified the service will try to detect it automatically):

Complete source code

In DetectLanguageAndTranslate.java we put together all the code shown above into one program. The program assumes that either Application Default Credentials or a valid API key are available.

Samples are in the samples/ directory.

SampleSource CodeTry it
Batch Translate Textsource codeTranslate java что это. open btn. Translate java что это фото. Translate java что это-open btn. картинка Translate java что это. картинка open btn
Batch Translate Text With Glossarysource codeTranslate java что это. open btn. Translate java что это фото. Translate java что это-open btn. картинка Translate java что это. картинка open btn
Batch Translate Text With Glossary And Modelsource codeTranslate java что это. open btn. Translate java что это фото. Translate java что это-open btn. картинка Translate java что это. картинка open btn
Batch Translate Text With Modelsource codeTranslate java что это. open btn. Translate java что это фото. Translate java что это-open btn. картинка Translate java что это. картинка open btn
Create Glossarysource codeTranslate java что это. open btn. Translate java что это фото. Translate java что это-open btn. картинка Translate java что это. картинка open btn
Delete Glossarysource codeTranslate java что это. open btn. Translate java что это фото. Translate java что это-open btn. картинка Translate java что это. картинка open btn
Detect Languagesource codeTranslate java что это. open btn. Translate java что это фото. Translate java что это-open btn. картинка Translate java что это. картинка open btn
Get Glossarysource codeTranslate java что это. open btn. Translate java что это фото. Translate java что это-open btn. картинка Translate java что это. картинка open btn
Get Supported Languagessource codeTranslate java что это. open btn. Translate java что это фото. Translate java что это-open btn. картинка Translate java что это. картинка open btn
Get Supported Languages For Targetsource codeTranslate java что это. open btn. Translate java что это фото. Translate java что это-open btn. картинка Translate java что это. картинка open btn
List Glossariessource codeTranslate java что это. open btn. Translate java что это фото. Translate java что это-open btn. картинка Translate java что это. картинка open btn
Quickstart Samplesource codeTranslate java что это. open btn. Translate java что это фото. Translate java что это-open btn. картинка Translate java что это. картинка open btn
Translate Textsource codeTranslate java что это. open btn. Translate java что это фото. Translate java что это-open btn. картинка Translate java что это. картинка open btn
Translate Text With Glossarysource codeTranslate java что это. open btn. Translate java что это фото. Translate java что это-open btn. картинка Translate java что это. картинка open btn
Translate Text With Glossary And Modelsource codeTranslate java что это. open btn. Translate java что это фото. Translate java что это-open btn. картинка Translate java что это. картинка open btn
Translate Text With Modelsource codeTranslate java что это. open btn. Translate java что это фото. Translate java что это-open btn. картинка Translate java что это. картинка open btn
Batch Translate Documentsource codeTranslate java что это. open btn. Translate java что это фото. Translate java что это-open btn. картинка Translate java что это. картинка open btn
Translate Documentsource codeTranslate java что это. open btn. Translate java что это фото. Translate java что это-open btn. картинка Translate java что это. картинка open btn

To get help, follow the instructions in the shared Troubleshooting document.

Cloud Translation uses both gRPC and HTTP/JSON for the transport layer.

Supported Java Versions

Java 8 or above is required for using this client.

Google’s Java client libraries, Google Cloud Client Libraries and Google Cloud API Libraries, follow the Oracle Java SE support roadmap (see the Oracle Java SE Product Releases section).

For new development

In general, new feature development occurs with support for the lowest Java LTS version covered by Oracle’s Premier Support (which typically lasts 5 years from initial General Availability). If the minimum required JVM for a given library is changed, it is accompanied by a semver major release.

Java 11 and (in September 2021) Java 17 are the best choices for new development.

Keeping production systems current

Google tests its client libraries with all current LTS versions covered by Oracle’s Extended Support (which typically lasts 8 years from initial General Availability).

Google’s client libraries support legacy versions of Java runtimes with long term stable libraries that don’t receive feature updates on a best efforts basis as it may not be possible to backport all patches.

Google provides updates on a best efforts basis to apps that continue to use Java 7, though apps might need to upgrade to current versions of the library that supports their JVM.

Where to find specific information

The latest versions and the supported Java versions are identified on the individual GitHub repository github.com/GoogleAPIs/java-SERVICENAME and on google-cloud-java.

Contributions to this library are always welcome and highly encouraged.

See CONTRIBUTING for more information how to get started.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See Code of Conduct for more information.

Java VersionStatus
Java 8Translate java что это. java8. Translate java что это фото. Translate java что это-java8. картинка Translate java что это. картинка java8
Java 8 OSXTranslate java что это. java8. Translate java что это фото. Translate java что это-java8. картинка Translate java что это. картинка java8
Java 8 WindowsTranslate java что это. java8 win. Translate java что это фото. Translate java что это-java8 win. картинка Translate java что это. картинка java8 win
Java 11Translate java что это. java11. Translate java что это фото. Translate java что это-java11. картинка Translate java что это. картинка java11

Java is a registered trademark of Oracle and/or its affiliates.

Источник

How to use Google Translate API in Java

Last Updated on September 14, 2020 by James Brannan Leave a Comment

Introduction

In this tutorial, we use the Google Translate API (version two) on RapidAPI using a Java command-line client. We program the client as a Spring Boot application and use three different Java REST libraries – the Eclipse Jersey implementation of the Java API for RESTful Web Services (JAX-RS), the Unirest-Java library, and the OkHttp library. Each library calls all three Google Translate endpoints – languages, detect, and translate. By the end of the tutorial, you will know how to use Java to get Google translate’s supported languages, identify a text’s language, and translate between two languages. But along the way, we will also model the application using the Unified Modeling Language (UML), use the Jackson library to serialize/deserialize JSON, and learn how to write a Spring Boot application as a console program rather than a web application.

RapidAPI

RapidAPI is an online repository of different REST APIs from many different sources. It provides a single location for the discovery and management of various REST APIs and provides a single source of registration and billing. RapidAPI started as a GitHub repository and has grown to over 10,000 APIs. RapidAPI does not host these APIs, but rather, provides a single location you can develop, manage, and access those disparate APIs. As more companies monetize their RESTful APIs, trying to discover those APIs and manage them becomes increasingly unwieldy. As a developer who works daily with REST APIs, and as a tutorial author for RapidAPI by night, I can personally attest that RapidAPI truly does offer a valuable service for developers needing to incorporate RESTful APIs into his or her application. See the following article on DZone for more arguments for RapidAPI (RapidAPI Provides API MarketPlace and Insight).

We do not discuss getting set up on RapidAPI here; however, here are some links to references needed to get started. Before continuing this tutorial, you should register for a RapidAPI account if you have not already.

Google Translate V2

Google’s Translate API is available on RapidAPI. The version on RapidAPI, as of the time of this tutorial, is version two. To use the API you must subscribe to it first, but don’t worry, the basic subscription is free. After subscribing, you should see the Test Endpoints button replace the Subscribe to Test button.

Translate java что это. lazy placeholder. Translate java что это фото. Translate java что это-lazy placeholder. картинка Translate java что это. картинка lazy placeholderAbout Google Translate API.

Endpoints

There are three exposed endpoints as of version two of the Google Translate API. The languages endpoint returns a list of languages supported by Google Translate, the detect endpoint detects the language of the specified text, and the translate endpoint translates text to a specified language. Let’s examine these three endpoints in more detail.

Languages

The languages endpoint returns a list of supported languages. It accepts a GET request that has two optional query string parameters, target and model. The endpoint returns a list of all supported languages, where the language value is the language code, and the name is the language’s name that was specified by the target query string parameter. If no target query string parameter is specified, then the name is omitted. The language’s code is the ISO 639-1 code (List of ISO 639-1 Codes). The target parameter’s value also uses a language’s ISO code. If the target language code is excluded, then the language names are omitted.

Let’s review the language endpoint by calling it and asking the results be returned in Chinese (Simplified). The request returns a list of language codes and names, as we specify the target language. After getting a list that includes names, we then exclude the target language from our request and obtain a list of language codes.

Detect Language

The detect endpoint takes a POST request with the text to analyze as a form field and returns the language it detects. Let’s use Chinese again, only this time as the language to detect.

RapidAPI Test Endpoint

Translate

The last endpoint to review is translate. The translate endpoint accepts a POST request and sends the text to translate as a form field. There are four form fields accepted by this endpoint:

RapidAPI Test Endpoint

Java Implementation: How do you use Google Translate API in your Java Application?

Now that we understand the three endpoints, we can write client Java code to call them. As mentioned in the introduction, here we use Spring Boot to develop our client application. There was no particular reason for my selecting Spring Boot, other than it is an easy way to free us from worrying about things such as project structure, creating a Maven pom file, and other tedious aspects involved in writing a non-trivial Java application. Because of this benefit of Spring Boot, we use it to develop a command-line application that runs directly in the JVM from the console and not in a web container. If you have never used Spring Boot to develop a console application, you will be surprised at how easy it is.

Modeling the Application

Call me crazy – or bitter that all my training in the Rational Unified Process seems for naught in an Agile world – but I always design an application before developing it, even if it is a tractable tutorial application. I don’t get the design perfect, but that’s okay, as all I need is something that helps guide my development. And so, let’s design the application before beginning to code, keeping in mind our agile intentions behind modeling.

Our modeling efforts consist of writing a use-case diagram, a class diagram, and an object model diagram. The notation we use is UML, and we use the online tool, yUML, to create our diagrams. Again, our goal is not a complete formalized representation of the system we will develop, but rather, an informal model using UML that serves as a “hand-written map” providing us directions to our destination.

Let’s begin by considering the interactions between a user and the application we will develop by creating a use-case model. The use-case model will help us see the interactions and their relationships more clearly.

Use Case Model

A use-case model illustrates how users will interact with a proposed system. It is useful for determining the requirements, or functionality, your system must perform. Let’s create a use-case model depicting the interactions users perform when interacting with our application. Of course, our application is a wrapper around the Google Translate API, so it might be more proper to state that we are creating a use-case diagram of a user’s interactions with the Google Translate API. But whatever we call our modeling subject, let’s model it.

Start by adding the user to the diagram. Of course, our application’s user is us, the developers, as we will be executing the application after developing it. And so we label the user as Developer. Our topmost interaction with our application is calling the Google Translate API. When we interact with the API, we call it using either the JAX-RS library, the Unirest-Java, or OkHttp library. As each sub-interaction is optional, we model these as extending the Call Google Translate interaction. But every call to Google Translate via RapidAPI, must include the RapidAPI required headers. As the getting RapidAPI headers interaction is required, we model this sub-interaction as being included by the Call Google Translate interaction.

Translate java что это. lazy placeholder. Translate java что это фото. Translate java что это-lazy placeholder. картинка Translate java что это. картинка lazy placeholder

When we interact with Google Translate using one of the three REST client libraries, we call all three REST endpoints. And so we model the languages, detect, and translate sub-interactions as included by the three REST library interactions. Now, we could have modeled each call as extending the REST library interaction. However, let’s assume that calling a REST library requires calling all three endpoints sequentially, and so we model them as being included. The following simple UML activity diagram illustrates our decision.

Translate java что это. lazy placeholder. Translate java что это фото. Translate java что это-lazy placeholder. картинка Translate java что это. картинка lazy placeholder Activity diagram illustrating our design decision to call all three endpoints sequentially.

As our workflow illustrates, we conditionally call one of the three libraries to access the Google Translate API. We then use the selected library to call the languages, detect, and translate endpoints, respectively.

The use-case model provides a pretty good example of the user requirements our system must meet by having identified the user interactions with our proposed application. We can now create the following outline.

The outline furthers our understanding by providing a list of the functionality we must provide when we develop our application. Okay, now that we have a good understanding of the user interactions let’s focus on our application’s class design.

Application Class Diagram

A class diagram describes a system’s structure by illustrating its classes, their relationships, and their internal properties and methods. The diagram is especially useful when we first start coding our application, as we can create a bare-bones skeleton of our application derived from this model which we will then add functionality (functionality derived from the use-case model).

Note that the decision to create an abstract class extended by three concrete classes is a design decision; the decision is not the “correct” way to design our application. There are also good arguments for TutorialRestClient being an interface; however, let’s keep our design decision and make TutorialRestClient an abstract class.

Data Object Model

The REST endpoints return JSON resources from each of the three endpoints. When writing a Java application, it usually makes sense to convert these JSON string representations of a resource to a corresponding plain old Java object (POJO). One technique we can use to model these JSON resources as POJOs is by creating an Object Diagram that models the data objects an application will use as classes.

Return to the RapidAPI page and review the JSON returned from the three endpoints. Notice that all three endpoints wrap their particular JSON response with an opening and closing brace, thus defining an anonymous resource.

Translate java что это. lazy placeholder. Translate java что это фото. Translate java что это-lazy placeholder. картинка Translate java что это. картинка lazy placeholderName the top-level resource GoogleTranslateObject.

After defining the top-level resource, we identify the nested resource. Notice that all three endpoints also wraps its particular JSON resource in a data resource. And so, we define a Data object to represent the data resource.

Translate java что это. lazy placeholder. Translate java что это фото. Translate java что это-lazy placeholder. картинка Translate java что это. картинка lazy placeholderAll three endpoints have a data resource.

Translate java что это. lazy placeholder. Translate java что это фото. Translate java что это-lazy placeholder. картинка Translate java что это. картинка lazy placeholderThe languages collection and anonymous resources.

Translate java что это. lazy placeholder. Translate java что это фото. Translate java что это-lazy placeholder. картинка Translate java что это. картинка lazy placeholderData contains a nested collection named detections.

The translate endpoint’s collection is named translations and contains anonymous resources that we call a Translation object.

Translate java что это. lazy placeholder. Translate java что это фото. Translate java что это-lazy placeholder. картинка Translate java что это. картинка lazy placeholderThe translations collection and anonymous resources.

We now determine the relationship between the resources. All three endpoints nest a data resource in the top-level anonymous resource; a GoogleTranslateObject is a collection of Data objects. Each endpoint contains a collection of its particular resource, and so we model each of the collections as an aggregation of the specific resource identified above. Note that there is an intermediate collection for the Detection resource (a collection of a collection of detection resources). We also add the properties of each JSON resource by listing the property name in the object.

Translate java что это. lazy placeholder. Translate java что это фото. Translate java что это-lazy placeholder. картинка Translate java что это. картинка lazy placeholder JSON objects returned from endpoints.

We now translate the class diagram, combined with the object model and the outline from our use-case model, as our application’s skeleton; however, before we do, let’s return to Spring Boot and create our application’s foundation.

Project Setup

Navigate to the Spring Initializr web page and create our application. Through Spring Initializr, we define our classpath, add the project’s required dependencies, and set other settings needed by the application, such as if we will package the application as an executable Jar or as a War. Spring Initializr saves us considerable effort when creating our application by performing these tasks for us and providing a zip file containing our configured application.

Spring Initializr

Translate java что это. lazy placeholder. Translate java что это фото. Translate java что это-lazy placeholder. картинка Translate java что это. картинка lazy placeholder
Creating a project in Spring Initializr.

We now have the following pom file.

Spring Boot Application Class

Spring Boot Properties File

Now let’s modify the application.properties file to set our application’s properties. Adding these properties to the properties file allows us to use these values in our application without hard-coding them in our Java classes.

We now have the following application.properties file.

JSON Data Objects

Return to the model and let’s translate the object model we created earlier to create the needed data objects.

GoogleTranslateObject

We use the Jackson library to serialize and deserialize the data objects between JSON and POJOs. For Jackson to accomplish this task, it is essential to create the get

methods for every property present in the JSON resource.

Language

Now let’s create the Language data object.

Detection

The detection resource consists of a boolean value indicating if the detection is reliable, the detected language, and a confidence score. As an aside, it is my observation that Google Translate always guesses the language correctly, but invariably has little to no confidence in its translation ability (reliable is false, and the confidence score is low). Let’s finish the Detection class.

Translation

A Translation consists of the translated text and, if source language was not specified, the detected source language.

Component Classes

Now that we have the data objects coded let’s create the classes from our class diagram. Begin with the TutorialRestClient class.

TutorialRestClient Abstract Class

The TutorialRestClient class is abstract and declares three methods that call Google Translate’s three REST endpoints. The class also contains the shared headers and properties needed by the three child classes.

The class contains the three abstract methods we will override in the three child classes. The getSupportedLanguage and translate methods return a List aggregating the specific data objects, while the detectLanguage returns a nested list. TutorialRestClient also includes the properties we need using the Spring @Value annotation. Although this tutorial does not discuss Spring concepts in-depth, let’s pause to consider the @Value annotation.

@Value Annotation

JaxRsTutorialRestClientImpl Class

Before moving to individually developing the logic in each implementation class, let’s create all three classes and have the concrete methods overriding the abstract methods in TutorialRestClient return null values. We do this so so we don’t write a bunch of code all at once that doesn’t compile. Instead, we take baby-steps and make sure the application works each step of the way.

Let’s start with the JaxRsTutorialRestClientImpl class.

OkHttpTutorialRestClientImpl Class

UnirestTutorialRestClientImpl Class

Now that we have all three bare-bone classes let’s implement each class.

Endpoint Implementations

The first class we implement is the Eclipse Jersey implementation of the JAX-RS specification. We then code the class using the Unirest-Java library, followed by the class using the OkHttp library.

JAX-RS (JaxRsTutorialRestClientImpl)

As JAX-RS is the accepted standard with overwhelming industry support, we begin by implementing the endpoints in our JaxRsTutorialRestClientImpl class.

Languages (getSupportedLanguage)

Detect Language (detectLanguage)

Now let’s implement the detectLanguage method.

JAX-RS uses a Form object to represent an HTML form-data request. We add the text as a parameter to the Form instance and then use the Entity object to pass the form to the post request. When we post the form, we also specify that we expect the response to be a GoogleTranslateObject instance. We get the detections from the response and return the nested list of Detection instances.

Translate

Complete Class (JaxRsTutorialRestClientImpl)

The complete JaxRsTutorialRestClientImpl class follows.

TranslateClientApplication

Now we modify TranslateClientApplication to call our newly written class.

As you can see, developing a client using JAX-RS is straightforward. Moreover, it is the industry standard for working with RESTful web services when using Java. Because of this industry acceptance, JAX-RS is a safe bet when selecting a framework to write a REST client.

But there are situations when you might wish to use a different Java library. For instance, suppose you are writing an Android application. When using Android, a full-blown framework such as Eclipse Jersey, might prove overkill. In situations such as this, you might consider something lighter-weight such as Unirest-Java or OkHttp. And of course, as Unirest-Java and OkHttp are the two libraries used by RapidAPI as the Java examples on its website, let’s implement REST clients using these two libraries.

Unirest-Java (UnirestTutorialRestClientImpl)

Unirest-Java bills itself as a lightweight Http library for consuming RESTful APIs. Although smaller in size than a JAX-RS implementation, it remains a powerful library for writing REST clients.

Begin by adding the unirest-java and unirest-objectmapper-jackson libraries to the pom file.

Be careful when importing the classpath for Unirest-Java and OkHttp classes; be sure not to import a class from the wrong library.

The Unirest class is the entry point to the library. It is shared as a static class by all code in our class. We also statically add the JacksonObjectMapper and the default header to the class’s configuration. We can then use the configured Unirest class throughout the UnirestTutorialRestClientImpl class.

Languages (getSupportedLanguages)

The Unirest-Java API adds the headers, the get URL, the query string, and then executes the request in a single statement. Recall we set Jackson as the Unirest class’s ObjectMapper and so we can specify the response is a GoogleTranslateObject object instance. Unirest-Java then uses Jackson to translate the returned JSON string into the Java class. Note, had we preferred to set the headers all at once, we could have used a Map to pass the headers to the Unirest class.

Detect Language (detectLanguage)

Translate Language (translate)

Complete Class (UnirestTutorialRestClientImpl)

For convenience, the complete UnirestTutorialClientImpl class is included below.

TranslationClientApplication

You should obtain the following results printed to the console. Full disclosure, I executed the program within Eclipse. When using Microsoft Powershell, I could not get it to print the Chinese characters. You might have a similar problem running this from the command-line.

OkHttp (OkHttpTutorialRestClientImpl)

Let’s finish the tutorial by implementing the OkHttpTutorialRestClientImpl class using the OkHttp library.

As with the Unirest-Java library, we must first add the library to our application’s pom file.

Languages (getSupportedLanguages)

The OkHttpClient takes a Request instance, calls the newCall method to create a request and then executes that request using the execute method. It then uses the Jackson ObjectMapper instance to translate the response body to a GoogleTranslateObject instance and then obtains and returns the list of Language instances.

Detect Language (detectLanguage)

We start by creating an OkHttpClient instance and a RequestBody instance. We pass the inputString as a field to the RequestBody instance and then pass that to a Request instance. Finally, we call the OkHttpClient instance’s newCall method, passing the Request instance as a parameter. We then return the nested list of Detection instances.

Translate

Complete Class (OkHttpTutorialRestClientImpl)

The complete OkHttpTutorialRestClientImpl class follows.

TranslateClientApplication

Summary

In this tutorial, we used three different Java REST client libraries to call the three Google Translate REST endpoints. We first used the Eclipse Maven implementation of the JAX-RS standard. We then used the Unirest-Java and OkHttp lightweight REST client libraries. Before developing the application, we evaluated the Google Translate API’s REST endpoints and then modeled our application by creating a use-case diagram, class diagram, and object model diagram. We used the use-case diagram to create an outline of the tasks our application was to perform. We then used the models and outlines to develop our application. We implemented REST clients using JAX-RS, Unirest-Java, and OkHttp. Each client called all three of the Google Translate REST endpoints.

We covered a lot of material in this tutorial. Not only did we explore the three endpoints, we also explored how to write REST client, from analyzing the endpoints to modeling our application calling those endpoints, and then implementing the code. Hopefully you are convinced that preliminarily modeling even a simple REST client is not wasted effort. I truly believe it helps to understand immensely. You now have a better understanding of how to incorporate the Google Translate API on RapidAPI into your Java applications.

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *