mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-13 17:48:17 +00:00
VisualEditorDataModule: Generate definition summary without parsing wikitext
Adapted from code in DiscussionTools. Bug: T189229 Change-Id: I206bb05d28d492d6ba2dd9d29cdbe94323d6bad9
This commit is contained in:
parent
8080bd2f5d
commit
ec59e2ed42
|
@ -37,6 +37,30 @@ class VisualEditorDataModule extends ResourceLoaderModule {
|
|||
) . ');';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the definition summary for this module.
|
||||
*
|
||||
* @param ResourceLoaderContext $context
|
||||
* @return array
|
||||
*/
|
||||
public function getDefinitionSummary( ResourceLoaderContext $context ) {
|
||||
$summary = parent::getDefinitionSummary( $context );
|
||||
|
||||
$msgVersion = [];
|
||||
$msgInfo = $this->getMessageInfo( $context );
|
||||
$msgInfo = array_merge( $msgInfo['parse'], $msgInfo['plain'] );
|
||||
foreach ( $msgInfo as $msgKey => $msgObj ) {
|
||||
$msgVersion[ $msgKey ] = [
|
||||
// Include the text of the message, in case the canonical translation changes
|
||||
$msgObj->plain(),
|
||||
// Include the page touched time, in case the on-wiki override is invalidated
|
||||
Title::makeTitle( NS_MEDIAWIKI, ucfirst( $msgObj->getKey() ) )->getTouched(),
|
||||
];
|
||||
}
|
||||
$summary[] = [ 've-messages' => $msgVersion ];
|
||||
return $summary;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ResourceLoaderContext $context Object containing information about the state of this
|
||||
* specific loader request.
|
||||
|
|
Loading…
Reference in a new issue