• Resolved Matthias Berndt

    (@matze202)


    I wanted to translate various plugins using Loco and DeepL.

    Unfortunately, I only get the following error message in the translation view:
    DeepL Translator: Unknown error

    The WP debug log also shows the following:
    [06-Apr-2025 15:11:36 UTC] PHP Deprecated: Loco_admin_DebugController::selectPluralForm(): Implicitly marking parameter $eq as nullable is deprecated, the explicit nullable type must be used instead in /…/…/wp-content/plugins/loco-translate/src/admin/DebugController.php on line 408
    [06-Apr-2025 15:11:36 UTC] PHP Deprecated: Loco_admin_DebugController::preloadScript(): Implicitly marking parameter $bundle as nullable is deprecated, the explicit nullable type must be used instead in /…/…/wp-content/plugins/loco-translate/src/admin/DebugController.php on line 559

    and the PHP error log remains empty.

    Versions
    Loco Translate: 2.7.1
    WordPress: 6.7.2
    PHP: 8.4.4-nmm1 (fpm-fcgi)
    Server: Apache
    jQuery: 3.7.1; ui/1.13.3; migrate/3.4.1
    Zend OPcache: 8.4.4-nmm1

    Unicode
    UTF-8 rendering: ΟΚ ✓
    Multibyte support: ΟΚ ✓
    Site character set UTF-8 ✓

    Ajax
    Endpoint: /wp-admin/admin-ajax.php
    JSON decoding: ΟΚ ✓
    Ajax test result: ΟΚ ✓

    Translation APIs
    DeepL Translator: FAILED
    Google Translate: No API key available
    Lecto AI: No API key available
    Microsoft Translator: No API key available

    Limits
    WP_MEMORY_LIMIT: 256 MB
    WP_MAX_MEMORY_LIMIT: 768
    MB PHP memory_limit: 768 MB (changeable)
    PHP post_max_size: 768 MB
    PHP max_execution_time: 180

    Filesystem
    File mods disallowed: No
    File mod safety level: Warn
    WP_LANG_DIR: wp-content/languages ✓
    LOCO_LANG_DIR: wp-content/languages/loco ✓
    PHP sys_temp_dir: /tmp ✓
    PHP upload_tmp_dir: (none)
    PHP error_log: (none)
    PHP open_basedir: (none)

    I hope one of you has an idea what the problem is and how I can solve it.

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Tim W

    (@timwhitlock)

    The PHP error you’ve posted is unrelated to the DeepL error. See the pinned post at the top of this forum.

    Thread Starter Matthias Berndt

    (@matze202)

    Unfortunately, I hadn’t noticed the pinned posts because I was using the search function and this page didn’t bring me this post.

    https://wordpress.org/support/topic/deepl-cors-error/

    It’s very annoying, though, that this doesn’t seem to work with DeepL anymore.

    I’ve opened a ticket with them and just ordered an API plan, because I assumed this might be due to the free version.

    With the messages embedded above, I almost thought so, but I just wanted to include them because they could be adjusted in a new version.

    Hi
    I get the same error. I generated a new API in DeepL and I get the same error:
    Error: DeepL Translator: Unknown error

    Plugin Author Tim W

    (@timwhitlock)

    You will get the same error, because DeepL seem to be enforcing their CORS policy.

    I doubt there’s any point raising this issue with DeepL. Please be patient and wait for a fix in Loco Translate, or – quicker – use one of the other supported providers.

    Thread Starter Matthias Berndt

    (@matze202)

    Hello Tim W,

    what is the problem with the CORS policy?

    https://developers.deepl.com/docs/best-practices/cors-requests

    We users of Loco Translate do use the API in the browser, but not through direct calls, but rather through the software you provide and therefore not through direct calls, and you certainly do not access the API keys stored there, so they are safe in our plugin installation, right?

    Above this page I found the following link to the current guide on developing an API for DeepL.

    https://github.com/DeepLcom/deepl-php

    I would like to understand the problem in order to possibly help to build a bridge between Loco Translate and DeepL API, because I really like using both Loco Translate when needed and would like to be able to use it for automated translation with Loco Translate because of the manageable translation costs, because with the other translation API providers available I unfortunately see much higher costs for me.

    Best regards
    Matthias

    Plugin Author Tim W

    (@timwhitlock)

    I am working on a back end implementation for this right now. It will be on the dev branch shortly.

    To clear up the apparent confusion…

    We users of Loco Translate do use the API in the browser, but not through direct calls, but rather through the software you provide and therefore not through direct calls

    Loco Translate (thus far) DOES make direct calls from your browser to DeepL. THIS is the problem.

    you certainly do not access the API keys stored there, so they are safe in our plugin installation, right?

    I don’t access anything. The API key is stored on YOUR server. It’s as safe as the people who have access to your WordPress admin and your database.

    Thank you, Tim.
    We’ll be looking forward to the update so we can continue using your software for automatic translations with DeepL. As Matthias mentioned, many of us rely on this method to efficiently translate strings into multiple languages.

    Thread Starter Matthias Berndt

    (@matze202)

    Thank you very much, Tim,

    for this explanation, so I already know that it’s probably a browser issue.

    As a precaution, I had already sent the following question to DeepL support before your reply and am still waiting for their response:

    question to DeepL Support

    Can you please assure me that this use of the API in a WordPress installation as a plugin actually complies with your CORS policy, even if it is executed via a browser in a WordPress plugin by an external developer?

    I would like to commend you for developing this plugin and hope that you will overcome this hurdle soon.

    Since you are providing this plugin to us free of charge, you deserve further praise.

    What I can’t quite understand, however, is why you didn’t include your own translation API, from the following page, in the API key input.

    https://localise.biz/plans

    I don’t access anything. The API key is stored on YOUR server. It’s as safe as the people who have access to your WordPress admin and your database.

    That’s what I assumed, too; otherwise, this plugin wouldn’t have been on the market for almost 12 years. 😉

    Plugin Author Tim W

    (@timwhitlock)

    Your message to DeepL support will only confuse you further. Their policy is to NOT support in-browser requests. End of story. A fix is on the way in the next few minutes.

    The main Loco platform (to which you link) is not a translation API, and is a separate product (from this plugin) with its own DeepL integration.

    Plugin Author Tim W

    (@timwhitlock)

    Please install the Development version. This now includes a server side DeepL client to get around the CORS restriction.

    I’m marking this thread as resolved. If you have a problem with the fixed version, please start a new thread with specific details.

    Thread Starter Matthias Berndt

    (@matze202)

    Thank you for the quick fix.

    It’s working really well for me, just like I’ve always been used to.

    Unfortunately, I can’t find a way to mark this issue as resolved; I only have the option to disable my email notifications about it.

    Plugin Author Tim W

    (@timwhitlock)

    This topic is resolved already.

    I’ll release a version of the plugin in due course. A few more people testing it first would be useful.

    Plugin Author Tim W

    (@timwhitlock)

    Now live in 2.7.2

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘DeepL Translator: Unknown error’ is closed to new replies.