Problem/Motivation

When adding a new translation, children can be collapsed according to the regular collapse setting.
That setting however is chosen with regular editing in mind.

Proposed resolution

When adding a translation, all Paragraphs should be expanded so that all translatables are visible.
Otherwise a user might translate what is visible, forgets about certain collapsed Paragraphs and the flag of the node mistakenly indicates that the translation is up-to-date and complete.

Remaining tasks

Discuss, decide if this needs a setting.

User interface changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

miro_dietiker created an issue. See original summary.

johnchque’s picture

Assigned: Unassigned » johnchque

Working on this.

johnchque’s picture

Status: Active » Needs review
FileSize
580 bytes

This might break some tests, up for having a setting for this.

Status: Needs review » Needs work

The last submitted patch, 3: expand_all_when_translatin-2954921-3.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

johnchque’s picture

So we just open all Paragraphs when first adding the transation right? Will we then allow the users to close before saving?

miro_dietiker’s picture

Sure, collapse button should work as expected. It's just an expanded default state.

Still not sure how we change setting labels or need extra setting for this. But happy to see it implemented for UI testing.

johnchque’s picture

Status: Needs work » Needs review
FileSize
1.37 KB

Ok, it seems that this should work. Also fixing some tests. Let's see how it goes.

miro_dietiker’s picture

Status: Needs review » Needs work

The added code condition reads as non-obvious and thus definitively needs a comment.

Beside fixing tests, we should explicitly comment the expectation there.
And from quickly looking at that test above i wouldn't be able to tell if collapse now still works or not while adding a translation.
Let's add asserts and comments that are clear about this change.

johnchque’s picture

Status: Needs work » Needs review
FileSize
7.1 KB
6.01 KB

Adding better tests and a better comment.

miro_dietiker’s picture

Title: Expand all Paragraphs when adding a translation » Expand all Paragraphs recursively when adding a translation

As discussed, investigating this further leads me to multiple UX questions.

Adding a translation is a special case when you know that such a translator should work through all translatable elements, thus expand makes sense.

If they though don't complete and save, or someone wants to review, they're in the same situation and would want to expand all recursively. If you have multiple containers, even if you have "expand all", you still need to click such an "expand all" button multiple times. And always expanding on a translation page is a bad thing.

Maybe we could define that unpublished translations should always expand all nested children for full review.

But it's clear that we have multiple situations and the need for the default edit state (open / closed) might vary (for paragraph add / edit, translation add / edit).

An alternative perspective was that we maybe need an extra "Expand all recursively" action so this is only a single click and we avoid special case logic.

Needs discussion and definition before we can continue with implementation.

miro_dietiker’s picture

Status: Needs review » Postponed

Postponing this on the other issue to collapse things that can't be translated
#3008687: Close paragraphs without translatable fields while translating

miro_dietiker’s picture

Status: Postponed » Needs work

Unpostponing as the other issue was committed. Needs work as it should be rebuilt on top.

johnchque’s picture

Status: Needs work » Needs review
FileSize
6.16 KB

Tests updated and mostly rewritten. This should work fine, testing locally seems to work nice. :)

Status: Needs review » Needs work

The last submitted patch, 13: expand_all_when_translatin-2954921-13.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

johnchque’s picture

Status: Needs work » Needs review
FileSize
6.91 KB
611 bytes

Oops, forgot to remove this. :)

miro_dietiker’s picture

Status: Needs review » Fixed

Very nice work, the translation experience is already so much better!
Let's just start with this and figure out in follow-ups if we need to refine this.

Status: Fixed » Closed (fixed)

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

Michelle’s picture

Is this working for people? It isn't working on a client site and I'm wondering if it's just them or if it's not working in general? This is a big issue because Drupal doesn't translate text fields that are inside of closed paragraphs. So the client is having to manually open them all before saving as a work-around.

Berdir’s picture

@Michelle: Are you using the experimental widget? All the new features are only there. Which we are using in production and it is "stable", it is simply likely that we'll continue to add more features to and might refactor things between versions.

Michelle’s picture

@Berdir: That was it! Thank you very much for the fast response. :)