tolgee / tolgee-platform

Developer & translator friendly web-based localization platform

Home Page:https://tolgee.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Machine translation issue

compi-tom opened this issue · comments

Hello,

Further testing on our part to see if Tolgee can meet our needs (side note: the workaround mentioned in #2100 (comment) is working).

I'm facing a new issue and couldn't find any workaround / possible fix.
I've set a Google Cloud translate API key and a free Deepl API key in our config.yaml file:

tolgee:
  postgres-autostart:
    enabled: false
  authentication:
    enabled: true
    initial-password: <strong_pwd>
    initial-username: <my_user>
    jwt-secret: <super_secret>
  machine-translation:
    deepl:
      api-key: <free_deepl_api_key_ending_with:fx>
      default-enabled: true
      default-primary: false
    google:
      api-key: <google_cloud_translation_api_key>
      default-enabled: true
      default-primary: true
spring:
  datasource:
    url: jdbc:postgresql://<container_name>:5432/<my_db>
    username: <my_user>
    password: <strong_pwd>

Issues faced:

  1. Only the Google Machine Translation is available (yes, the Deepl API key is right and we were able to test it in another tool)
  2. When using the Google Machine Translation, we are getting the below error even if our domain is whitelisted for this API Key:
{
  "code" : 403,
  "details" : [ {
    "@type" : "type.googleapis.com/google.rpc.ErrorInfo",
    "reason" : "API_KEY_HTTP_REFERRER_BLOCKED"
  } ],
  "errors" : [ {
    "domain" : "global",
    "message" : "Requests from referer <empty> are blocked.",
    "reason" : "forbidden"
  } ],
  "message" : "Requests from referer <empty> are blocked.",
  "status" : "PERMISSION_DENIED"

Any help with these would be highly appreciated.
Thanks!

Hello, we have never faced similar issues.

Have you enabled DeepL in the project settings?

Hello,

Sorry for the late reply.
Even though it is in the conf file, it doesn't show up in Tolgee:
Capture d’écran du 2024-03-26 14-50-18

I can provide more logs, screenshots or... if required.

Hey! DeepL don't call their API auth-key, but auth-key.
https://tolgee.io/platform/self_hosting/configuration#deepl

My bad. Copy/paste from the Google configuration wasn't the way... Switching from api-key to auth-key enabled DeepL.
One quick test : it's functional).

Any ideas for the Google translate issue? I couldn't find any way to set the refer field in the header.
Even though I did some testing:

  1. Setting the security to "None" (not recommended/wished) makes the Google MT work:
    image
  2. Adding some restrictions, blocks it:
    image

Thanks @JanCizmar for you answers and time!

I guess the issue is that Tolgee is not an website. You might have to restrict the IP address.

Ok, not the easiest as it will require extra updates if/when we change some of our servers.
It works with the IP restriction.

Hence, I'm closing this issue but sending the "referer" in the request's header might be a nice improvement.

Adding referer header haven't come on my mind. If that would work, it would be easy fix. Doesn't seem much more secure anyway. Anyone can add such header, right?