Page MenuHomePhabricator

CX2: Show link card for source links
Closed, ResolvedPublic

Description

Currently in version 2 of Content Translation, clicking on the source links has no effect unlike CX1. This makes the experience less fluent as pointed by a translator in this comment: "I can't quickly put the link to another wiki page by clicking the necessary word at the left side ".

When selecting a link from the source document, a link card will be shown (similar to T168290). The card will include as the main piece of information the corresponding article on the target wiki with options for adding it to the translation or opening it in a new window/tab.

CX-source-link.png (720×1 px, 245 KB)

In the example, the user selected "Cake" in the source version (in English) and a link card shows the article of "Pastel" which is the equivalent in the target language (Spanish). The user can open the article or add the link to the translation. In addition, the bottom part of the card shows the link to the article in the source language.

When the article does not exist on the target wiki

In the case where there is not an equivalent article, a card with the option to add a red link will be shown. The card is similar to T193233 but with two differences: (a) there is no delete button (i.e., trash icon), and (b) the label for the action for the button is "Add as missing".

CX-source-link-missing.png (720×1 px, 239 KB)


As a result of this ticket a card is shown for source links, but supporting the transfer of such links is part of a follow-up ticket: T222775: CX2: Allow adding a link to the translation from the source link card

Related:

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

@Esanders Is it possible to have link context item for the links in a disabled, non-editable surface? The CX Source surface is a disabled surface.

@santhosh Context popups trigger in reaction to contextChange events, which I'm fairly sure only fire in response to things which happen to an enabled surface. Plus, complications of the surface not having a context if there's not a selection for it to know what that context should be. You could plausibly manually override this by directly asking ve.ui.contextItemFactory.getRelatedItems for context items for parts of the document you're interested in, and displaying those however you please -- that said, context items have a few parts which expect to interact with an enabled document (for links, that'd be the remove-annotation and select-label buttons), and those would cause issues with a disabled surface as well.

(I admit to not being familiar with the details of how you're doing this, so I acknowledge that you might already have worked around parts of these concerns.)

Thanks for taking a look into this @DLynch.
Just to provide a bit more of context, there are two different scenarios that would be useful to support:

  • Add content to the translation. As illustrated in the ticket description, an editor can select a link in the source article in order to add the equivalent one to the translation.
  • Inspect source information. When translating a template, editors may need to check which is the original template and copy information from some of the parameters in order to create/edit the template in the translation.

@santhosh we may want to keep these scenarios in mind as we evaluate the technical possibilities of having a non-editable-but-active editing surface for the source content.

Checked in with @Esanders, he confirmed the feedback from @DLynch is accurate. Are there further outstanding questions on this?

Checked in with @Esanders, he confirmed the feedback from @DLynch is accurate. Are there further outstanding questions on this?

Thanks for the details. @santhosh will be exploring possible approaches technically and sharing further questions based on that if any.

I have created a more general ticket (T203775) that captures a similar issue for references, templates and similar elements in the source article. I guess that challenges and potential solutions may be shared in both tickets, but if there are specific differences that anyone think are relevant feel free to share them in the comments.

Pginer-WMF lowered the priority of this task from Medium to Low.Sep 19 2018, 10:58 AM

A user reported about this limitation in this comment:

I have a suggestion to make: I'd like you guys to keep one thing from the old version of CT. So, when you click in a link, that link will appear on the right panel in both of the languages. In the old version, I can copy the link's text in my language and paste it to my translation (because I don't trust Yandex, I use the "keep the original version" and go on translating them right in the lines). But when I come to the new version, everything is good except, I cannot copy the link's text. So I have to either type them again or go directly to the article and copy its name, both of which are so time-consuming and troublesome.

Pginer-WMF raised the priority of this task from Low to Medium.Nov 9 2018, 9:16 AM

In order to address this and T203775 you'd probably want a mode where the document is not modifiable, but you can place the cursor (in order to select a link, template etc.). In order to enable a selection you are going to have to set contentEditable back to true, but then you will have to block any possible user input. This could mostly be done by cancelling keydown events, and ignoring attempts to apply transactions to the model, but there may be some ways for the user to edit the CE without firing events (e.g. browser spell-check) - these might be edge-casey enough that you don't care though.

All of this work should be done in VE core, and note that it implementing this you would also fix T53547!

All of this work should be done in VE core, and note that it implementing this you would also fix T53547!

Thanks for all the details, Ed. To capture the specific changes to VE I created a new ticket (T210142: Create a read-only mode for Visual Editor that allows inspection) where specific details can be further discussed and related usecases listed there.

Change 489391 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/ContentTranslation@master] CXLinkContextItem: Allow adaptationInfo to be null

https://gerrit.wikimedia.org/r/489391

Change 489391 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@master] CXLinkContextItem: Allow adaptationInfo to be null

