Problem/Motivation

It would be helpful when you're on the translation overview to return to the overview after adding or editing the translation. This matches what we do for content listings.

Proposed resolution

Add ?destination= query parameters to all the operations on the Content Translation overview.

Remaining tasks

Address #11

User interface changes

After adding or editing a translation the user is brought back to the translation overview page instead of the default redirect provided by the entity type (usually the view page).

Comments

tstoeckler created an issue. See original summary.

tstoeckler’s picture

Status: Active » Needs review
StatusFileSize
new3.86 KB

Here's a patch that implements this. Let's see what breaks.

One thing that is interesting is that by using the RedirectDestination service is that when reaching the translation overview (e.g. /node/1/translations) from the content listing (e.g. /admin/content), the destination is actually kept as /admin/content so that you return to the content listing and not the translation overview after adding/editing a translation. I actually think that's a neat touch, though, not sure what others think.

Status: Needs review » Needs work

The last submitted patch, 2: 3025384-2.patch, failed testing. View results

tstoeckler’s picture

Status: Needs work » Needs review
StatusFileSize
new3.85 KB

Status: Needs review » Needs work

The last submitted patch, 4: 3025384-4.patch, failed testing. View results

tstoeckler’s picture

Status: Needs work » Needs review
StatusFileSize
new10.45 KB
new12.72 KB

This should be green.

Notes on the interdiff:

  1. Because the Content Moderation explicitly tests whether or not you land on the latest version of an entity or not after adding or editing translations we can no longer go through the translation overview there. I still think the behavior to go back to the overview is fine, though.
  2. I accidentally added the destination to the view link of the translation, as well, which is bogus. Luckily, this caused a test fail.
  3. I think the required changes in ContentTranslationUITestBase show that no additional test coverage is needed.
kristen pol’s picture

