translate="no" not working in some languages

Created on 31 July 2024, 4 months ago
Updated 9 August 2024, 3 months ago

Problem/Motivation

Using translate="no" to prevent translating or changing '§§§' does not work in all languages. Don't know, if it is a problem of the translation provider - we are using DeepL Pro - or a problem at DeepL side.

Steps to reproduce

Use

function hook_tmgmt_data_item_text_output_alter(&$source_text, &$translation_text, array $context) {
  $source_text = str_replace('§§§', '<p translate="no">§§§</p>', $source_text);
}

Translate you’re considering <p translate="no">§§§</p> OLED <p translate="no">§§§</p>, AMOLED into Korean language and get 이 가이드는 §§ OLED §§, AMOLED back.

The three '§§§' are changed to '§§'.

Also, if I translate to simplified chinese.

Is there another mechanism to prevent some text snippets to be not translated and touched?

💬 Support request
Status

Active

Version

2.2

Component

Code

Created by

🇩🇪Germany WalterP

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @WalterP
  • 🇩🇪Germany SteffenR Germany

    Setting translate="no" while handling HTML or XML is the only way to prevent the translation of the content in a tag.
    What is your setting for tag handling? This should be set to HTML or XML.

    Have you tried other languages with translate="no".

    The problem is not related to the module itself, since we only pass all markup to the DeepL API translate endpoint and use the returning values as the translation.

  • 🇩🇪Germany WalterP

    Thank you.

    Yes, it is set to HTML.

    Then I go to DeepL and contact the support.

  • 🇩🇪Germany WalterP

    The support from DeepL shows, that <p translate="no">§§§</p> OLED <p translate="no">§§§</p> is not sent to DeepL in the query params.

    I tried to change the text to be translated with several tmgmt hooks:

    • - hook_tmgmt_job_before_request_translation
    • - hook_tmgmt_job_after_request_translation
    • - hook_tmgmt_data_item_text_output_alter
    • - hook_tmgmt_data_item_text_input_alter

    but none of them changes the query string sent to DeepL.

    Is there any tmgmt or tmgmt_deepl hook, that I can use?

  • 🇩🇪Germany SteffenR Germany

    You can use the hook_tmgmt_deepl_query_string_alter to alter the query string.
    Other hooks and examples can be found in the file tmgmt_deepl.api.php.

  • 🇩🇪Germany WalterP

    OK, thank you. I'll try this.

    Just another question: We translate our site into 36 languages and use DeepL for the languages that are supported from DeepL and Microsoft Azure for the rest. Is there any possibility to request a translation for all languages in the tmgmt cart and then, when submitting to provider, the jobs are automatically sent to the right translation provider?

  • 🇩🇪Germany SteffenR Germany

    @WalterP: No - not out of the box.

  • 🇩🇪Germany SteffenR Germany
Production build 0.71.5 2024