Problem/Motivation
I have a site with 4 (+ main English) languages and all needed configuration setup. I want to be able to translate a piece of content to all 4 languages at once.
I go to "Automatic translate" on a node and select all 4 languages. That node has a few regular fields and a few paragraph fields. The regular fields work fine and get correctly translated to all languages. Paragraph fields, however, do not. In my specific example fields get translated in German and French fine, while Spanish and Croatian just remain with the old English values.
When I go one by one, translations work as expected.
Steps to reproduce
Trigger auto translate for more than 1 language at a time and some paragraph text fields will probably remain in the original language instead of being translated.
Proposed resolution
I've tried and tested a bunch of things but couldn't figure out where the problem is. The values actually do get translated correctly but the paragraph entity just does not save for some reason.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | 3412616.patch | 9.4 KB | jmauricio |
| #7 | orphaned-paragraphs-209012024.patch | 1015 bytes | abaudoin |
| #4 | multi-language-08012024.patch | 431 bytes | abaudoin |
| Screenshot from 2024-01-05 18-11-17.png | 21.68 KB | abaudoin | |
| Screenshot from 2024-01-05 18-10-50.png | 20.05 KB | abaudoin |
Comments
Comment #2
abaudoin commentedAfter additional research I came up with a patch that seems to work in my particular situation, but to be honest I'm not quite sure why exactly and where the error lies. Still needs review.
Patch attached.<- Patch was on old 2.1.7 version. Adding new patched from 2.1.8, sorry about that.Comment #3
abaudoin commentedComment #4
abaudoin commentedComment #5
abaudoin commentedLast patch (
orphaned-paragraphs-09012024.patch) is only if you've already had some paragraphs that were created before the issue was patched. In that case the untranslated paragraphs were always displayed because they actually have a translation but it just isn't displayed on the node. The patch omits the check if the paragraph has a translations, and just translates is again, overriding it.Edit: this patch made single translations on paragraph not display, added hopefully a last fix for that.
Comment #6
abaudoin commentedComment #7
abaudoin commentedComment #8
kallado commentedSorry we've been very busy will change the status and review wenever possible.
Comment #9
kallado commentedComment #10
jmauricio commented@abaudoin
If you translate the node manually do the paragraphs translate?
Have you made this configuration?
https://www.drupal.org/docs/contributed-modules/paragraphs/multilingual-...
Comment #11
willibautista commentedI have the same problem, but I have noticed that the translation of the content and paragraphs is effectively executed only in the first language selected; for the other languages, the paragraphs are not translated.
Comment #12
abaudoin commented@jmauricio
Yeah, the configuration is correct, paragraph translations work except in the scenario I've written in the opening ticket.
Comment #13
jmauricio commentedWorking on it
Comment #14
jmauricio commented@abaudoin @WilliBautista can you please test this patch. I think it solves this problem.
Comment #15
abaudoin commentedHey @jmauricio, thanks for the patch. I'll test it a bit tomorrow.
Comment #16
abaudoin commentedPatch #14 works in all cases except when a piece of content was affected with the bug before.
Example: I don't have the patch applied yet. I translate an article in German, French and Spanish and get the bug in question - Spanish not translated. I apply the patch, try to retranslate all languages again - Spanish remains unchanged and in original language. I try to retranslate only Spanish - it works.
For newly created content patch works as expected.
Comment #17
jmauricio commentedYes, it it because the code was creating a new paragraph instead of translating it in those cases, don't really know how to fix that, maybe just delete the translations and run the auto translation again.
I'll commit the patch, run some more tests and release a new version.
Thanks
Comment #19
jmauricio commentedReleased on 2.1.9
Comment #20
jmauricio commented