sharplab / deepl4j

DeepL API v2 client library for Java
Apache License 2.0
3 stars 0 forks source link
deepl java openapi rest-api rest-client

DeepL4J

Since Official deepl-java project is released, this unofficial project is archived.

Actions Status license

DeepL API v2 client library for Java. Client library classes are auto generated by OpenAPI generator based on an unofficial DeepL OpenAPI specification.

Getting from JitPack

DeepL4J is not yet published to Maven Central. Please use JitPack snapshot repository instead.

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
<dependency>
    <groupId>com.github.sharplab</groupId>
    <artifactId>deepl4j</artifactId>
    <version>0.1.0.RELEASE</version>
</dependency>

Build from source

DeepL4J uses a Gradle based build system. In the instructions below, gradlew is invoked from the root of the source tree and serves as a cross-platform, self-contained bootstrap mechanism for the build.

Prerequisites

Checkout sources

git clone https://github.com/sharplab/deepl4j

Build all jars

./gradlew build

How to use

        DeepLApi deepLApi = new DeepLApiFactory().create("<your api key>");
        try {
            Translations response = deepLApi.translate(
                    Collections.singletonList("This is a pen."),
                    "JA",
                    null, //null to detect source_lang
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null
            );
        } catch (ApiException e) {
            // error handling
        }

License

DeepL4J is Open Source software released under the Apache 2.0 license.

Contributing

Interested in helping out with DeepL4J? Great! Your participation in the community is much appreciated! Please feel free to open issues and send pull-requests.