Page MenuHomePhabricator

CX2: Support users to adjust category mapping
Closed, ResolvedPublic

Description

As part of the support for categories (T188605), Content translation allows users to adjust the initial mapping of the categories that is done automatically (T177303).

CX-cat-initial.png (656×1 px, 98 KB)

In order to adjust such mapping the following is needed:

  • Show the list of categories for the source and target article next to each other. Categories are represented as a list of tags (as the ones used in the Recent changes page).
  • Categories in the translation will have an "X" icon that would remove them.
  • Categories on the source article for which there is not an equivalent in the target wiki will be rendered as disables.
  • Clicking on a category from the source article will add it to the translation list if it was not there before.
  • When hovering a category, the equivalent one will be also highlighted as illustrated below.

CX-cat-initial Copy.png (168×732 px, 16 KB)


Note that the "Add categories" input on the translation panel can be ignored for the current ticket, since adding additional categories is supported in a separate ticket (T188615).

Event Timeline

Pginer-WMF triaged this task as Medium priority.Mar 1 2018, 12:26 PM
Pginer-WMF created this task.

Change 419081 had a related patch set uploaded (by Petar.petkovic; owner: Petar.petkovic):
[mediawiki/extensions/ContentTranslation@master] Add category mapping support

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

Changes done in https://gerrit.wikimedia.org/r/419081

image.png (165×1 px, 21 KB)

Remaining:

  • Need styling as per the ticket.
  • Hightlighting the pairs on hover
  • A heading for the category listing, which will have the tag icon
  • Categories are the last item in the column, but since they don't have equal height, the background color differs. And as per design in this ticket, insead of white background is light gray and has a border
  • If the target category has one autoadapted item, the category count lable at top of the target column shows 'one category'. But when we add or remove items to the target category list, that label is not updated.

I think we need to change the behavior of mw.cx.ui.Categories. Instead of accepting the categories list as constructor, let this class act as a ui component, exposing a public method to add category list after initialization. Any addition, deletion to the category listing of this instance at any point in the lifecycle of instance will update the UI elements. That means, count label get automatically updated. This also means, we can start painting the containers for the UI early if needed. Also, this will make the restoring categories ( T188238: Adapted categories are not saved along with translation ) feature easy.

Thank you @santhosh for creating the list of things that are still to be done. Most of the things listed were in my plans for future patches.
I will remind that this ticket has clear scope. Some of items listed in comment above require separate tickets to be created.

  • Need styling as per the ticket.

This requires separate ticket. I don't think this ticket specifies design, there is only one screenshot from mockup to illustrate idea. Design details should be created in separate ticket. @Pginer-WMF, can you provide ticket with design specifics around categories UI?

  • Hightlighting the pairs on hover

I have added highlighting support in my latest patch set.

  • A heading for the category listing, which will have the tag icon

I will do this when implementing eventual designs.

  • Categories are the last item in the column, but since they don't have equal height, the background color differs. And as per design in this ticket, insead of white background is light gray and has a border

I have created ticket to track this issue - T189632.

  • If the target category has one autoadapted item, the category count lable at top of the target column shows 'one category'. But when we add or remove items to the target category list, that label is not updated.

Number of target categories label is getting updated after my latest patchset.

I think we need to change the behavior of mw.cx.ui.Categories. Instead of accepting the categories list as constructor, let this class act as a ui component, exposing a public method to add category list after initialization. Any addition, deletion to the category listing of this instance at any point in the lifecycle of instance will update the UI elements. That means, count label get automatically updated. This also means, we can start painting the containers for the UI early if needed. Also, this will make the restoring categories ( T188238: Adapted categories are not saved along with translation ) feature easy.

Making mw.cx.ui.Categories into UI component is exactly what I wanted to do and was keeping that for future patches. But, in efforts to add highlight support and cover all requirements listed in this ticket with one patch, I have done that sooner.

Change 419081 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@master] Add category mapping support

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

Etonkovidova subscribed.

Checked in cx2-testing - all specs (except those addressed in separate tickets) are in place:

(1) no matching categories

Screen Shot 2018-03-20 at 2.38.37 PM.png (127×981 px, 29 KB)

(2) one category is not present for a translated article

Screen Shot 2018-03-20 at 2.42.08 PM.png (306×995 px, 39 KB)

(3) categories are in different namespaces

Screen Shot 2018-03-20 at 2.48.55 PM.png (135×938 px, 21 KB)

(4) no categories

Screen Shot 2018-03-20 at 2.48.03 PM.png (121×1 px, 17 KB)