DeepL Integration removes text to be translated

Environment

  • Ubuntu 22.04
  • nginx 1.27.3 (GeoIP2, Brotli, H3, debug: see links below)
  • Nextcloud 29.0.11
  • Collabora Docker 24.04.11.3.1

Links

I want to use DeepL in Collabora. Looks like a great tool to have. I want to use the free account. I added these lines to my coolwsd.xml:

    <deepl desc="DeepL API settings for translation service">
        <enabled desc="If true, shows translate option as a menu entry in the compact view and as an icon in the tabbed view." type="bool" default="false">true</enabled>
        <api_url desc="URL for the API" type="string" default="">https://api-free.deepl.com</api_url>
        <auth_key desc="Auth Key generated by your account" type="string" default="">redacted:fx</auth_key>
    </deepl>

The translate option now appears. However, after selecting the text I want to translate e.g. to German, the highlighted text gets deleted and no text appears in its place.

I have checked the docker logs, and nothing seems relevant to the DeepL api calls, and there is nothing in either the access or error logs for nginx.

Does anyone have a DeepL with Collabora working configuration?

Can anyone help me diagnose why this is happening?

I appreciate your help in advance :slightly_smiling_face:.

Hello @iamdoubz Welcome to collabora online forum

I did some research on our platform, and it seems to be working fine here. Can you please verify the custom Nginx settings you’re using? There might be an issue with the response you’re getting. Also, check the response code and review the values received at the API end to ensure they match the expected text for translation.

For reference, you can check out this document and try translating some text:
https://staging-perf.eu.collaboraonline.com/nextcloud/index.php/s/6jyHzwBE7F7PTmK?dir=/&openfile=true. It works well here.

Version Info

  • COOLWSD version: 24.04.12.1 (git hash: db66104fd1 (E))
  • LOKit version: Collabora Office 24.04.12.1 (git hash: 1768680)
  • Served by: openSUSE Leap 15.5
  • Server ID: 9c1efca5
  • WOPI host: Nextcloud 31.0.0.11 - richdocuments 8.6.0-beta.1

Thanks
Darshan

Response from @iamdoubz

I have two subdomains, one for Nextcloud and the other for Collabora. e.g. cloud.my.domain and office.my.domain. For the office domain, everything is “wide open” meaning there are no nginx specific limits such as Content-Security-Policy or Permissions-Policy. There are, however, such limits in the cloud domain.

Do I need to add the https://api-free.deepl.com into my cloud nginx config?

Also, check the response code and review the values received at the API end to ensure they match the expected text for translation.

When I check the DeepL website for how many words I’ve translated, it reads 0. Which would lead me to the conclusion that the call isn’t being made to their servers. I went ahead and manually ran the API just to make sure it “works” in Postman and it indeed made the call and returned text.

Where can I go to see the POST calls to DeepL in Collabora?

If your Nextcloud instance (cloud.my.domain) is making requests to the DeepL API (e.g., for translations or related features), you may need to add https://api-free.deepl.com to your Nextcloud domain’s Content-Security-Policy (CSP) configuration. This is required because the browser will block any cross-origin requests not explicitly allowed by the CSP.

I added the URL into Nextcloud’s CSP under script and connect, but no change in behavior. Any chance you can find your either apache or nginx config for your test Nextcloud instance and share?

Here are the instructions that might be helpful. Could you kindly review them ?

I did an exact copy of this. I did not add any additional “extras” from what was explained here. So as far as the Collabora url, it is “wide open”. Everything works in Nextcloud and using Collabora to edit/create documents. The only thing that doesn’t work is the DeepL piece. I know it is probably super simple… just haven’t quite figured it out yet.