Unicornisaurous has uploaded a new change for review.

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

Change subject: Convert API module to use i18n help/documentation.
......................................................................

Convert API module to use i18n help/documentation.

MediaWiki core change I04b1a384 added support for i18n of API module
help. This takes advantage of that while still maintaining backwards
compatibility with earlier versions of MediaWiki.

Once support for MediaWiki before 1.25 is dropped, the methods marked
deprecated in this patch may be removed.

Bug: T76895
Change-Id: If26fcf289e2e446ee40713c72a34b0192e051cd2
---
M Example/api/ApiQueryExample.php
M Example/i18n/en.json
M Example/i18n/qqq.json
3 files changed, 28 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/examples 
refs/changes/85/180885/1

diff --git a/Example/api/ApiQueryExample.php b/Example/api/ApiQueryExample.php
index 5c4a634..43f6298 100644
--- a/Example/api/ApiQueryExample.php
+++ b/Example/api/ApiQueryExample.php
@@ -50,16 +50,25 @@
                );
        }
 
+       /**
+        * @deprecated since MediaWiki core 1.25
+        */
        public function getParamDescription() {
                return array(
                        'key' => 'Reduce the result to only one of the foo 
properties.',
                );
        }
 
+       /**
+        * @deprecated since MediaWiki core 1.25
+        */
        public function getDescription() {
                return 'Get information about foo';
        }
 
+       /**
+        * @deprecated since MediaWiki core 1.25
+        */
        protected function getExamples() {
                return array(
                        'api.php?action=query&list=example',
@@ -67,6 +76,15 @@
                );
        }
 
+       protected function getExamplesMessages() {
+               return array(
+                       'api.php?action=query&list=example'
+                               => 'apihelp-query+example-example-1',
+                       'api.php?action=query&list=example&key=do'
+                               => 'apihelp-query+example-example-2',
+               );
+       }
+
        public function getVersion() {
                return __CLASS__ . ': $Id$';
        }
diff --git a/Example/i18n/en.json b/Example/i18n/en.json
index ee9710c..e4d8022 100644
--- a/Example/i18n/en.json
+++ b/Example/i18n/en.json
@@ -8,5 +8,9 @@
     "example-welcome-color-label": "Today's color:",
     "example-welcome-color-value": "$1",
     "example-helloworld": "Bar",
-    "example-helloworld-intro": "This is the HelloWorld special page, as 
provided by the Example extension."
+    "example-helloworld-intro": "This is the HelloWorld special page, as 
provided by the Example extension.",
+    "apihelp-query+example-description": "Get information about foo.",
+    "apihelp-query+example-param-key": "Reduce the result to only one of the 
foo properties.",
+    "apihelp-query+example-example-1": "Get all the information about foo.",
+    "apihelp-query+example-example-2": "Get only information for the key 
\"do\""
 }
diff --git a/Example/i18n/qqq.json b/Example/i18n/qqq.json
index f29d842..e2cc6d9 100644
--- a/Example/i18n/qqq.json
+++ b/Example/i18n/qqq.json
@@ -6,5 +6,9 @@
     "example-welcome-title-user": "Title of the Welcome interface for 
logged-in users. $1 is the username.",
     "example-welcome-title-loggedout": "Title of the Welcome interface 
logged-out users.",
     "example-helloworld": "Title of Special:HelloWorld.",
-    "example-helloworld-intro": "Intro paragraph shown on Special:HelloWorld."
+    "example-helloworld-intro": "Intro paragraph shown on Special:HelloWorld.",
+    "apihelp-query+example-description": 
"{{doc-apihelp-description|query+example}}",
+    "apihelp-query+example-param-key": 
"{{doc-apihelp-param|query+example|key}}",
+    "apihelp-query+example-example-1": "{{doc-apihelp-example|query+example}}",
+    "apihelp-query+example-example-2": "{{doc-apihelp-example|query+example}}"
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If26fcf289e2e446ee40713c72a34b0192e051cd2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/examples
Gerrit-Branch: master
Gerrit-Owner: Unicornisaurous <[email protected]>

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

Reply via email to