(ai_translate) One click translations for Layout builder

Created on 9 August 2024, 12 months ago

Problem/Motivation

The main functionality does support
- Paragraphs and fields (this was built in https://www.drupal.org/project/ai/issues/3464024#comment-15720929 ✨ (ai_translate) One click translations for Paragraphs Needs review )
but not
- Layout builder.

Steps to reproduce

Create a page in aCT with Layout builder enabled.
Creater a nice layout with multiple text in blocks.
Navigate to the translate page
click on "Translate using GPT"
The Blocks will not be (but should be) translated.

Proposed resolution

Make it so layouts get translated too on the clicking of the button.

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

1.0

Component

Other Submodules

Created by

πŸ‡§πŸ‡ͺBelgium wouters_f Leuven

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @wouters_f
  • πŸ‡§πŸ‡ͺBelgium wouters_f Leuven
  • First commit to issue fork.
  • Merge request !135TextExtractor plugin for Layout builder β†’ (Merged) created by valthebald
  • πŸ‡§πŸ‡¬Bulgaria valthebald Sofia
  • Pipeline finished with Failed
    10 months ago
    Total: 254s
    #300120
  • Pipeline finished with Failed
    10 months ago
    Total: 169s
    #300568
  • Status changed to Needs work 9 months ago
  • πŸ‡§πŸ‡ͺBelgium borisson_ Mechelen, πŸ‡§πŸ‡ͺ

    I have attempted to test this on a local install, and it looks to me like this doesn't work yet.
    The problem I encounter is that only the title is translated, and nothing that was placed trough layout builder.

    To me it seems like something that needs to be changed in the TextExtractor. Will investigate further.

  • πŸ‡§πŸ‡ͺBelgium borisson_ Mechelen, πŸ‡§πŸ‡ͺ

    If a field type is layout_section, the value always seems to be "Text" instead of the actual text I filled in in the layout builder content. That gets sent to the AI, but a new layout section does not get created either.

    It seems like there are multiple things that can still be improved here.

    array:1 [β–Ό
      0 => array:5 [β–Ό
        "delta" => "850c5e44-8e63-4435-a015-2556aa8c323d"
        "field_name" => "info"
        "field_type" => "string"
        "value" => "Text"
        "parents" => array:2 [β–Ό
          0 => "info"
          1 => 0
        ]
      ]
    ]
    
  • πŸ‡§πŸ‡ͺBelgium wouters_f Leuven

    I've tried this too and not gotten it to work.
    I also noticed blocks also have the translate links but they give an error when clicking on the button.

  • πŸ‡§πŸ‡ͺBelgium arwillame Belgium πŸ‡§πŸ‡ͺ

    I tested as well and it seem to work in the specific default case :
    - The content type has a node "layout_builder__layout" wich is NOT TRANSLATABLE
    - All the blocks used in Layout builder need to be translatable and have text fields translatable.

    So in this configuration it will work as expected, it will just create a translation for the node, where the blocks ids are kept from the source language and translated.

    It's the same idea as for the paragraph, this is a "symmetric" setup.

    For my use case i would need to be able to have an "asymmetric" translation of the blocks for layout_builder (Dupplicate the block from source language, translate it and attach it to node translation).

    I'll work on a module as i made for the asymmetric paragraphs : https://www.drupal.org/project/ai_translate_paragraph_asymetric β†’

  • πŸ‡§πŸ‡ͺBelgium arwillame Belgium πŸ‡§πŸ‡ͺ

    I made more intensive testing and the MR seems fine for me for a "classic" install as specified in my last comment.

    For the layout builder configured to be asymmetric (with Layout Builder Asymmetric Translation β†’ ), i created a contrib module to handle this case :
    https://www.drupal.org/project/ai_translate_lb_asymmetric β†’

    With this module, you'll be able to translate you layout builder page with the following config:

    - Translatable Fields: Ensure that the fields referencing blocks (layout) are configured to be translatable.
    - Non-Translatable Block Fields: Make sure that the block fields themselves are not set to be translatable.

  • Pipeline finished with Failed
    7 months ago
    Total: 140s
    #376975
  • Pipeline finished with Success
    7 months ago
    Total: 290s
    #377010
  • πŸ‡§πŸ‡ͺBelgium arwillame Belgium πŸ‡§πŸ‡ͺ

    I fixed the phpcs et cspell issues.

  • Status changed to Needs review 7 months ago
  • First commit to issue fork.
  • πŸ‡©πŸ‡ͺGermany marcus_johansson

    Merged with latest dev to pass tests and then getting merged into dev. Thank you everyone.

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Status changed to Fixed 3 months ago
  • πŸ‡§πŸ‡ͺBelgium flyke

    This does not work for me.

    Site default language: Dutch.
    Additional languages: English and French.

    Content type 'Page' has a layout_builder__layout field that is translatable.

    I have sevaral block content types like hero, text, image etc. None of the block fields is translatable.
    I'm using ai_translate_lb_asymmetric, layout_builder_at, ai, ai_translate
    For AI model I'm using Claude Sonnet via ai_provider_anthropic

    I create a page with sections, a hero block, some text blocks etc in Dutch (original language).
    I click translate and translate the page to French via 'Translate using claude-3-sonnet-latest'.
    It takes some time, but I successfully see a French page with all the same blocks as my original page and all texts translated (yeay!).
    Now I switch back to my original page (Dutch) and I see that only my first (dutch) hero block is still working, all the rest of the blocks seem missing.

    When I edit the layout, I don't see the missing blocks, but I see some sort of placeholder text where the blocks should be.

  • πŸ‡ΊπŸ‡ΈUnited States Kristen Pol Santa Cruz, CA, USA

    @flyke Please open a new issue with your steps to reproduce your problems, thanks

    ===

    We are doing some issue management housekeeping and adding/removing components.

    We are removing the "Other Submodules" component and want people to categorize issues with the best module/submodule component.

    Moving this issue to "AI Translate".

    See πŸ“Œ Update AI module project components Active for more details.

Production build 0.71.5 2024