From e482ab703fe558f5a08136ce5d510ba33c6785f7 Mon Sep 17 00:00:00 2001 From: Ben Morss Date: Thu, 28 Aug 2025 13:23:48 -0400 Subject: [PATCH 1/2] Use Translator in getting-started code sample --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 32efc4c..2544bc7 100644 --- a/README.md +++ b/README.md @@ -62,9 +62,9 @@ class Example { public Example() throws Exception { String authKey = "f63c02c5-f056-..."; // Replace with your key - client = new DeepLClient(authKey); + translator = new Translator(authKey); TextResult result = - client.translateText("Hello, world!", null, "fr"); + translator.translateText("Hello, world!", null, "fr"); System.out.println(result.getText()); // "Bonjour, le monde !" } } From 84cfb1f1b632d8dbcbf14b04c54e500c9f2199f1 Mon Sep 17 00:00:00 2001 From: Ben Morss Date: Thu, 28 Aug 2025 13:29:18 -0400 Subject: [PATCH 2/2] Declare translator as a Translator before it gets assigned a Translator --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2544bc7..5402b78 100644 --- a/README.md +++ b/README.md @@ -58,11 +58,10 @@ Be careful not to expose your key, for example when sharing source code. import com.deepl.api.*; class Example { - DeepLClient client; - public Example() throws Exception { String authKey = "f63c02c5-f056-..."; // Replace with your key - translator = new Translator(authKey); + Translator translator = new Translator(authKey); + TextResult result = translator.translateText("Hello, world!", null, "fr"); System.out.println(result.getText()); // "Bonjour, le monde !"