Summary

When I use Canvas Translate the language dropdown in Canvas allows me to delete the translation but not to create a new one. But I can still preview nonexistent translations (no checkmark on it).

Since there is no way to get to Canvas Translate here, I can only get there by going to the sidebar AGAIN finding the page and language there. This is sort of fine as long as there are only a few pages, but once there are many pages, needing to find the page again there is going to be a big pain IMHO.

[See comment #5 for video]

When trying to edit translations the Canvas listing lists translations the same way as regular pages. This is also how node listings work. (The language column is added by Drupal CMS but the listing has translations the same way in Canvas). Edit operation on a translation goes to editing the original content NOT the translation. The Translate operation on a Canvas Page goes to the full list of pages again (Canvas Translate does not have the kind of view that core has where ONE entity can list their translations). So I (a) need to personally know this is a translation and NOT click Edit on it. (b) Click Translate and AGAIN find the page there manually.

[See comment #5 for video]

Steps to reproduce

Proposed resolution

Discuss how to integrate Canvas Translate so people can find where to translate things.

IMHO ideally Canvas Translate would hook into both the Canvas language preview list and also alter Drupal entity operations so it is wired into both the main Canvas preview and also the Drupal based operations outside of Canvas. Currently it is wired into neither.

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

gábor hojtsy created an issue. See original summary.

gábor hojtsy’s picture

Issue summary: View changes
gábor hojtsy’s picture

Issue summary: View changes

One thing I had locally was an operation alter that Canvas Translate could have that would

(a) modify the "Edit" operation to "Edit original" for a translation
(b) add an "Edit translation" operation with 0 weight to come first

But this still has the "Translate" operation which goes to the main page listing of Canvas Translate where you still need to find your page again. If we would remove that then there would be no way to go to OTHER translations of the Canvas page.

Also there is still only one way to add a Canvas Page translation by going to Canvas Translate and finding the page again there.

gábor hojtsy’s picture

StatusFileSize
new276.65 KB

Screenshot of my half cooked attempt from earlier:

gábor hojtsy’s picture

Issue summary: View changes

Moving video embeds here to issue summary can still be edited (and thus comments can be posted) without high access levels.

Video of trying to get from within Canvas to Canvas Translate:

Video of trying to get from outside of Canvas from the pages listing to Canvas Translate:

gábor hojtsy’s picture

Issue summary: View changes
f0ns’s picture

Looked into this in detail. Here is a list of what I think this module can fix directly on its own versus what needs to be fixed in Canvas itself (checked against Canvas 1.12.0).

Fixable in canvas_translate:

  1. The "Translate" operation and tab (/page/{id}/translations) are rerouted by TranslateRedirectController::overview() to the extension root, so the page context is lost. That's why Translate dumps you in the full list. Canvas already supports deep links into extensions (/canvas/app/canvas_translate/page/1/nl is forwarded to the iframe as #/page/1/nl), so the redirect could pass the page along instead.
  2. The SPA has /page/:id/:langcode but no per-page overview. A /page/:id route listing every language with its status and a translate/edit action would cover the "all translations of one entity" view, and be the redirect target for the Translate tab.
  3. The operation alter (described in comment #3, screenshot in comment #4) for the pages listing. Translation rows there use the edit-form link, which carries no language, and Canvas can't open a translation for editing anyway: /nl/canvas/editor/canvas_page/1 redirects to the unprefixed path, and non-default languages only open in preview. So "Edit translation" has to point at Canvas Translate, as in that screenshot.

Needs a change in canvas:

1. The language dropdown in 1.12 already has "Add translation" / "Edit translation" buttons per language, shown when translations.links[langcode] has a create or edit-form link. But ApiLayoutController only ever emits delete-form (and only for existing translations), with no alter hook, so those buttons never appear. If Canvas let modules provide those links, Canvas Translate could point them at /canvas/app/canvas_translate/page/{id}/{langcode} and the dropdown problem is solved.

Update: I think this would only need one new issue on canvas as https://git.drupalcode.org/project/canvas/-/work_items/3591932 is a good fit for the first change that I mentioned. I've added a comment there.

2. The Canvas sidebar operations are hardcoded in ApiContentControllers::getEntityOperations() with no alter hook. If Canvas made them alterable, Canvas Translate could add a "Translate" entry pointing at the page in the extension.

Created issue: https://git.drupalcode.org/project/canvas/-/work_items/3592132

Proposal: scope this issue to the canvas_translate items and open Canvas issues for the other two, linked from here.

f0ns’s picture

StatusFileSize
new8.88 MB

Opened an MR covering the canvas_translate items from #7: Translate lands on the page's own overview, and a translation's row in the pages listing leads with "Edit translation" (with "Edit original" for the source).

Attached a short demo. The Canvas-side items (language dropdown, sidebar operations) need changes in Canvas and aren't part of this MR.

Demo video in the MR description: !12.

f0ns’s picture

f0ns’s picture

MR !12: Translate now opens the page's own overview, and a translation's row gets Edit translation (core's Edit becomes Edit original).

f0ns’s picture

Status: Active » Needs review
gábor hojtsy’s picture

Unfortunately regression in Canvas is that the "Edit" button is not shown in the navigation top bar for translated pages anymore, in fact there is no operation shown now, so users don't know what to do. I think this MR probably already fixes that but would be important to check. (The Edit button before was going to the English original like in the view, so I think it was wrong earlier, but it at least lead you into Canvas, now there is not even an affordance for that).

lauriii made their first commit to this issue’s fork.

lauriii’s picture

Category: Bug report » Feature request

  • lauriii committed 183d9518 on 1.0.x authored by f0ns
    feat: #3623308 Canvas Translate does not have useful entry points from...
lauriii’s picture

Status: Needs review » Fixed

Thank you! I added entry points from the language list in Canvas too which makes this a bit more complete.

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.

Status: Fixed » Closed (fixed)

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