deepl-java icon indicating copy to clipboard operation
deepl-java copied to clipboard

Mismatch between README and actual code

Open i5-650 opened this issue 10 months ago • 2 comments

Hello !

I'm creating a small Java project that uses DeepL API and I faced a strange issue:

In the README, you state the following to instantiate a DeepLClient:

deepLClient = new DeepLClient(apiKey);

However, the code of DeepLClient (here) need an extra TranslatorOptions. In addition, this TranslatorOptions is deprecated and the new DeepLClientOptions is as well.

Perhaps I'm getting ahead of myself, but I believe there may be a mistake here.

i5-650 avatar Jan 18 '25 15:01 i5-650

Not only that, but I see a deprecation notice on all methods for DeepLClient and DeepLClientOptions, which can't be correct.

https://github.com/DeepLcom/deepl-java/blob/9087e775804e7ac7c859661f9a1c1be4e4ced424/deepl-java/src/main/java/com/deepl/api/Translator.java#L23 https://github.com/DeepLcom/deepl-java/blob/9087e775804e7ac7c859661f9a1c1be4e4ced424/deepl-java/src/main/java/com/deepl/api/TranslatorOptions.java#L23

Maybe they should be annotated something like @Internal instead?

Frenzie avatar Jan 22 '25 09:01 Frenzie

Sorry, this was fixed in 1.8.1 . I realized too late that deprecating class Translator would deprecate methods in it that other classes inherit as well. I fixed it now to only deprecate creating new instances of the Translator, as DeepLClient should be used going forward.

You should now be able to instantiate new DeepLClient objects both with

client = new DeepLClient(apiKey);

and

client = new DeepLClient(apiKey, new DeepLClientOptions());

JanEbbing avatar Feb 14 '25 18:02 JanEbbing