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.
The token [webform_submission:node:title] takes always the title of the original sitetitle. On a multiple language website it didn't take the translated titel of the page.
Comment | File | Size | Author |
---|---|---|---|
#6 | 2980963-5.patch | 16.29 KB | jrockowitz |
| |||
#5 | 2980963-4.patch | 4.91 KB | jrockowitz |
| |||
#2 | 2980963-2.patch | 1.22 KB | jrockowitz |
Comments
Comment #2
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI can replicate this issue which is the source entity is always the default language.
The attached patch returns the translated source entity when \Drupal\webform\Entity\WebformSubmission::getSourceEntity is called, this fixes the token issue.
This solution translated all submissions related URLs.
/node/{nid}/webform/submissions => /es/node/{nid}/webform/submissions.
/node/{nid}/webform/submission/{sid} => /es/node/{nid}/webform/submission/{sid}.
We might have just discovered a much bigger issue where a translated submission can only be viewed in the default language.
Fixing this issue could cause make problems and regressions for people who are relying on the broken untranslated URLs.
My only immediate thought is that we could add redirects from the broken translated submissions URLs to the correct ones.
Comment #4
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedThe attached patch only fixes the token source entity translation issue. This approach should not break any tests or cause regressions.
I have decided not always translate the source entity because there is one major nuance to webform submission translations, which is that webform submissions are multilingual, but they are not translatable. In other words, only one language is associated with one submission I am not sure it makes sense to change the entire site's language when an admin views a single submission.
We can also address this issue in a new ticket.
Comment #5
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #6
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedThe attached patch adds test coverage.
Comment #8
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI committed the patch. Please download the latest dev release to review.