Follow-up to #2854188: Translation issue

Problem/Motivation

Changing the site wide language causes a translated webform's elements to be lost.

There is no easy way to get a webform's element's render array to be translatable because it is almost impossible to define a config scheme for dozens of render elements within nested render array.
https://www.drupal.org/docs/8/api/configuration-api/configuration-schema...

The Webform module provides a WebformTranslationManager that extracts the translatable properties from a webform's element's render array.

Proposed resolution

OPTION 1: Detect when the site language changes and fix translated webform config.

OPTION 2: Track source language when a webform is created.

Remaining tasks

OPTION 1: Detect when the site language changes and fix translated webform config.

  • Detect site language on install store as settings.
  • Track website site language to current language
  • Add conversion batch process to MskTranslationManager.
  • Add warning to status report
  • Add warning to translate tabs
  • Add warning to change language form
  • Write drush command
  • Write tests

OPTION 2: Track source language when a webform is created.

  • Add source_langcode to webform config
  • Document the Source langcode
  • Update WebformTranslationManager to use source_langcode for element definitions.
  • Write update hook that sets the correctly source langcode for all existing configuration.
  • Write tests

User interface changes

  • Warning on Status Report
  • Warning on Translate tab

API changes

  • Webform module is tracking site language

Data model changes

None

Steps to Reproduce

  • Install the Webform and Config Translation module
  • Enable 'Spanish' ()
  • Translate Contact form to Spanish
  • Switch Default Language to 'Spanish'
  • View Contact form and elements are missing.

Notes

Installing Webform on non-English (en) website

  • Webform retains en langcode.
  • English is still considered the (original)

New Webform created on a non-English website

  • Webform's langcode is set to current language
  • Current language is marked as original
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jrockowitz created an issue. See original summary.

jrockowitz’s picture

Issue summary: View changes
jrockowitz’s picture

Status: Active » Needs review
FileSize
963 bytes

Status: Needs review » Needs work

The last submitted patch, 3: changing_the_site_wide-2854510-3.patch, failed testing.

  • jrockowitz committed 4809806 on 2854510-change-site-language
    Issue #2854510 by jrockowitz: Changing the site wide language causes...
jrockowitz’s picture

Status: Needs work » Needs review
FileSize
7.04 KB

The attached is patch for OPTION 2.

  • jrockowitz committed b202ba5 on 2854510-change-site-language
    Issue #2854510 by jrockowitz: Changing the site wide language causes...
jrockowitz’s picture

  • jrockowitz committed 27fa19e on 8.x-5.x
    Issue #2854510 by jrockowitz: Changing the site wide language causes...
jrockowitz’s picture

Status: Needs review » Fixed
balintcsaba’s picture

Is any chance that the patch contains code from a previously added patch? First of all thank you, the patch is working and fixed the translation and the wizard problem to. But since the patch is not applying for all files with the message of: "Reversed (or previously applied) patch detected!" I can't mark as RTBC. Maybe is not worth it to fix, since is a critical bug for multilingual site with other default language then English, maybe the beta8 is more important. So for me is a RTBC but if you want that other to test before beta8 then you should wait.

Edit:
I applied the changing_the_site_wide-2854510-7.patch

Update:
If apply the changing_the_site_wide-2854510-5.patch this has no error, and this is fixing my issue to.

I'am missing something maybe :)

jrockowitz’s picture

I committed the patch (@see #9). Please download or checkout the latest dev release.

I only noted it in the original ticket and should have said it here to.

Status: Fixed » Closed (fixed)

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