Digging into a typical skin and seeing an innocent-looking call to $this->msg() leads to a rather unexpected alternate call graph.
- class VectorTemplate extends BaseTemplate: Calls $this->msg()
- BaseTemplate::msg calls BaseTemplate::getMsg
- BaseTemplate::getMsg calls $this->getSkin()->msg()
- BaseTemplate::msg calls BaseTemplate::getMsg
This looks quite reasonable. But BaseTemplate::msg is actually an override of the parent class QuickTemplate for which the implementation is different, involving a seemingly unused and ancient class called MediaWikiI18N.
- QuickTemplate constructs MediaWikiI18N and stores as $this->translator
- QuickTemplate::msg calls $this->translator->translate
- MediaWikiI18N::translate performs preg_replace on the value, and then calls wfMessage(), then performs a while loop to perform $N replacements based on a locally stored data set.
- Along the way, it mentions various things about PHPTAL, which it was used for to migrate from, in 2004.
It'd be good to figure out the plan to remove this ancient wrapper class. It seems QuickTemplate already has its own getSkin, so it seems like the easiest way would be to move msg() from BaseTemplate to QuickTemplate.
On the other hand, their signatures are not at all compatible, so a better way would be perhaps to remove it from QuickTemplate without replacement. And require any existing callers to either call wfMessage directly, or extend BaseTemplate instead to use msg().
All skins currently deployed at Wikimedia use BaseTemplate and not the underlying QuickTemplate. But, codesearch reveals a few uses still:
- Challenge: ChallengeUserTemplate
- Collection: CollectionFailedTemplate, CollectionFinishedTemplate, ..
- EditAccount: EditAccountCloseAccountTemplate, EditAccountDisplayUserTemplate, ..
- MediaWikiChat: SpecialChatTemplate
- PollNY: CreatePollTemplate
- SpamRegex: SpamRegexUITemplate
- TopLists: TopListEditorUITemplate, ..
- Blackout (skin): SopaStrikeTemplate, StopSopaTemplate: 21c60791d98452fa2385662ac948e754f89b371b
- DumpHTML (skin): SkinOfflineTemplate
- MinervaNeue (skin): phpunit/test (doesn't use localisation methods)
Looks like almost all of these are actually not skin templates, but fragments for pieces used by extension output. These should probably be converted to Mustache HTML templates instead.