Page MenuHomePhabricator

Add language templates when requested via `@` syntax in the configuration
Closed, ResolvedPublic2 Estimated Story Points

Description

Example:

  • The configuration says ;Information:Information|@Description=Beschreibung
  • The source wikitext contains {{Information|Beschreibung=Beispiel}}
  • The result should be {{Information|Description={{de|Beispiel}}}}
  • The language should match the default content language of the source wiki. Ideally, this value is already somewhere in the API request already made. For an MVP it might be enough to simply use the third-level domain, e.g. de.wikipedia.org becomes {{de|…}}.

Acceptance Criteria
In the transfer section of the config files

  • if a parameter is preceded by an @ sign, wikitext will be changed so that the contents of the parameter is marked as being in the language the file is from (see example :) )

Notes
Possible follow-up tasks:

  • Make sure the target wiki actually contains a template with the language code. E.g. {{de|…}} should only be used if commons.wikimedia.org/wiki/Template:de actually exists. (Can be a redirect.) If one doesn't exist, don't fall back to {{en|…}}, but don't insert any language template.

Where this request was mentioned
https://www.mediawiki.org/wiki/Topic:Uu69id3hhb5tqqiy

Related Objects

Event Timeline

Lea_WMDE triaged this task as Medium priority.May 10 2019, 12:33 PM
Lea_WMDE updated the task description. (Show Details)
thiemowmde added a project: WMDE-TechWish.
thiemowmde added a subscriber: awight.

The biggest question I have here is if it's ok to hard-code these Commons-specific template names in the extensions code? Maybe it is. If so, should we just assume all language codes do exist as a template with the exact same name? This would safe us a huge list of almost 400 template names.

TL;DR: I propose to assume the language code from the source wiki can be used as a template name. If possibly, we can check if such a template exists, and skip the step in case it doesn't. The language code can be obtained with core's SiteLookup.

thiemowmde set the point value for this task to 5.May 15 2019, 2:08 PM

Change 511933 had a related patch set uploaded (by Andrew-WMDE; owner: Andrew-WMDE):
[mediawiki/extensions/FileImporter@master] [WIP] Add language templates when requested via @ syntax in the configuration

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

WMDE-Fisch changed the point value for this task from 5 to 2.

Change 511933 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Add language templates when requested via @ syntax in the configuration

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

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

Change 514453 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/FileImporter@master] Improve test coverage for ImportPlanValidator::cleanWikitext()

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

Change 514453 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Improve test coverage for ImportPlanValidator::cleanWikitext()

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