Page MenuHomePhabricator

ContentTranslation adds duplicate 'Category:' prefix
Closed, ResolvedPublic2 Estimated Story Points

Description

Event Timeline

Does it happen for categories transferred from the source article, for categories added by the user, or for both?

Does it happen for categories transferred from the source article, for categories added by the user, or for both?

Categories added by the user. Let me check for other examples to confirmed about transferred categories.

Does it happen for categories transferred from the source article, for categories added by the user, or for both?

Categories added by the user. Let me check for other examples to confirmed about transferred categories.

It seems only happening with categories added by the user.

I haven't experienced it myself, but another user told me yesterday about a bug just like this one. I thought that perhaps it's just one user mistake, but seeing this I guess that it isn't. Look at the end of this revision.

KartikMistry renamed this task from ContentTranslation adding duplicate 'Category:' prefix to ContentTranslation adds duplicate 'Category:' prefix.Oct 12 2020, 2:02 PM
KartikMistry updated the task description. (Show Details)
KartikMistry updated the task description. (Show Details)
KartikMistry added a subscriber: He7d3r.

Still happening: https://pt.wikipedia.org/wiki/Simetria_de_reflex%C3%A3o?diff=59627837#footer

I haven't experienced it myself, but another user told me yesterday about a bug just like this one. I thought that perhaps it's just one user mistake, but seeing this I guess that it isn't. Look at the end of this revision.

Since the two categories in the English source of the example above didn't exist in Portuguese, I had to type them myself (and I didn't type any namespace prefix). When I published the article, both 'en' and 'pt' namespaces were added.

Pginer-WMF raised the priority of this task from Medium to High.Oct 1 2021, 12:49 PM
Pginer-WMF lowered the priority of this task from High to Medium.Oct 1 2021, 12:52 PM
Nikerabbit set the point value for this task to 2.Feb 9 2022, 2:13 PM

I have difficulty in reproducing this issue. This is what I tried.

  • Translated an article from en to ca. Article did not had any auto adapted categories. I chose one from category selector. And then I typed a new category that does not exist and not provided by selector(Myowncategory)

image.png (103×316 px, 9 KB)

  • Published the article. Checked the API request to see what are the categories being send to server. They are categories without prefixes(Expected behavior)

image.png (221×418 px, 34 KB)

  • Checked the wikitext of published article. It had [[Categoria:1960 a Catalunya]][[Categoria:Myowncategory]] as expected.

Can somebody help me with steps to reproduce the issue? Also any idea whether this issue happens now? In 2020 July we had added checks to make sure prefixes are removed before publishing T242613: User-provided categories added to the translation are ignored when published

santhosh changed the task status from Open to In Progress.Mar 9 2022, 5:40 AM
santhosh claimed this task.

I tested with article (સુમંત મહેતા) in Gujarati Wikipedia by adding user added category and couldn't reproduce this bug.

Did you try adding categories, saving draft, then restoring draft, before publishing?

Did you try adding categories, saving draft, then restoring draft, before publishing?

I think the reason behind this questions is to evaluate if the database has prefixes(category names saved wrongly - probably in old drafts) and see what happens now?

I would recommend closing this for now as this issue was last reported in october 2020 and open only if we have evidence that the issue happens now.

Did you try adding categories, saving draft, then restoring draft, before publishing?

I tried this process and resulted in duplicate category labels.

I tried the translation of Paneer Tikka Masala from English to Spanish, adding the "Queso" and "Gastronomía" categories, leaving the editor and continuing later the translation to publish it as personal draft.
This is the published article. Note that the duplication of the category prefix only occurs in the added categories added by the user ("Queso" and "Gastronomía").

In Content TranslationPublished
es.wikipedia.org_w_index.php_title=Especial_Traducci%C3%B3n_de_contenidos&from=en&to=es&page=Paneer+tikka+masala&targettitle=Paneer+tikka+masala(iPad Air).png (1×2 px, 310 KB)
es.wikipedia.org_wiki_Usuario_Pginer-WMF_Paneer_tikka_masala(iPad Air).png (1×2 px, 566 KB)

Change 777792 had a related patch set uploaded (by Santhosh; author: Santhosh):

[mediawiki/extensions/ContentTranslation@master] Avoid duplicate Category prefixes in published Translation

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

Change 777792 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] Avoid duplicate Category prefixes in published Translation

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

Test plan:

In the desktop mode, navigate to Special:CX page in any wiki.

  1. Start a translation from any language to another language.
  2. When the article is loaded, do some translation for some sections, Note the categories adapated at the bottom of the target article column.
  3. Add a few more categories there.
  4. Save the article(just wait for autosave to happen)
  5. Go to dashboard(or just refresh the browser page)
  6. Observe the custom categories added restored
  7. Publish the article(Try to do this to user namespace to avoid disruptions in main namespace of production content)
  8. Observe the categories added in the newly created articles- There should not be any duplicate category prefixes as mentioned in the ticket

@santhosh Much appreciate the detailed description.

Tested and working as expected. The prefix "Category" does not show up when trying to publish a translation after creating a category and saving.