mediawiki-extensions-Visual.../VisualEditorMessagesModule.php
Trevor Parscal 53e9258280 Added ve.init.platform with MediaWiki and stand-alone implementations
This should make it much simpler to keep MediaWiki specifics out of VisualEditor, which will in turn make it easier to integrate VisualEditor into another platform.

Change-Id: I073e9737b37c28af889f2457d10b082cefd0d63b
2012-07-27 13:39:19 -07:00

43 lines
1.1 KiB
PHP

<?php
/**
* Resource loader module for certain VisualEditor messages.
*
* @file
* @ingroup Extensions
* @copyright 2011-2012 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* Module for user preference customizations
*/
class VisualEditorMessagesModule extends ResourceLoaderModule {
/* Protected Members */
protected $modifiedTime = array();
protected $origin = self::ORIGIN_CORE_INDIVIDUAL;
/* Methods */
public function getScript( ResourceLoaderContext $context ) {
$messages = array(
'summary' => wfMessage( 'summary' )->parse(),
'minoredit' => wfMessage( 'minoredit' )->parse(),
'watchthis' => wfMessage( 'watchthis' )->parse(),
);
return 've.init.platform.addMessages(' . FormatJson::encode( $messages ) . ');';
}
public function getMessages() {
// We don't actually use the i18n on the client-side, but registering the messages
// is needed to make cache invalidation work
return array( 'summary', 'minoredit', 'watchthis' );
}
public function getDependencies() {
return array( 'ext.visualEditor.base' );
}
}