Page MenuHomePhabricator

On the file page change localized namespace to target wiki namespace names
Closed, ResolvedPublic3 Estimated Story Points

Description

Motivation
When I import a file from dewiki to Wikimedia Commons, German namespace prefixes in links on the file page aren't translated to English. This means that the links in exported files turn to redlinks. Examples:

  • Benutzer: should be User:. Urheber=[[Benutzer:Bjs]] should be Author=[[User:Bjs]]
  • Datei: should be File:. Quelle=[[:Datei:xyp.jpg]]should be Source=[[:File:xyp.jpg]].
  • Kategorie: should be Category:. Changing [[Kategorie:Datei:Ansbach]] to [[Category:Ansbach]] on Commons would already work, as do most names of places. And even if categories don't exist, changing the link to Category:means that Commons recognizes the link as a category, and it can be changed with HotCat.

Acceptance Criteria

  • On the most recent file page, all namespace names are recognized as such, e.g. coming as "Kategorie:...", the text is recognized as being the category namespace with the target wiki's namespace label.
  • This should not break any links, especially in relation to T198584: Update wikilinks to point back to source project

Notes
The mapping will happen through canonical namespaces

Source of this request: https://de.wikipedia.org/wiki/Wikipedia_Diskussion:Technische_Wünsche/Topwünsche/Verschieben_von_Dateien_nach_Commons#Weitere_Ersetzungswünsche

Event Timeline

WMDE-Fisch renamed this task from On the file page, change localized terms in links to English, e.g. Datei: to File: to On the file page change localized namespace to canonical namespace names .Mar 26 2019, 2:24 PM
Lea_WMDE triaged this task as Medium priority.Mar 26 2019, 2:29 PM
Lea_WMDE updated the task description. (Show Details)
Lea_WMDE updated the task description. (Show Details)
Lea_WMDE renamed this task from On the file page change localized namespace to canonical namespace names to On the file page change localized namespace to target wiki namespace names .Mar 26 2019, 2:36 PM
Lea_WMDE updated the task description. (Show Details)
Lea_WMDE set the point value for this task to 13.

Change 507971 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/FileImporter@master] Introduce WikiLinkParser

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

Change 507973 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/FileImporter@master] Introduce WikiLinkCleaner interface in favor of callables

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

FYI: I started a framework for this as well as T198584, utilizing the visitor pattern. The idea is to have two classes that implement WikiLinkCleaner, one for each task.

Change 507971 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Introduce WikiLinkParser

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

Change 507973 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Introduce WikiLinkCleaner to be used instead of callables

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

Change 508611 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/FileImporter@master] Introduce NamespaceUnlocalizer

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

Change 508611 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Introduce NamespaceUnlocalizer

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

thiemowmde changed the point value for this task from 13 to 3.May 15 2019, 2:07 PM

Change 510589 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/FileImporter@master] Move license checks and wikitext cleanup to ImportPlanValidator

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

Change 510589 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Move license checks and wikitext cleanup to ImportPlanValidator

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

Change 509345 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/FileImporter@master] Introduce WikiLinkParserFactory to process wikitext links

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

It looks like all patches are merged now?

Change 509345 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Introduce WikiLinkParserFactory to process wikitext links

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

Lea_WMDE moved this task from Demo to Done on the WMDE-QWERTY-Sprint-2019-05-15 board.