Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Follow-up to #2805113: Form has translation and its elements and properties can not be changed.
Problem/Motivation
A YAML forms are render arrays that contain rendering and processing information as well as each element's title, description, placeholder, etc... An element's labels need to be easily translatable.
Proposed resolution
Rework YAML form translations so that just a simple YAML file containing just an element's label can be translated.
Remaining tasks
- Create dedicated yamform translate test form. Include custom elements and place holders
- Define properties that are translatable. getTranslatableProperties($element)
- Update translation form to display only element labels.
- Update yamlform initialization logic to apply labels
- Update element CRUD operations to delete translated elements
- Write update hook that convert existing translated forms to use new labeling format.
- Remove locking code and validation handlers.
- Write tests
User interface changes
TBD
API changes
TBD
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#11 | Screen Shot 2016-11-18 at 9.01.34 AM.png | 60.98 KB | stewest |
#11 | Screen Shot 2016-11-18 at 9.02.16 AM.png | 38.8 KB | stewest |
#11 | Screen Shot 2016-11-18 at 9.04.30 AM.png | 24.68 KB | stewest |
#10 | Screen Shot 2016-11-17 at 4.57.52 PM.png | 187.75 KB | jrockowitz |
#4 | allow_forms_labels_to-2825410-4.patch | 113.44 KB | jrockowitz |
Comments
Comment #2
jrockowitz CreditAttribution: jrockowitz as a volunteer commentedComment #4
jrockowitz CreditAttribution: jrockowitz as a volunteer commentedComment #6
jrockowitz CreditAttribution: jrockowitz as a volunteer commentedComment #7
stewest CreditAttribution: stewest commentedHi. I'm using latest 8.x-1.x-dev. I created the form in english, translate to DE, updating the yaml form labels. When I go to the form's DE page, there are no input fields.
Any suggestions?
Comment #8
jrockowitz CreditAttribution: jrockowitz as a volunteer commentedWhat is the default language for your site?
What page/path is blank? Can you include a screenshot?
Can you replicate the issue via https://simplytest.me/project/yamlform?
Comment #9
stewest CreditAttribution: stewest commentedHi there
German DE is the default language for the website, however Drupal was installed in English.
We're on Drupal 8.2.3, but Simply test is 8.1.11. I'll see if I can get a test going.
This is the yaml of the form
Comment #10
jrockowitz CreditAttribution: jrockowitz as a volunteer commentedI couldn't reproduce the issue.
Here are my steps attempting to replicate this issue...
It is also worth noting that Drupal automatically converted the forms language from 'en' to 'fr' when I enabled the YAML Form module.
Comment #11
stewest CreditAttribution: stewest commentedHi there
Thanks for this feedback. I followed the steps.
We're using 8.2.3 and the Yaml forms Dev version.
I install just 3 of the form modules: YAML Forms, UI and Node.
We can see the newly created form - when I click translate, it says English is the default.
I then add a German DE translation. The form disappears on the de/form/formname and only shows on the en/form/formname
Comment #12
jrockowitz CreditAttribution: jrockowitz as a volunteer commentedI can't duplicate this issue using Simplytest.me.
Below is a very simple form translated from German into English and French.
https://d1yjh.ply.st/form/test-form
https://d1yjh.ply.st/en/form/test-form
https://d1yjh.ply.st/fr/form/test-form
Here are the languages:
https://d1yjh.ply.st/admin/config/regional/language
Please note that this sandbox (https://d1yjh.ply.st/) is only available for 24 hours.
Comment #13
jrockowitz CreditAttribution: jrockowitz as a volunteer commentedMy best guess is this issue is related to the sequence that the languages are being enabled/configured but we need to be able to replicate this using Simplytest.me.
Comment #14
stewest CreditAttribution: stewest commentedI've attempted Simpletest, but we're on 8.2.3 and this requires the dev release of the Yamlform module.
Comment #15
jrockowitz CreditAttribution: jrockowitz as a volunteer commentedBelow is the 'magical' URL, the only limitation is you can't specific which version of the YAML Form module
https://simplytest.me/project/drupal/8.2.3?add[]=yamlform
Comment #16
stewest CreditAttribution: stewest commentedThank you for that. I've done as you suggested and cannot reproduce the error. There must be something wrong in my config. Thanks for your time and effort so far.
Comment #17
jrockowitz CreditAttribution: jrockowitz as a volunteer commentedJust to be clear, you had existing translations and then you updated to beta23 and now you are seeing this issue.
I am going to bet this issue is simply related the langcode (ie
langcode: en
) for your existing YAML form configuration files. You should export and examine your existing configuration and see how it differs from the configuration generated via a clean installation.One trick to completely reinstall the YAML Form module would be to...
- Export your custom configuration
- Backup the 'yamlform_submission' and 'yamlform_submission_data' tables
- Completely uninstall and reinstall the YAML Form module
- Import your custom configuration
- Restore the backed up 'yamlform_submission' and 'yamlform_submission_data'
Obviously, I am assuming you know how to export configuration and backup and restore MySQL tables.
Comment #18
stewest CreditAttribution: stewest commentedHi there. I totally uninstalled the module, removed (exported) the config, so it was "clean". Then re-installed the latest stable release. I am now able to do translations. Thanks.
Comment #19
jrockowitz CreditAttribution: jrockowitz as a volunteer commented