Problem/Motivation
In order to enable translation, one can visit the admin UI to enable all translatable fields:
admin/config/regional/content-language
All fields added to the paragraph bundles currently don't show up.

Also when editing a paragraph
URL admin/structure/paragraphs_type/*
It is not possible to mark a paragraph type translatable.

Compared to content type settings for translatability:

Proposed resolution
Paragraphs need to support translation on entity level. This is really challenging.
In regular situations it is not the entity reference that should be set to translatable, since the wrapping field should maintain consistent references. Thus all translations of a certain content should maintain the same set of translated paragraphs.
When translating a content, all paragraphs from the default language should still be there and the user should have the ability to translate them into the target language.
On save, the paragraph entities should be updated with the proper language context to persist the translations.
Field collection struggled a lot with adding support.
Paragraph in D7 has no real translation support. When making the entity reference field translatable, translated paragraphs have absolutely no relationship under each other. This should be avoided as things fall apart for tools like TMGMT to maintain translation workflows.
Setting to major as this is a highly limiting situation with the current code.
Comments
Comment #1
miro_dietikerI added this to our team board. Not yet scheduled for immediate progress. :-)
Comment #2
miro_dietikerNote: When implementing this, pay special attention to the delete (confirm, restore) workflows.
Comment #3
jeroen.b commentedComment #4
miro_dietikerThe more we are thinking about this, the more challenging this task seems.
See also this nice task at field collection module with almost 300 replies and work in progress for 3 years...
#1344672: Field Collection: Field translation (entity_translation) support.
Comment #5
jeroen.b commentedShouldn't it be easier in D8 though?
Comment #6
miro_dietikerAs stated overthere, an own field type might simplify a bit...
#2430209: Create own fieldtype for Paragraphs
But also these tasks show a bit what complexity we touch:
#2429335: Deletion of referenced entities
#2428833: Unable to 'save and keep published' after editing content with paragraphs in testing
And we have the extra revision topic... #2426631: Add revision support using entity reference revision module
Multilingual is for many of these cases another dimension added in complexity.
I guess we will just try it and quickly learn from failing. ;-)
Comment #7
miro_dietikerHint, paragraphs shows up on the list of translatable entity types. If i enable it though after save, the fields are not translateable and then when editing a second time, the checkbox is also reset.
Thoughts about our UX goal:
As a site builder i define some fields of my paragraph bundles as multilingual, with more than one language enabled. (BROKEN NOW)
As a translator, if i want to create a translation of a node with paragraphs, i
- have the node created, with language assigned
- click on translate tab from node detail
- click on Add for new translation language
- expect to have all paragraphs prefilled with original language
Now the problem is the composite relationship between the node and paragraph entities. As long as the reference relationship is not translatable, this relationship needs to be frozen when translating, meaning when translating, i
- can not remove/delete a paragraph
- can not add a paragraph
- can not switch type of a paragraph (upcoming feature)
Note that if the entity reference is translatable, the limitations above do not apply, but there are many other issues related with it. Thus we recommend to start with a clean implementation of the description above.
Comment #8
Anushka-mp commentedAs a first step we created tests for the basic workflow in translating paragraph entities.
The above problem happens due to #2449457: inconsistent checks in content_translation and also we found this #2450251: Bundle cache is not invalidated after changing translation settings.
As a temporary solution, a dummy canonical form and a route has been added in this patch (can be removed later after the core issues gets fixed.)
We need to extend tests and discuss more on how to improve the translation workflow and the user interface.
Uploading the patch with a quick fix and basic tests.
Comment #9
berdirSo the tests prove that the basics work, all we need to do is the get translation for the entity we're attached to. Which is pretty nice.
Questions/Next steps:
- For what we're doing, we don't actually need content_translation, but it provides a nice UI to manage translatability of fields
- The translation handler does some weird things to the labels, it adds (All languages) everywhere, but that's not actually correct, we need to look into why it is doing that and how we can prevent it.
- Per miros suggestion, we should hide/disable the buttons to remove/add additional paragraphs when editing a translation. check $paragraph_item->language()->getId() != $paragraph_item->getUntranslated()->language()->getId()
- Do we need to make the translation behavior configurable, if so, how?
- How should it behave if you make the paragraph field translatable? How do we explain to users that that is probably not what they want? Do we even want to support that (can we prevent it?)
And tests for each of those things, as we fix/decide them.
Also, screenshots :)
Comment #10
Anushka-mp commentedThe dummy canonical form and routing removed. we'll have to wait for #2449457: inconsistent checks in content_translation to pass the tests.
Comment #12
cgalli commentedFollowup:
- Make paragraphs_demo multilingual. Enable translation for paragraphed article type.
Comment #15
miro_dietikerCreated followups
#2461689: demo module: Multilingual setup
#2461695: Support asymmetric translations
#2463491: Hide add/remove buttons when translating
#2463575: Wrong "all languages" in multilingual paragraphs
All to clearly reduce the scope of this issue.
Comment #16
miro_dietikerThe README should explain how to properly configure multilingual paragraphs.
And outline the limitations with reference to #2461695: Support asymmetric translations
Comment #17
sasanikolic commentedRerolled...
Comment #19
miro_dietikerHm, there's a fail in the test run.
And see my comment from #16, we need the readme extended.. Or a separate documentation task.
We should push this in ASAP to make paragraph translation work.
Comment #20
berdirThis fails because #2449457: inconsistent checks in content_translation is not committet yet, we need to get that in first.
Comment #21
sasanikolic commentedAdded the description in the README file. Hope it's clear enough.
Comment #23
miro_dietikerSome readme feedback. :-)
Paragraphs work without TMGMT. This module should not have any reference in the configuration to TMGMT at all.
Paragraphed article is only an example content type from the demo module.
Either you refer to the demo setup... Or you refer to any custom content type with a paragraph field.
Tab here...
Better: Set the fields of each paragraph type to translatable as required.
Wrong line break.
Comment #24
sasanikolic commentedComment #25
sasanikolic commentedCorrected word wrapping and changed untranslatable to NOT translatable. :)
Comment #28
sasanikolic commentedWord wrapping to 80...
Comment #30
miro_dietikerAww... Providing interdiff.
The paragraphs_demo module is first used in this test. It had implicit dependency to path and menu_ui module.. And paragraphs_demo shipped config through views config, but still with only default values. Dropped it.
Still depends to the core patch. :-)
Comment #32
miro_dietikerOK, nice, ready to commit. formally marking it postponed, adding related.
Comment #33
miro_dietikerAww... Strange side effects here...
Let's start with adding a test that checks the first two buggy steps.
Comment #34
sasanikolic commentedReproduced the issues above in the test.
Will try to debug now.
Comment #36
sasanikolic commentedBetter test.. :)
Comment #38
miro_dietikerThis is needed to make the failing tests pass.
Comment #40
miro_dietikerPrfct!
Comment #41
miro_dietikerUnpostponing this:
- commenting the UI checking lines. It still works.
- create followup to reenable: #2473721: Check multilingual settings for paragraphs
Comment #42
berdirLooks good to me.
Comment #44
jeroen.b commentedAwesome work, thanks everyone! Pushed to dev
Comment #45
berdirComment #46
miro_dietikerYay! Party! Welcome to the multilingual world! Thx for pushing! Me Xited! ;-)
Comment #48
tom robert commentedI'm trying to find out why paragraphs items need to be defined on the translation page. Would it not make more sense that paragraphs inherits the multilingual settings from its hosts entity field?
If this can be accomplished with multiple fields from different bundles who use the same paragraph type. Not quite sure if drupal 8 can handle this.
Comment #49
tom robert commentedComment #50
berdirPlease open a new support and explain what you want to do exactly.
Comment #51
henk commentedI had the same problem. Paragraph with image field, alt and title is translatable, but file path is not translatable.
Fatal error appears:
Workorund for that problem is translate whole paragraph fields (admin/config/regional/content-language) or untranslate it like in #21 comment. Mixed mode have still problems.