https://gerrit.wikimedia.org/r/489391

Change 489392 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/ContentTranslation@master] Use VE read-only mode for source surface

https://gerrit.wikimedia.org/r/489392

Change 489392 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@master] Use VE read-only mode for source surface

https://gerrit.wikimedia.org/r/489392

Petar.petkovic subscribed.

Links in source column point to the target wiki, as querying target wiki is default and hardcoded.

Context item is not according to the specs defined in this ticket yet and "Add as missing" card is not implemented as well.

Change 493014 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/ContentTranslation@master] Use correct link cache in source inspector

https://gerrit.wikimedia.org/r/493014

@Pginer-WMF I see that mock-ups show that when user inspects links from source article, that context item shows page from target wiki as main piece of information and corresponding page from source wiki as secondary info. That is clearly marked with bold text in the description.

I initially thought this ticket was about allowing to inspect links, but as links from source wiki are secondary information and there are action buttons to both add links to existing pages and "add as missing" for missing pages, I now wonder what those actions should do. Mock-ups show corresponding target section has input focus, which isn't what's happening now, because you have cursor to select content in source column. What should happen on clicks to "Add" and "Add as missing"?

I think it might make more sense to avoid having the source inspector behave as if it is the target inspector, as you would end up with actions in the source document relating the target document (Add missing / View).

..but as I mentioned on gerrit, please take the above patch off my hands and implement as you see fit.

Change 493014 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@master] Build same link card in source and target surfaces

https://gerrit.wikimedia.org/r/493014

I initially thought this ticket was about allowing to inspect links...

Having access to source links serves two purposes: (a) allowing to explore/check the original article the link is pointing to, and (b) adding a link to the equivalent link in the translation. With the current state we support (a) which is great, but we don't help much with (b). The user comment I quoted above ("I can't quickly put the link to another wiki page by clicking the necessary word at the left side ") reflects the expectation of being able to easily transfer a link from the source paragraph to the translation. With the current approach you'd have to open the source article, use the interlanguage links to access the target language, keep the target title in mind (or copy it), go back to the translation and add a new link manually.

What should happen on clicks to "Add" and "Add as missing"?

The actions are expected to do the following:

  • "Add". Adds a link in the translation pointing to the corresponding article in the target wiki. In the example, a link to Pastel will be added to the Spanish translation.
  • "Add as missing" will add a red link. This assumes that "Cake" has no equivalent article for Spanish, and a "Cake" red link is added. Adding red links is a bit more tricky, and there are some more detailed considerations you can check in T197787 on how to do that properly (i.e., avoiding articles that are not equivalent but happen to have the same name, etc.).

the new content should be added ideally to the current input cursor position on the translation, which is the only document being edited. If the limitation is that we cannot keep the input cursor active in the translation, we can consider either:

  • Keeping track of the last position of the cursor in the translation and add the elements there.
  • If the previou approach is not possible, add the new elements at the end of the corresponding section in the translation where the source element is. In this way users can cut and paste it where they need it

'View' button does not work in cx2-testing - filed as T217454: [wmf.20-regression] CX2: Link card: "View" button does not open link inspector.

@Pginer-WMF please review the following and advise whether some additional work should be done on this task or some link card features should be separated into different tasks.

(1) The objective of this task is:

When selecting a link from the source document, a link card will be shown [...]. The card will include as the main piece of information the corresponding article on the target wiki with options for adding it to the translation or opening it in a new window/tab.

(b) adding a link to the equivalent link in the translation.

Presently it's not possible to add just a link from a source article to a target article. It's added only when the whole paragraph with link(s) is translated.

