Page MenuHomePhabricator

Add overwritable alternatives for the autoname message keys
Closed, ResolvedPublic

Description

Context

The basic support for auto-generating reference names uses existing i18n messages from the UI labels of references or citation template types. Users might want to have different text for these labels or title than for the auto-name.

Solution

We want to implement to option that users on their projects can set explicit messages for these keys that might then differ. These keys would get a -autoname suffix.

  • If we're dealing with the default fallback check if there's cite-ve-dialogbutton-reference-title-autoname set otherwise use the key without suffix
  • If we're dealing the citation types check the corresponding -autoname key exists otherwise use the one without suffix
  • We probably need to check / load the content of these keys already in PHP because we can not per-define them in the extension.json - See for example MWCitationToolsDefinition.php
Notes

In T431544: Use translatable citation type name to generated autonames instead of :n we now add a - between the default message and the numbers. Here we're not adding the - so communities can decide against it.

How to test this patch locally

Enable $wgCiteCitationTypeAutoNames = true; in LocalSettings.php.

Default: basic refs → Reference-n, citation-type refs (e.g. Book) → Book-n.

To override a citation type's autoname:
Create a page, for example for book refs
http://dev.wiki.local.wmftest.net:8080/wiki/MediaWiki:Visualeditor-cite-tool-name-Book-autoname,
set content e.g. BuchOverride → Book refs become BuchOverride-n.

To override the generic fallback (basic refs):
Create http://dev.wiki.local.wmftest.net:8080/wiki/MediaWiki:Cite-ve-dialogbutton-reference-title-autoname,
set content e.g. Quelle → basic refs become Quelle-n.

  • Tests

Event Timeline

Change #1327542 had a related patch set uploaded (by Mareike Heuer; author: Mareike Heuer):

[mediawiki/extensions/Cite@master] Add overwritable autoname message key for reference autonaming

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

Change #1327542 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Add overwritable autoname message key for reference autonaming

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

Change #1333207 had a related patch set uploaded (by WMDE-Fisch; author: WMDE-Fisch):

[mediawiki/extensions/Cite@master] Adding a QUnit test for the default autoname override

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

Change #1333207 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Adding a QUnit test for the default autoname override

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

Tobi_WMDE_SW claimed this task.