Mention translatewiki.net on edits only, when edit a default message
authorumherirrender <umherirrender_de.wp@web.de>
Mon, 6 Oct 2014 19:04:25 +0000 (21:04 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Sat, 11 Oct 2014 19:14:43 +0000 (21:14 +0200)
When editing a page in the mediawiki namespace the hint to
translatewiki.net is always shown, but it is unneeded, when the message
is not a default message and maybe used for warnings in abusefilter or
is a gadget description.

Change-Id: I7dbf030311e30ce852459e363c91e988ca15d86d

includes/EditPage.php
languages/i18n/en.json
languages/i18n/qqq.json

index a423f26..c5ef534 100644 (file)
@@ -2106,6 +2106,17 @@ class EditPage {
                if ( $namespace == NS_MEDIAWIKI ) {
                        # Show a warning if editing an interface message
                        $wgOut->wrapWikiMsg( "<div class='mw-editinginterface'>\n$1\n</div>", 'editinginterface' );
+                       # If this is a default message (but not css or js),
+                       # show a hint that it is translatable on translatewiki.net
+                       if ( !$this->mTitle->hasContentModel( CONTENT_MODEL_CSS )
+                               && !$this->mTitle->hasContentModel( CONTENT_MODEL_JAVASCRIPT )
+                       ) {
+                               $defaultMessageText = $this->mTitle->getDefaultMessageText();
+                               if ( $defaultMessageText !== false ) {
+                                       $wgOut->wrapWikiMsg( "<div class='mw-translateinterface'>\n$1\n</div>",
+                                               'translateinterface' );
+                               }
+                       }
                } elseif ( $namespace == NS_FILE ) {
                        # Show a hint to shared repo
                        $file = wfFindFile( $this->mTitle );
index fc47178..b8ea455 100644 (file)
        "viewsourcetext": "You can view and copy the source of this page:",
        "viewyourtext": "You can view and copy the source of <strong>your edits</strong> to this page:",
        "protectedinterface": "This page provides interface text for the software on this wiki, and is protected to prevent abuse.\nTo add or change translations for all wikis, please use [//translatewiki.net/ translatewiki.net], the MediaWiki localisation project.",
-       "editinginterface": "<strong>Warning:</strong> You are editing a page that is used to provide interface text for the software.\nChanges to this page will affect the appearance of the user interface for other users on this wiki.\nTo add or change translations for all wikis, please use [//translatewiki.net/ translatewiki.net], the MediaWiki localisation project.",
+       "editinginterface": "<strong>Warning:</strong> You are editing a page that is used to provide interface text for the software.\nChanges to this page will affect the appearance of the user interface for other users on this wiki.",
+       "translateinterface": "To add or change translations for all wikis, please use [//translatewiki.net/ translatewiki.net], the MediaWiki localisation project.",
        "cascadeprotected": "This page has been protected from editing because it is included in the following {{PLURAL:$1|page, which is|pages, which are}} protected with the \"cascading\" option turned on:\n$2",
        "namespaceprotected": "You do not have permission to edit pages in the <strong>$1</strong> namespace.",
        "customcssprotected": "You do not have permission to edit this CSS page because it contains another user's personal settings.",
index c50a02f..49d4201 100644 (file)
        "viewyourtext": "Same as {{msg-mw|viewsourcetext}} but when showing the text submitted by the user, this happens e.g. when the user was blocked while he is editing the page",
        "protectedinterface": "Message shown if a user without the \"editinterface\" right tries to edit a page in the MediaWiki namespace.\n\nSee also {{msg-mw|editinginterface}}. Parameters:\n* $1 - (Unused) the action the user attempted to perform",
        "editinginterface": "A message shown when editing pages in the namespace MediaWiki:.\n\nSee also {{msg-mw|protectedinterface}}.",
+       "translateinterface": "A message shown when editing pages in the namespace MediaWiki:, which have a default message text.\n\nSee also {{msg-mw|protectedinterface}}, {{msg-mw|editinginterface}}.",
        "cascadeprotected": "Parameters:\n* $1 - number of cascade-protected pages, used for PLURAL\n* $2 - list of cascade-protected pages\n* $3 - (Unused) the action the user attempted to perform",
        "namespaceprotected": "Parameters:\n* $1 - namespace name\n* $2 - (Unused) the action the user attempted to perform",
        "customcssprotected": "Used as error message. Parameters:\n* $1 - (Unused) the action the user attempted to perform",