When translating HTML content (e.g. paragraph text fields), the translateHtmlWithSafeTextExtraction() method in Utility.php has a hardcoded 'google' provider on line 2215, ignoring the configured translation provider. This means that even when DeepL or another provider is selected in the module settings, all HTML content is silently translated via Google Translate. Only plain text fields are correctly routed to the configured provider.
https://git.drupalcode.org/project/auto_translation/-/blob/1.0.x/src/Uti...
```
$translated = $this->callProviderTranslationApi($segment['text'], $s_lang, $t_lang, 'google');
```
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3573131-3.patch | 2.73 KB | dejan0 |
| #2 | 3573131-2.patch | 683 bytes | dejan0 |
Issue fork auto_translation-3573131
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
dejan0 commentedQuick fix: replaced the hardcoded 'google' provider in translateHtmlWithSafeTextExtraction() (line 2215) with the configured provider from config
Comment #3
dejan0 commentedAlternative fix: instead of reading the provider from config at the call site, this patch propagates the $provider parameter through the entire HTML translation chain. This is a cleaner approach as it avoids duplicating the config read logic and keeps the provider flow consistent with how translatePlainText() already works. This patch touches more methods, so it may need additional testing across different providers and content types.
Comment #4
bigbabertHi @dejan0,
thanks to report and provide patch, i'll review and include in next versions.
Thanks
Comment #5
angel_devoeted commentedTested on Drupal 11.4-dev (Drupal Forge) with 1.4.37 and 3573131-3.patch applied.
I verified via logs that HTML content (formatted text, including a Paragraphs text field) is translated using the configured provider. In my case, both HTML and plain text fields triggered DeepL as expected.
Comment #6
bigbabertComment #9
bigbabertreleased in 1.4.38
Comment #11
bigbabert