Problem/Motivation

In a scenario where you have templates stored for users to build additional webforms with, in a multilingual site these templates can be translated into various languages and works great. The issue I am seeing is when a webform is created from a template, the pre-existing translation stored in the template is not inherited by the child webform.

Example:
Template A has two translations (English, Spanish)
Webform A is created from Template A but only has the default language (English)

Hope this makes sense, and thanks,
Mark

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

md2 created an issue. See original summary.

jrockowitz’s picture

Makes complete sense to me but it is not easy to do because Webform config entities (compare to content entities) don't expose any meta data about translations.

We are going to have to look at the ConfigTranslationController and figure out how to duplicate all the translated configuration files.

md2’s picture

Hi @jrockowitz,

Is there anything I can do to help move this issue forward? I'm not overly familiar with the ConfigTranslationController and how it would relate to webforms config files but willing to help if I can.

~Mark

jrockowitz’s picture

@md2 Not too many people are familiar with the inner workings of config translation.

Luckily, I am starting to work with Lingotek which is going to motivate me to start addressing multilingual issues next month.

md2’s picture

@jrockowitz, If there is anything I can test / help test / investigate please just let me know, keen to help push this issue forward! :)

Thanks for such a great D8 version of the module btw.

~Mark

jrockowitz’s picture

The method that needs to be updated is \Drupal\webform\Entity\Webform::createDuplicate.

Duplicating config entity translations is not being handled by any module. I am pretty sure duplicating a translated Views or Contact Form does not duplicate the translations.

jrockowitz’s picture

Status: Active » Needs review
FileSize
1.31 KB

I could not figure out the "right way" to duplicate translated config. Attached is a patch that uses a poor-mans workaround that directly copies the config records stored in the database.

I should be able to write some tests that verify the workaround is acceptable.

  • 1dec2fd committed on 2884658-duplicate-translations
    Issue #2884658 by jrockowitz: Webforms created from template do not...

  • b3194d5 committed on 2884658-duplicate-translations
    Issue #2884658 by jrockowitz: Webforms created from template do not...
jrockowitz’s picture

Attached is the same patch with test coverage.... my workaround still feels dirty. At least there are tests that applicable when we properly fix this issue.

jrockowitz’s picture

  • jrockowitz authored c0380ec on 8.x-5.x
    Issue #2884658 by jrockowitz: Webforms created from template do not...
jrockowitz’s picture

Status: Needs review » Fixed

I committed the patch. Please download the latest dev release to review.

Status: Fixed » Closed (fixed)

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