diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..c77eb88fe3d1beadea2bcc4c5fec0c431c9d2a92 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# DMX DeepL + +The [DeepL](https://www.deepl.com/) API as a [DMX platform](https://github.com/dmx-systems/dmx-platform) service + +## Version History + +**1.0** -- Jun 16, 2023 + +* 2 service calls: + * translate() + * usageStats() (RESTful) +* Compatible with DMX 5.3 diff --git a/pom.xml b/pom.xml index ca194de37ee6b6c8f3c92b638eb1f1e38e49b8e1..c5405f906569ae03d0bd0632f2d21f90e718d7dd 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ <name>DMX DeepL</name> <groupId>systems.dmx</groupId> <artifactId>dmx-deepl</artifactId> - <version>1.0-SNAPSHOT</version> + <version>1.0</version> <packaging>bundle</packaging> <description>The DeepL API as a DMX service</description> @@ -15,7 +15,7 @@ <parent> <groupId>systems.dmx</groupId> <artifactId>dmx-plugin</artifactId> - <version>5.2.1</version> + <version>5.3</version> </parent> <build> diff --git a/src/main/java/systems/dmx/deepl/DeepLPlugin.java b/src/main/java/systems/dmx/deepl/DeepLPlugin.java index b58736b994d802bd692775685964f485c31fdfc3..928918b6263ff982c24098458bbdce24443f1e9c 100644 --- a/src/main/java/systems/dmx/deepl/DeepLPlugin.java +++ b/src/main/java/systems/dmx/deepl/DeepLPlugin.java @@ -8,7 +8,6 @@ import org.codehaus.jettison.json.JSONObject; import javax.ws.rs.GET; import javax.ws.rs.Path; -import javax.ws.rs.QueryParam; import javax.ws.rs.Produces; import javax.ws.rs.Consumes; @@ -42,7 +41,7 @@ public class DeepLPlugin extends PluginActivator implements DeepLService { // *** DeepLService *** @Override - public List<Translation> translate(@QueryParam("text") String text, @QueryParam("target_lang") String targetLang) { + public List<Translation> translate(String text, String targetLang) { try { StringBuilder stripped = new StringBuilder(); List<String> urls = stripImageURLs(text, stripped); @@ -52,8 +51,8 @@ public class DeepLPlugin extends PluginActivator implements DeepLService { URLConnection con = new URL(DEEPL_URL + "translate").openConnection(); con.setRequestProperty("Authorization", "DeepL-Auth-Key " + DEEPL_AUTH_KEY); con.setDoOutput(true); - // Note: opening the output stream connects implicitly (no con.connect() required) - // and sets method to "POST" automatically + // Note: opening the output stream connects implicitly (no con.connect() required) and sets + // method ("POST") and Content-Type ("application/x-www-form-urlencoded") automatically OutputStreamWriter out = new OutputStreamWriter(con.getOutputStream()); out.write("text=" + JavaUtils.encodeURIComponent(_stripped) + "&target_lang=" + targetLang + "&tag_handling=html");