Open rgaricano opened 1 month ago
I solved it changing http request, removing headers parameter it work, for some reason that function is not working properly: String v = HttpConnectionUtils.post(serverUrl, params);
Well, I hope work on it for activate API-KEY and alternatives translates.
As README.md writes:
Not supported yet
API key authentication HTML format
Authentication is not supported. As usual, you are welcome to join a development and propose an enhancement.
I tried to connect with local or online libretranslate but allways is empty. When i do directly on webbroser it work:
curl -X 'POST' \ 'http://127.0.0.1:5000/translate' \ -H 'accept: application/json' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'q=hola&source=es&target=en&format=text&alternatives=3'
Request URL: http://127.0.0.1:5000/translate
Server response: Code 200 { "alternatives": [ "hi", "hello", "hey" ], "translatedText": "hello" }
Response headers
access-control-allow-credentials: true access-control-allow-headers: Authorization,Content-Type access-control-allow-methods: GET,POST access-control-allow-origin: * access-control-expose-headers: Authorization access-control-max-age: 1728000 content-length: 63 content-type: application/json date: Mon,15 Jul 2024 10:07:11 GMT server: waitress
This is what OmegaT log:
31278: Error: org.omegat.util.HttpConnectionUtils$ResponseError: 400: BAD REQUEST 31278: Error: at org.omegat.util.HttpConnectionUtils.getStringContent(HttpConnectionUtils.java:396) 31278: Error: at org.omegat.util.HttpConnectionUtils.getStringContent(HttpConnectionUtils.java:388) 31278: Error: at org.omegat.util.HttpConnectionUtils.post(HttpConnectionUtils.java:324) 31278: Error: at org.omegat.machinetranslators.libretranslate.LibreTranslate.translate(LibreTranslate.java:114) 31278: Error: at org.omegat.core.machinetranslators.BaseCachedTranslate.getTranslation(BaseCachedTranslate.java:118) 31278: Error: at org.omegat.gui.exttrans.MachineTranslateTextArea$FindThread.getTranslation(MachineTranslateTextArea.java:275) 31278: Error: at org.omegat.gui.exttrans.MachineTranslateTextArea$FindThread.search(MachineTranslateTextArea.java:258) 31278: Error: at org.omegat.gui.exttrans.MachineTranslateTextArea$FindThread.search(MachineTranslateTextArea.java:233) 31278: Error: at org.omegat.gui.common.EntryInfoSearchThread.run(EntryInfoSearchThread.java:96)
tested in ubuntu 22.04 & windows 10