Problem/Motivation

Translating Site Studio layout canvas entity which is a referenced entity using entity reference revisions is no longer translating correctly after upgrading to version 1.17 of TMGMT.

Steps to reproduce

  1. Install Site Studio & TMGMT modules
  2. Setup translations so that the field is not translated but the underlying entity
  3. Create a node with a site studio field
  4. Add a text component & save page
  5. Translate page through TMGMT & updating values
  6. The result is that the underlying entity has not been translated and shows the source translation

I unfortunately have no other way to reproduce this. I believe that issue is around the change merged for this issue: https://www.drupal.org/project/tmgmt/issues/3478739

CommentFileSizeAuthor
#3 3512738.patch3.24 KBthoward216

Issue fork tmgmt-3512738

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

thoward216 created an issue. See original summary.

thoward216’s picture

StatusFileSize
new3.24 KB

Adding patch so we can kick off Site Studio tests with this patch.

davidarbour’s picture

#3 fixed the issue with Site Studio.

thoward216’s picture

Status: Active » Needs work
berdir’s picture

#3 is just a revert of the change done by the other issue, which IMHO implements the correct thing and is consistent with how translations through the UI also happen.

Will need to be investigated why this happens with site studio, reverting this change is not an option at this point.

thoward216’s picture

Understood, thanks for context here @berdir. It will likely need further investigation by the Site Studio team.

rohan-sinha’s picture

Status: Needs work » Closed (works as designed)
Parent issue: » #3354729: Suggestions for embedded entities

With the latest TMGMT Embedded References Configuration, there is no patch required to enable Site Studio (Layout Canvas) field translation in Drupal. TMGMT now offers native support for Site Studio fields through configuration. Follow these steps to achieve efficient, seamless translation.

Step-by-Step Solution to Enable TMGMT Translation for Site Studio Fields

1. Enable Translation for Your Content Type
Navigate to the Content Types page:

Go to Structure > Content types (/admin/structure/types).
Edit Your Target Content Type:

Click the Edit button next to the content type where a Site Studio field is used.
Access Language Settings:

Click the “Edit” tab for your content type.
Find the Language settings section.
Enable Translation:

Check the box for Enable translation.
Click Save at the bottom.
This makes the content type translatable, including Site Studio fields.

2. Configure TMGMT to Support Site Studio Layout Canvas
Navigate to TMGMT Settings:

Go to Translation Management > Settings or directly via the URL /admin/tmgmt/settings.
Enable Embedded References for Layout Canvas:

In the Embedded references section, locate Layout canvas (Layout canvas).
Check the box to enable it.
Save Configuration.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

davisa’s picture

#8
I think this still is problematic. It works only with the patch.

As to your instructions, my site follows the configuration you explained. And as to:
>In the Embedded references section, locate Layout canvas (Layout canvas).
It is enabled by default it seems (see attached screenshot).

Always embedded
Component content: Layout canvas
Content: Cohesion Layout
Content: Cohesion Layout
These references are always embedded in the translatable data.

P.S. The translation has been setup as described in Acquia docs: https://sitestudiodocs.acquia.com/6.0/user-guide/configuring-translation...

Also, in the Acquia docs this is refferenced as a bug which requires a patch: https://docs.acquia.com/drupal-starter-kits/add-ons/site-studio/tmgmt-tr...
I would recommend Acquia to update the docs with the latest instructions. Otherwise - as I see it - this is still a problem.

murz’s picture

Title: Translating referenced entity seems to not work correctly as of 1.17 » Translating of the Acquia Site Studio fields stopped working after the 8.x-1.18 release
Version: 8.x-1.17 » 8.x-1.18
Status: Closed (works as designed) » Active

Actually, the bug is still here, but logically reproducible seems only with Acquia Site Studio (Cohesion version 8.x-8.2.4) and the latest TMGMT (version 8.x-1.18), so let me reopen the issue to keep the conversation, just rename it to match the actual issue.

I agree with the @berdir's comment that the new logic seems right and should well with embedded entities, so reverting to the previous logic, as the patch and MR propose, is probably not a good idea.

The changes, that the patch reverts, are implemented in the issue #3478739: Create revision before changing values, set revision author and time to fix a bug with wrong revision creation flow, that produces issues in other cases.

But seems the issue is how Acquia Site Studio handles creating a new revision of the cohesion_layout entity, that is referenced from the main entity, if the order of revision creation is correct.

But, from the current investigation, it looks like with the new TMGMT implementation Acquia Site Studio started to create two revisions, instead of one, during the single translation creation. And, looking into the database, the first revision contains the translated values, but the second one - for some reason stores the original untranslated values!

So, the attached patch resolves the issue only because it reverts the previous behavior, to which Acquia Site Studio module seems was just adapted using some workaround.

Maybe the issue is on the Acquia Site Studio side, but it worth to try to reproduce this with the native Drupal entities: at least check, if creating a new translation leads to creating two revisions of the embedded entity, or not.

And if two revisions will be created with native Drupal entities too, it will mean that the issue is still on the TMGMT side, or maybe on both sides.

murz’s picture

Title: Translating of the Acquia Site Studio fields stopped working after the 8.x-1.18 release » Translating of the Acquia Site Studio fields stopped working after the 8.x-1.17 release
Version: 8.x-1.18 » 8.x-1.17
thoward216’s picture

@murz I'll take another fresh look at this from the Site Studio side. I don't think that the issue is with TMGMT itself. Please raise a ticket with Acquia support with regards to this if you haven't already.

eugene_bsk’s picture

Version: 8.x-1.17 » 8.x-1.18

I compared the Layout Canvas translation with another embedded reference, Paragraph.

The translation with Paragraph is created correctly.

However, when translating Layout Canvas, two revisions are created: the first one contains the translated values, and the second one contains the original values.

It looks like the issue is on the Site Studio side. Therefore, the recommendation to apply the patch does not seem to be the correct solution.

thoward216 changed the visibility of the branch 3512738-translating-referenced-entity to hidden.

thoward216’s picture

Status: Active » Closed (works as designed)

@murz @eugene_bsk - We have had a fresh look at this on the Site Studio side and have a fix.
Closing as works as designed, as the issue is not with TMGMT.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

murz’s picture

Wow, awesome, thank you! Could you please share here too in what version of the Cohesion module this issue is fixed?

thoward216’s picture

@murz, it'll be in the next release of Site Studio 8.2.7. It's currently going through QA & testing.