Thanks for the patch. I did a review for clarity and formatting and didn't see anything wrong except one comment could be added to the original code (see below). I'll do some testing.

  1. +++ b/core/modules/content_moderation/tests/src/Functional/ModerationLocaleTest.php
    @@ -376,24 +383,26 @@ public function testLanguageIndependentContentModeration() {
    +    $add_translation_fr_path = $node3->toUrl('drupal:content-translation-add')
    +      ->setRouteParameter('source', 'en')
    +      ->setRouteParameter('target', 'fr')
    +      ->setOption('language', $language_fr);
    

    Nitpick: I know this is from the original code, but it would be good to add comment to make it clear why only French is tested here since Italian is tested for the other tests.

kristen pol’s picture

I have tested as follows:

  1. Enabled language and content translation modules
  2. Added Spanish
  3. Configured content types to be translatable
  4. Added node 1
  5. Went to overview page and saw destination for edit and add links
  6. Tested edit and add links and they take you back to overview page after submitting form

kristen pol’s picture

Status: Needs review » Reviewed & tested by the community

Given this is working and the code seems fine (except minor nitpick with original code in comment #7 which could be addressed), I'm going to mark this RTBC.

tstoeckler’s picture

Thanks for the review @Kristen Pol!

Re #7: To be honest, I don't really know why that part of the test is only for French, so I don't think I could add a meaningful comment.

By the way, while the primary purpose of this is improved usability, this is also useful for people that have a custom entity type and, like me, are sometimes too lazy to write dedicated form classes, so that there is no redirect (and no status message) after submitting an entity form. In that case, currently you get an "Access denied" page after adding a translation because you stay on e.g. node/1/translations/add/de/en but that translation has already (just) been created. With this patch you can properly translate entities without having to provide a proper form class.

alexpott’s picture

Status: Reviewed & tested by the community » Needs review

I've tested this manually and I think this makes a lot of sense. But I have one concern. At the moment when you add a new translation to an existing node you can taken to the view the translation once you are finished. This patch changes that behaviour - either taking you to admin/content or node/NID/translate depending on how you started. That's quite a big change that I'm not sure is correct because adding is very different from editing something that exists already. I think that this needs discussion.

kristen pol’s picture

Ah, good catch, @alexpott. I was only testing from the translate page. I've tested from the admin/content page and added some screenshots to show the issue. I think that UX is ok myself since it gets you back to where you started but I can see why someone might argue to redirect to the translation overview if you did a translation. For the latter, the destination should get altered on the links on the translate page to swap out the admin/content path?

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

kristen pol’s picture

Patch from #6 applies cleanly to 9.1.x. Kicking off tests.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

hudri’s picture

Applied patch #6 successfully on v9.1.3, but it no longer applies on v9.1.4

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

kristen pol’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

Per #18, needs reroll.

neslee canil pinto’s picture

Status: Needs work » Needs review
StatusFileSize
new12.72 KB

Applied reroll, but when trying to do interdiff i was getting the following error

1 out of 1 hunk FAILED -- saving rejects to file /var/folders/f3/zj16k4ps65xf1dvqsd469dq00000gn/T//interdiff-1.6EaWYN.rej
interdiff: Error applying patch1 to reconstructed file

does anyone know why this is happening.

artemboiko’s picture

StatusFileSize
new13.06 KB

Patch for 9.2.x

artemboiko’s picture

StatusFileSize
new12.72 KB

A small typo in the previous patch (3025384-21_0.patch)

// Add a French translation (revision 3).;

The last submitted patch, 22: 3025384-22.patch, failed testing. View results

yogeshmpawar’s picture

Status: Needs review » Needs work

Needs re-roll against 9.3.x branch so moving to Needs work.

karishmaamin’s picture

Status: Needs work » Needs review
StatusFileSize
new12.49 KB

Re-rolled patch against 9.3.x. Please review

suresh prabhu parkala’s picture

StatusFileSize
new12.5 KB
new1.53 KB

Tried to fix custom failures.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

kristen pol’s picture

Tagging for testing.

kristen pol’s picture

Issue tags: -Needs manual testing

Bringing up #11 from @alexpott again as no one besides myself has chimed in on that. All the other comments after that were for version changes and re-rolls.

But I have one concern. At the moment when you add a new translation to an existing node you can taken to the view the translation once you are finished. This patch changes that behaviour - either taking you to admin/content or node/NID/translate depending on how you started. That's quite a big change that I'm not sure is correct because adding is very different from editing something that exists already. I think that this needs discussion.

No need for manual testing until we decide that this new behavior is what we want.

ranjith_kumar_k_u’s picture

StatusFileSize
new12.47 KB

Re-rolled #27 for 9.4

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

jedihe’s picture

#31 works for me; manually tested on Drupal 9.4.8, with 2 languages enabled; tested both explicit and implicit destination.

smustgrave’s picture

Issue tags: +Needs usability review

Tagging for usability review for the issue brought up in #11

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Needs issue summary update

As I learn more realized this should move to NW for best approach for #11. Then when a decision is made should it be sent to usability.

Decision should be documented in issue summary with reason why.

rkoller’s picture

Usability review

We've discussed this issue at #3358491: Drupal Usability Meeting 2023-05-12. The recording of the meeting can be found under the following link: https://youtu.be/Z22Hbe3yQtg?t=552

For the record, the attendees at the usability meeting were @aaronmchale, @benjifisher, @rkoller, and @shaal.

At first apologies that it took a while. :( The issue was on the meetings shortlist for a few weeks now, but we only got around to discussing it about three weeks ago. During the write-up I’ve stumbled across a few more details as well as an issue with multilingual in Drupal 10.1.x-dev that delayed things further plus the last one or two weeks were a plain nightmare making me unable to finish the write-up. Sorry again.

During the meeting we've compared the current with the patched state in the different contexts and tasks at hand on Drupal 10.1.x-dev with three languages, English, German, and French, installed. On the Detection and selection-page, Account administration pages is checked and on the user profile page site language and administration pages language is set to English and the translations for the content type Article is activated. In the first table, I have listed the destination parameters of each context and it’s tasks.

<


Current behavior Behavior with the patch applied
Context: admin/content Task: Adding a translation Context: admin/content Task: Adding a translation
A1 - Add german translation via node’s translations overview page
/admin/content ->
/node/1/translations?destination=/admin/content ->
/node/1/translations/add/en/de?language_content_entity=de ->
/node/1?language_content_entity=de
B1- Add German translation via the node’s translations overview page
/admin/content ->
/node/1/translations?destination=/admin/content ->
/node/1/translations/add/en/de?destination=/admin/content&language_content_entity=de ->
/admin/content
Context: admin/content Task: Editing a node/translation Context: admin/content Task: Editing a node/translation
A2 - Click the english node’s edit button on admin/content
/admin/content ->
/de/node/1/edit?destination=/admin/content ->
/admin/content
B2 - Click the english node’s edit button on admin/content
/admin/content ->
/de/node/1/edit?destination=/admin/content ->
/admin/content
A3 - Edit german version via the node’s translation overview page
/admin/content ->
/node/1/translations?destination=/de/admin/content ->
/node/1/edit?language_content_entity=de ->
/node/1?language_content_entity=de
B3 - Edit translation via the node’s translation page -> admin/content (3 clicks)
/admin/content ->
/node/1/translations?destination=/admin/content ->
/node/1/edit?destination=/admin/content&language_content_entity=de ->
/admin/content
Context: View tab on node page Task: Adding a translation Context: View tab on node page Task: Adding a translation
A4 - Via Translate-tab
/node/2 ->
/node/2/translations ->
/node/2/translations/add/en/de?language_content_entity=de ->
/node/2?language_content_entity=de
B4 - Via Translate-tab
/node/2 ->
/node/2/translations ->
/node/2/translations/add/en/de?destination=/node/2/translations&language_content_entity=de ->
/node/2/translations
Context: View tab on node page Task: Edit German translation Context: View tab on node page Task: Edit German translation
A5 - Via Edit tab
/node/2?language_content_entity=de ->
/node/2/edit?language_content_entity=de ->
/node/2?language_content_entity=de
B5 - Via Edit tab
/node/2?language_content_entity=de ->
/node/2/edit?language_content_entity=de ->
/node/2?language_content_entity=de
A6 - Via Translate tab
/node/2?language_content_entity=de ->
/node/2/translations?language_content_entity=de ->
/node/2/edit?language_content_entity=de ->
/node/2?language_content_entity=de
B6 - Via Translate tab
/node/2?language_content_entity=de ->
/node/2/translations?language_content_entity=de ->
/node/2/edit?destination=/node/2/translations%3Flanguage_content_entity%3Dde&language_content_entity=de ->
/node/2/translations?language_content_entity=de

In the second table the destinations for the different contexts are listed. That way it was easier to compare the behavior.

Destination (without patch) Destination (patch applied)
Context: <code>admin/content
C1 - Add translation via translation overview page View-tab on node page admin/content
C2 - Click node’s edit button on <code>admin/content admin/content admin/content
C3 - Click translation’s edit button on translation overview page View-tab on node page admin/content
Context: View-tab on node page
C4 - Add translation via Translate tab View-tab on node page Translation overview page
C5 - Edit node via Edit tab View-tab on node page View-tab on node page
C6 - Edit translation on the Translate tab View-tab on node page Translation overview page

Without the patch applied on save, in every context and for every task, the user is getting redirected to the View-tab page of a node, except in example C2 where the user is getting redirect back to admin/content. That way the destination was sort of consistent and predictable but the downside was that the user's flow was interrupted by getting redirected to the node’s page most of the time.

With the patch applied the behavior gets a bit more diverse and potentially confusing across the different contexts and tasks (C1-C6). The user is getting redirected back to admin/content</code in the context of <code>admin/content where you’ve started off (C1-C3) while getting redirected in most cases “half way” to the translation overview page (C4&C6) instead of the nodes view-tab page (C5) in the context of nodes, as pointed out in #11.
In general it is nearly close to impossible based on the potential different scenarios ("are you building out a site and its content" or "are you just governing already existing content"), contexts (admin/content or the node page), and the tasks at hand (add a node, add a translation after saving a node, editing a node, editing a translation after saving a node and so on) to manage everything with a single Save button and at the same time challenging for the user to remember all the different destinations based on the current context and task at hand.

There was an agreement it would be clearer to add a secondary save button, a pattern that is utilized on the Add term-page. There you have a Save and a Save and go to list-button. In the context of the current patch it would make sense adopting the aforementioned pattern for C1, C3, C4 and C6. With save the user would be redirect to the node’s view page while with the other button the user could be directed back to the translation overview page.

In regards of the button label one worry the group had was coming up with a brief and concise label with two to three words tops. Save and go to list is already too long for example. One idea that came up was Save and translate which would concise enough but is way too ambiguous.

So the suggestion, not a clear recommendation, for the next steps would be adding a secondary button to C1, C3, C4 and C6 with the following labels:

Save (this translation) (no destination parameter - the user gets redirected, depending on the context, to admin/content or the View-tab of the corresponding node)
Save and go to list (use the translation overview page as the destination parameter - user gets redirected to the translation overview page of the current node)

Then opening a follow-up issue about shortening and clarifying the button label. Save and go to list is too long and “list” might also be confused with the list of content on admin/content.

The other option for a follow-up issue might be to extend the adoption of the secondary button pattern to C2 and C5 but using another destination parameter there. But all that would be out of the scope for this issue.

rkoller’s picture

StatusFileSize
new140.65 KB

During the write-up for #38, when i was testing and also collecting feedback in a meetup, I ran into two more details to take into consideration:

1. @rocketeerbkw noted during the Drupal Dojo Austin that the current patch doesn’t preserve the filter settings you were using on admin/content. If filter for example for Basic page and then edit or add a translation the destination you are getting redirected to in the end is again /admin/content instead of /admin/content?title=&type=page&status=All&langcode=All. it would be reasonable that the user is returned to the page and filter setting that one left off.

2. In the context of the translation overview page for individual nodes having the translation overview as the destination causes another problem. It is sort of difficult to grasp the language context you are in on the translation overview page. In the environment i had set up i have three languages (english, german, french) installed and the administration language is set to english.

translation “overview page with german interface text

in the current screenshot the admin language changed to german even though the admin language is set to english. i was editing the german node. when being redirected to the translation overview page the status message says that the german article was updated, the h1 says these are the translations for the french article, while in the language list you have english bolded as the original language. if you have a short working memory, or you get distracted or are away from your computer for a while and return you will have to at least think for a moment in which context you actually are and which version you will get to when you hit the edit tab (bearbeiten). It is sort of difficult due to #2313309: Admin toolbar, Navigation and contextual links should always be rendered in the admin language (if set) and #2864972: Content and interface translation don't clearly separate to reproduce the setting i illustrate in the screenshot consistently. But nevertheless the edit button is sort of problematic with the translation overview page as the destination. Definitely out of the scope of this issue but i think it would be reasonable to have at least a discussion.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.