Problem/Motivation

I would like to include the translation for the "Did you find what you were looking for?" webform.

Comments

smulvih2 created an issue. See original summary.

smulvih2’s picture

This patch provides the translations.

smulvih2’s picture

Note - This commit, which moved all wxt_ext_webform config files into the /optional directory, breaks translation import on install. Might be related to this issue. Regardless, would be good to include all webform translations, just need to copy the files to /config/sync directory and import.

smulvih2’s picture

When the translation config files are in the /optional directory they are not installed. Including all config files in /install causes an error when uninstalling and then re-installing the wxt_ext_webform module.

This patch moves all config to the /install directory and adds the enforced key which ensures that the configuration is removed when the module is uninstalled, which fixes the error mentioned above. I tested this on a fresh install of 4.0.2 and all config and translations are imported properly. I also tested uninstalling and re-installing the wxt_ext_webform module and it works as expected as well, including translations. Unless I am overlooking something I think this is the best setup here.

Also modified the block.block.reportproblemblock.yml file to load the Report a Problem webform and have it display inline, which I think is a good default.

joseph.olstad’s picture

great work @smulvih, I'll look closer at this patch soon to see how this 'enforced' key works as I'll likely need to try it in some custom modules.

sylus’s picture

I took a look at this.

I think we had to move to optional because it was causing problems with other site installs and moving to optional resolved those dependency problems.

The changes do look good to me though so i'll reach out to perform some tests against it before merge :D

Thanks!

smulvih2’s picture

Version: 4.0.2 » 4.0.4

Tested patch against 4.0.4 and it still applies. I think the only dependency issue would be if the webform module wasn't installed, but since this module lists webform as a dependency it shouldn't cause any issues.

joseph.olstad’s picture

joseph.olstad’s picture

tried patch 4 it worked out nicely so far, now trying both patch 4 (improved defaults) AND patch 2 (translations)

smulvih2’s picture

@joseph patch #2 isn't needed if patch #4 is used. #2 just adds the translation config file to /optional which doesn't work for translations on install. #4 adds the translation in /install, as well as adds the enforced key to make sure it can be uninstalled/installed again.

joseph.olstad’s picture

ok must be why translations didn't work for me, I will try again without patch 2

joseph.olstad’s picture

Patch working fine except translations. It did add some but I can't edit them.

strangely, got this error trying to edit the french translations of the Report a problem block

The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to Drupal\Core\Render\Element::children() must be of the type array, null given, called in /opt/app-root/src/html/modules/contrib/webform/src/WebformTranslationConfigManager.php on line 325 in Drupal\Core\Render\Element::children() (line 71 of core/lib/Drupal/Core/Render/Element.php).
joseph.olstad’s picture

ok with this webform patch the translations come in nicely
#3212867: Unable to translate webforms 6.0.3

joseph.olstad’s picture

Status: Needs review » Reviewed & tested by the community

RTBC patch 4 when using patch 3 from 3212867 (for webform module)

            "drupal/webform": {
                "Translate a webform that has no handler fix error 3212867":
                "https://www.drupal.org/files/issues/2021-05-07/3212867-3.patch"
            },
            "drupalwxt/wxt": {
                "Report a problem form fixes 3203752 patch 4":
                "https://www.drupal.org/files/issues/2021-03-16/wxt-webform-move-config-to-install-3203752-4.patch"
            }

sylus’s picture

Nathan Weir, would you mind checking that this addition doesn't cause problems for you?

I seem to remember it conflicted with your webform settings but to be honest I might be forgetting.

Otherwise I am good to commit this :D

  • sylus committed 050e19f on 4.0.x authored by smulvih2
    Issue #3203752 by smulvih2: Translate the "Did you find" webform
    
sylus’s picture

Status: Reviewed & tested by the community » Fixed
joseph.olstad’s picture

Thanks @sylus, I reviewed your commit quickly and it looks exactly as prescribed!

natew’s picture

Apologies for not getting to this last week, looks fine to me.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.