Webforms translations to be ignored

Created on 28 June 2024, about 1 year ago

Problem/Motivation

Webforms cannot be translated via Interface translation so importing them via config import will just override any changes done manually with the same default language strings

Proposed resolution

Add exception in code to ignore any webform context

📌 Task
Status

Active

Version

1.0

Component

Code

Created by

🇷🇴Romania alexandru.dumitru Cluj

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

Merge Requests

Comments & Activities

  • Issue created by @alexandru.dumitru
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.x + Environment: PHP 8.2 & MySQL 8
    last update about 1 year ago
    Composer require failure
  • Status changed to Needs review about 1 year ago
  • 🇺🇦Ukraine ekolmyk

    Added patch to move the condition to exclude webform configuration translations to updateConfigTranslations method, as some translations were still being overwritten.

  • 🇫🇷France mayeulk

    I think the problem below seems related to this issue. I could not export as a .po file the French translation of a webform initially created in English. (Maybe I'm doing it wrong?)
    Steps to reproduce:
    With config_translation_po module Version: 1.0.1
    Create a webform in English with this source:

    some_checkbox:
      '#type': checkbox
      '#title': 'Some Checkbox'
      '#description': '<p>Some description here.</p>'

    Use the UI for webforms translation, into French. Test that it works ok for both languages. (/en/ or /fr/ in URL).

    Do an export of French translation,
    from /en/admin/config/regional/translate/export,
    it exports empty msgstr ""

    Do an export of French translation,
    from /en/admin/config/regional/config-translation/export,
    it exports English msgstr ""

    see screenshot: https://www.drupal.org/files/issues/2025-08-15/ksnip_20250815-202307.png

    Screenshot above taken Before the following steps:
    Also: Taking a small part of one of the above .po export, to make the following fr_test.po file, partly works when I import it at en/admin/config/regional/config-translation/import
    (checking all three boxes:
    Treat imported strings as custom translations
    Overwrite non-customized translations
    Overwrite existing customized translations):

    # French translation for XXX (site de test)
    #
    
    msgctxt "webform.webform.simple_test_webform_english:title"
    msgid "simple test webform English"
    msgstr "simple test webform en bon français"
    
    
    msgctxt "webform.webform.simple_test_webform_english:elements"
    msgid ""
    "some_checkbox:\n"
    "  '#type': checkbox\n"
    "  '#title': 'Some Checkbox'\n"
    "  "
    "'#description': '<p>Some description here.</p>'"
    msgstr ""
    "some_checkbox:\n"
    "  '#type': checkbox\n"
    "  '#title': 'Une très belle case à cocher, vraiment'\n"
    "  "
    "'#description': '<p>Une très belle description.</p>'"
    

    The checkbox text and chebox description gets updated (OK); but the French title of the webforms (which was previously translated in the UI, as shown in screenshot above with a green check 'V' sign) got replaced by the English title ("simple test webform English").

    Also, for more complex webforms, imports fails with error about malformed HTML; indeed, some tags get split with long URLs.
    "I suspect the almost-fixed-"
    "width carrier return ( such"
    "as here) to be the cause."

    Sample part of exported .po file:

    "Rights in relation to automated decision-making "
    "and profiling: </strong>You can request that decisions based on your "
    "personal data and that significantly affect you are made by natural "
    "persons, not only by computers.</span></li></ul><p lang=\"en-GB\">You "
    "can read more on these rights (in 28 languages) at:</p><p><a "
    "href=\"https://commission.europa.eu/law/law-topic/data-protection/information-individuals_en\"><span "
    "lang=\"en-GB\">https://commission.europa.eu/law/law-topic/data-protection/information-individuals_en</span></a></p><p "
    "lang=\"en-GB\">More details on data processing are shown "

    Notice above that got split.
    Also "

Production build 0.71.5 2024