Page MenuHomePhabricator

Add language templates when requested via `@` syntax in the configuration
Closed, ResolvedPublic2 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

Details

Related Gerrit Patches:

Related Objects

Event Timeline

JStrodt_WMDE updated the task description. (Show Details)Feb 20 2019, 8:57 AM
4nn1l2 added a subscriber: 4nn1l2.Feb 20 2019, 8:59 AM
Lea_WMDE triaged this task as Medium priority.May 10 2019, 12:33 PM
Lea_WMDE updated the task description. (Show Details)
Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptMay 10 2019, 12:33 PM
thiemowmde added a project: WMDE-QWERTY-Team.
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

thiemowmde removed Andrew-WMDE as the assignee of this task.May 23 2019, 8:57 AM
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 closed this task as Resolved.Jun 3 2019, 9:28 AM
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