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.
So say we want to enable a field for translation, and this field is part of a content type that has already been translated.
When I do this, I only get the data for this field copied across for the original language. The translations (which before were sharing the field) lose the content.
Comments
Comment #1
Leon Kessler CreditAttribution: Leon Kessler commentedHere's what we did (in case anyone else is interested).
An extra checkbox just before the bulk update batch operation, to check if the user wants to copy data for all translations.
Comment #2
plachThanks, this sounds like an interesting feature, we could also default to TRUE. Anyway, here is a quick code review. Before commit will have to test this.
This can be simplified:
!empty($form_state['values']['copy_all_languages'])
.Trailing whitespaces.
Comment #4
Leon Kessler CreditAttribution: Leon Kessler commentedOkay great! Here's a new patch with the suggestions you made.
I also made an addition to the description on the checkbox, as it didn't describe what the behaviour was if it was disabled.
Comment #5
plachI'd move this to a #description key and use just "Copy translations" as checkbox label. I'd also remove the parentheses: "Copy the current field data to all translations, otherwise data will only be stored for the original language."
Comment #6
Leon Kessler CreditAttribution: Leon Kessler commentedOkay, that sounds good.
Here's the new patch.
Comment #7
plachThanks! I will test this as soon as I have some spare time and if don't find any functional issue I'll commit it. Meanwhile, to get more bouns points, you may want to provide some test coverage ;)
Comment #8
plachGreat work! Sorry for taking so long.
Committed and pushed, thanks!