Integration with Weblate

Hello! I’m trying to connect my self hosted Weblate and Libretranslate instances, but when I add my Libretranslate URL in Weblate, I get this error: " * Could not fetch translation: 400 Client Error: BAD REQUEST for url: [MY LT INSTANCE’S URL]/translate".

If I try the public Libretranslate instance, it accepts that without issue and I get automatic suggestions working. This leads me to believe the problem is my Libretranslate configuration. What’s strange is that my Libretranslate instance seems to work the same as the public instance, as I can make requests to its /translate endpoint without issue.

What I’ve tried:

  • Setting up CORS to accept requests from my Weblate instance’s URL. That didn’t change anything.
  • Configure all instances under the same docker-compose.yml, which I share below, in order to leverage Docker networking which would mitigate any errors related to network permissions. I couldn’t complete this test because Weblate won’t accept http://libretranslate:5000 as the Libretranslate URL by saying “Enter a valid URL”.

My docker configuration:

version: '3'
      - 8082:8080
      - localize-cdn-data:/app/data/localize-cdn-data
      WEBLATE_ADMIN_PASSWORD: mypassword
      WEBLATE_ADMIN_EMAIL: [email protected]
      WEBLATE_SITE_DOMAIN: localhost
    container_name: libretranslate
      context: LibreTranslate
      dockerfile: docker/Dockerfile
    restart: unless-stopped
      - "5000:5000"
      - LT_LOAD_ONLY=en,es
  • How could I inspect the request coming from Weblate in order to eye what’s different between the public instance and mine?
  • What might I have misconfigured in my Libretranslate instance which doesn’t allow it to be used by my Weblate instance?

You might have better luck posting this question to Weblate’s support channels, however, it’s possible that you might need to run LT on a standard port (80 or 443), and/or possibly with SSL enabled? (Just guessing, I don’t know Weblate’s codebase).

1 Like

Thanks for your response! I’ll be sure to post on Weblate channels also.

As for SSL, the production setup (which is what I tried even before the localhost Docker tests) has both the Weblate and the Libretranslate using SSL and they’re accesible through and respectively. The SSL is given by the nginx reverse proxy that serves them. I’ve also tried explicitly setting Libretranslate’s SSL argument to True but that seems to do nothing.

If anyone wants to take a look around my instances, I can create an account if you give me a throwaway email address.

1 Like