Hi, just checking out this module. I'm testing this on a single language non-english website and when enabling the examples, the forms that come with the examples module are not editable. The same goes for a form we exported as a feature on an english dev/test site and then enabled this feature on our non-english site. We always get the message: This form has translations and its elements and properties can not be changed.
Creating a form from scratch works on the non-english site. The form elements remain editable.
What's the reason behind this behaviour? Or is this a bug that is being or going to be addressed? It's a major issue for us at the moment and stops us from using this otherwise excellent module.
Comment | File | Size | Author |
---|---|---|---|
#4 | form_has_translation-2805113-4.patch | 46.87 KB | jrockowitz |
Comments
Comment #2
jrockowitz CreditAttribution: jrockowitz as a volunteer commentedThe error you are seeing is related to the fact that once a YAML is translated the configuration has to be essentially locked to prevent out-of-sync elements across multiple translations.
Still, I think what you have found is a bug that is preventing the English version from being altered even when there are no translations.
I will look into replicating and fixing the problem.
Comment #3
jrockowitz CreditAttribution: jrockowitz as a volunteer commentedChanging to Major because this is a showstopping ticket.
Comment #4
jrockowitz CreditAttribution: jrockowitz as a volunteer commentedI am not 100% sure what the best approach is to resolving this problem.
The problem is that the exported yamlform and yamlform_option config is for English (ie langcode: en) when the YAML form module is installed on site with a different language, a second language copy of each yamlform and yamlform_option config is created and this is causing the locking.
It seems that if I omit the langcode from all yamlform config file, when the YAML form module is installed the config files are automatically associated with the site default language, this might be okay.
Attached is a patch that removes the 'langcode: en' from all config and allows the YAML form module to work on translated Drupal site.
I am doubtful that this is the right approach. I am going to need to some help resolving this issue. We might have to rethink how the YAML form module is handling translations.
Comment #5
screon CreditAttribution: screon commentedI have a question about your first comment, jrockowitz. You state that:
Is this a temporary solution or will the translation functionality remain this way?
Because I can image a content editor creating a very long form, translating it into 4 languages and maybe a week later he notices an error in one of the elements or needs to add a new element. That means he would either have to start all over or first remove all translations?
Do you have an idea how to counter this?
Comment #6
jrockowitz CreditAttribution: jrockowitz as a volunteer commented@screon I don't have an immediate solution because what happens if a site editor alters the English (aka Primary) form, deletes an element, and forgets to update the other 4 translations, not the submitted data for the translations is out of sync.
BTW, a developer could easily work-around the "locking" this by altering a YAML Form's exported configuration for all translations and reimporting it.
The YAML Form module might have provide a custom mechanism to translate just a form's labels and text and not the entire render array.
For example, I could see creating a YAML file for each translation that is just a flattened array of a form's element #title and #descriptions and it could something like...
...this information would be overlayed over the primary form.
Comment #7
screon CreditAttribution: screon commentedThats seams an interesting approach I guess since you'll always be able to edit the form, indepedent of the translation.
Comment #8
grahlThat would indeed be a much better solution compared to the current state but please note that field labels are often not the only thing requiring a translation. For example, a translators often also needs to:
Comment #9
jrockowitz CreditAttribution: jrockowitz as a volunteer commentedSo far I think only the below properties need to be translated.
A few more thoughts...
Comment #10
jrockowitz CreditAttribution: jrockowitz as a volunteer commentedHopefully we can also get YAML Forms to be translated via modules like Translation Management Tool.
Comment #11
jrockowitz CreditAttribution: jrockowitz as a volunteer commentedComment #12
jrockowitz CreditAttribution: jrockowitz as a volunteer commentedTasks
Comment #13
stevenx CreditAttribution: stevenx as a volunteer commentedNeed that too, thanks for this awesome module!
Comment #14
jrockowitz CreditAttribution: jrockowitz as a volunteer commentedThis issue has been fixed via #2825410: Allow forms labels to be translatable.
Please download or checkout the latest dev release.