diff --git a/VisualEditorMessagesModule.php b/VisualEditorMessagesModule.php
index 2becf1656d..30750b6afb 100644
--- a/VisualEditorMessagesModule.php
+++ b/VisualEditorMessagesModule.php
@@ -20,18 +20,61 @@ class VisualEditorMessagesModule extends ResourceLoaderModule {
/* Methods */
public function getScript( ResourceLoaderContext $context ) {
+ $msgInfo = $this->getMessageInfo();
$parsedMesssages = array();
- foreach ( $this->getMessages() as $msgKey ) {
- $parsedMesssages[$msgKey] = wfMessage( $msgKey )->parse();
+ foreach ( $msgInfo['args'] as $msgKey => $msgArgs ) {
+ $parsedMesssages[ $msgKey ] = call_user_func_array( 'wfMessage', $msgArgs )
+ ->inLanguage( $context->getLanguage() )
+ ->parse();
}
return 've.init.platform.addParsedMessages(' . FormatJson::encode( $parsedMesssages ) . ');';
}
+ protected function getMessageInfo() {
+ $msgKeys = array();
+
+ // Simple ones
+ $msgArgs = array(
+ 'minoredit' => array( 'minoredit' ),
+ 'watchthis' => array( 'watchthis' ),
+ );
+
+ // Copyright warning (based on EditPage::getCopyrightWarning)
+ global $wgRightsText;
+ if ( $wgRightsText ) {
+ $copywarnMsg = array( 'copyrightwarning',
+ '[[' . wfMessage( 'copyrightpage' )->inContentLanguage()->text() . ']]',
+ $wgRightsText );
+ } else {
+ $copywarnMsg = array( 'copyrightwarning2',
+ '[[' . wfMessage( 'copyrightpage' )->inContentLanguage()->text() . ']]' );
+ }
+ // EditPage supports customisation based on title, we can't support that here
+ // since these messages are cached on a site-level. $wgTitle is likely set to null.
+ $title = Title::newFromText( 'Dwimmerlaik' );
+ wfRunHooks( 'EditPageCopyrightWarning', array( $title, &$copywarnMsg ) );
+
+ // Keys used in copyright warning
+ $msgKeys[] = 'copyrightpage';
+ $msgKeys[] = $copywarnMsg[0];
+ // Normalise to 'copyrightwarning' so we have a consistent key in the front-end.
+ $msgArgs[ 'copyrightwarning' ] = $copywarnMsg;
+
+ $msgKeys = array_values( array_unique( array_merge( $msgKeys, array_keys( $msgArgs ) ) ) );
+
+ return array(
+ 'keys' => $msgKeys,
+ 'args' => $msgArgs,
+ );
+ }
+
public function getMessages() {
- // We don't actually enable the client-side message system for these messages.
- // But registering them in this standardised method to make use of the getMsgBlobMtime
- // utility for make cache invalidation work out-of-the-box.
- return array( 'minoredit', 'watchthis' );
+ // We don't actually use the client-side message system for these messages.
+ // But we're registering them in this standardised method to make use of the
+ // getMsgBlobMtime utility to make cache invalidation work out-of-the-box.
+
+ $msgInfo = $this->getMessageInfo();
+ return $msgInfo['keys'];
}
public function getDependencies() {
diff --git a/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js b/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js
index d0cd6cb52f..95ffd5974f 100644
--- a/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js
+++ b/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js
@@ -835,17 +835,7 @@ ve.init.mw.ViewPageTarget.prototype.setupSaveDialog = function () {
.text( ve.msg( viewPage.restoring ? 'visualeditor-restore-page' : 'savearticle' ) )
.end()
.find( '.ve-init-mw-viewPageTarget-saveDialog-license' )
- // FIXME license text is hardcoded English
- .html(
- 'By editing this page, you agree to irrevocably release your \
- contributions under the CC-BY-SA 3.0 License. If you don\'t want your \
- writing to be edited mercilessly and redistrubuted at will, then \
- don\'t submit it here.
You are also confirming that you \
- wrote this yourself, or copied it from a public domain or similar free \
- resource. See Project:Copyright for full details of the licenses \
- used on this site.\
- DO NOT SUBMIT COPYRIGHTED WORK WITHOUT PERMISSION!'
- );
+ .html( ve.init.platform.getParsedMessage( 'copyrightwarning' ) );
viewPage.$saveDialogSaveButton = viewPage.$saveDialog
.find( '.ve-init-mw-viewPageTarget-saveDialog-saveButton' );
viewPage.$saveDialogLoadingIcon = viewPage.$saveDialog