KartikMistry has uploaded a new change for review.

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


Change subject: Show error message when user is not logged in
......................................................................

Show error message when user is not logged in

Change-Id: If513185ab518925248881aad1ea5ad415b286826
---
M i18n/en.json
M i18n/qqq.json
M specials/SpecialContentTranslation.php
3 files changed, 20 insertions(+), 10 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/58/108058/1

diff --git a/i18n/en.json b/i18n/en.json
index 7d62a50..f60d8ce 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -13,6 +13,7 @@
     "cx-publish-page-error": "Error while saving page.",
     "cx-publish-button": "Publish translation",
     "cx-source-loading": "Loading $1",
+    "cx-special-login-error": "You must be logged in to translate in this 
page.",
     "cx-tools-instructions-title": "Create a translation",
     "cx-tools-instructions-text1": "Add some paragraphs to the translation.",
     "cx-tools-instructions-text2": "Adjust the automatic translations provided 
to ensure quality",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 856c975..8b2e2f8 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -14,10 +14,11 @@
     "cx-publish-page-error": "Error message to display when page saving 
fails.",
     "cx-publish-button": "Publish button text in 
[[Special:ContentTranslation]].",
     "cx-source-loading": "Status text shown in the source article pane while 
article is being loaded.\n\nParameters:\n* $1 - the title of the page being 
loaded",
+    "cx-special-login-error": "Error to show when user try to use 
[[Special:ContentTranslation]] without Log in.",
     "cx-tools-instructions-title": "Title for the translation aids pane.",
     "cx-tools-instructions-text1": "Help text for the translation aids pane.",
     "cx-tools-instructions-text2": "Help text for the translation aids pane.",
     "cx-tools-instructions-text3": "Help text for the translation aids pane.",
     "cx-tools-instructions-text4": "Help text for the translation aids pane.",
     "cx-tools-instructions-text5": "Help text for the translation aids pane."
-}
\ No newline at end of file
+}
diff --git a/specials/SpecialContentTranslation.php 
b/specials/SpecialContentTranslation.php
index 0307c84..0504e8b 100644
--- a/specials/SpecialContentTranslation.php
+++ b/specials/SpecialContentTranslation.php
@@ -23,16 +23,24 @@
 
        public function execute( $parameters ) {
                $out = $this->getOutput();
-               $out->addModules( 'ext.cx.base' );
                $skin = $this->getSkin();
-               $this->setHeaders();
-               $out->setArticleBodyOnly( true );
-               // Default modules copied from OutputPage::addDefaultModules
-               $out->addModules( array(
-                       'mediawiki.user',
-                       'mediawiki.page.startup',
-                       'mediawiki.page.ready',
-               ) );
+               $user = $this->getUser();
+
+               if ( !($user->isLoggedIn() ) ) {
+                       $out->addHTML( $this->msg('cx-special-login-error'));
+               }
+               else {
+                       $out->addModules( 'ext.cx.base' );
+                       $this->setHeaders();
+                       $out->setArticleBodyOnly( true );
+                       // Default modules copied from 
OutputPage::addDefaultModules
+                       $out->addModules( array(
+                               'mediawiki.user',
+                               'mediawiki.page.startup',
+                               'mediawiki.page.ready',
+                               'mediawiki.notify',
+                       ) );
+               }
 
                $out->addHTML( $out->headElement( $skin ) );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/108058
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If513185ab518925248881aad1ea5ad415b286826
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: KartikMistry <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to