I split it into a numbered list:
(1) When selecting a link from the source document, a link card will be shown
(2) The card will include as the main piece of information the corresponding article on the target wiki
(3) [The card will include as the main piece of information the corresponding article on the target wiki] with options for adding it to the translation
(4) [The card will include as the main piece of information the corresponding article on the target wiki] with options [of] opening it in a new window/tab.

(2)

In the case where there is not an equivalent article, a card with the option to add a red link will be shown. The card is similar to T193233 but with two differences: (a) there is no delete button (i.e., trash icon), and (b) the label for the action for the button is "Add as missing".

There are two types of "Missing link" card (as well as just Link card) - only target article has 'Add link'. I am not sure if having two differently functioning link cards was intended.

Source articleTarget article
Screen Shot 2019-03-01 at 4.41.49 PM.png (212×1 px, 91 KB)
Screen Shot 2019-03-01 at 4.42.03 PM.png (305×1 px, 118 KB)

Presently it's not possible to add just a link from a source article to a target article. It's added only when the whole paragraph with link(s) is translated.

I split it into a numbered list:
(1) When selecting a link from the source document, a link card will be shown
(2) The card will include as the main piece of information the corresponding article on the target wiki

Maybe I'm misunderstanding this list, but if the link is selected in the source column shouldn't it show the article in the source wiki?

Currently, it shows a link with the title from the source column, but the href points to the target wiki, which is definitely wrong (T217511).

Of course, it does make sense to also show a link to the target wiki if a corresponding article exists there.

Presently it's not possible to add just a link from a source article to a target article. It's added only when the whole paragraph with link(s) is translated.

I split it into a numbered list:
(1) When selecting a link from the source document, a link card will be shown
(2) The card will include as the main piece of information the corresponding article on the target wiki

Maybe I'm misunderstanding this list, but if the link is selected in the source column shouldn't it show the article in the source wiki?

In CX1 we had two different cards for each version (source and target) of the link. In CX2 we are using just one card/inspector. There we plan to show more prominently the target version of the link since that is the one you want to act on (to add it to the translation), while keeping the source version f the link also accessible. This focuses the tool more on the adaptation process (i.e., transferring to the translation) than purely inspecting the source (although it is still possible). I think it provides a good balance, but we'll observe if this creates some kind of confusion with users.

@Pginer-WMF, @Amire80
To answer the previous comments: The link card presents both links (from a source and a target wikis correctly). The title is a matching link from the source wiki and at the bottom is the link from the source.

Screen Shot 2019-03-06 at 4.32.53 PM.png (222×431 px, 19 KB)

When clicked the links open in a different tab allowing a user to see what articles the links referred to.

The decision needs to be made if we want to add action to those link cards (as it was stated in the specs).
(1) It's possible to inspect the link in a target wiki (the screenshots are en->ca:Cupcake article:

The link exists in a target wiki - the matching link is shown:

Screen Shot 2019-03-06 at 4.15.40 PM.png (429×1 px, 118 KB)

'View' button is not functioning - T217454: [wmf.20-regression] CX2: Link card: "View" button does not open link inspector - with some patches in progress.

The link does not exist in a target wiki:

Screen Shot 2019-03-06 at 4.22.22 PM.png (279×1 px, 89 KB)

(2) The action - to add a link (or 'Add as missing`) to is not present.

The decision needs to be made if we want to add action to those link cards (as it was stated in the specs).

Yes, we do. I'm moving the ticket back to the priority backlog for the remaining parts to be completed. Thanks for checking, @Etonkovidova

Yes, we do. I'm moving the ticket back to the priority backlog for the remaining parts to be completed. Thanks for checking, @Etonkovidova

@Pginer-WMF Can you please list the remaining parts here or preferably in new tickets? It is not clear what exactly are the remaining parts here and their specification.

Yes, we do. I'm moving the ticket back to the priority backlog for the remaining parts to be completed. Thanks for checking, @Etonkovidova

@Pginer-WMF Can you please list the remaining parts here or preferably in new tickets? It is not clear what exactly are the remaining parts here and their specification.

I created a new ticket focused on the "add" action for the card: T222775: CX2: Allow adding a link to the translation from the source link card

Pginer-WMF claimed this task.
Pginer-WMF updated the task description. (Show Details)