Add i18n for API module help

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.

Change-Id: I67395aff48185f3e09da31b51a08aa2541fe6a17
This commit is contained in:
Brad Jorsch 2014-10-29 15:17:19 -04:00
parent e809a23868
commit 8c8c8bbe92
3 changed files with 53 additions and 24 deletions

View file

@ -90,6 +90,9 @@ class ApiQueryTitleBlacklist extends ApiBase {
); );
} }
/**
* @deprecated since MediaWiki core 1.25
*/
public function getParamDescription() { public function getParamDescription() {
return array( return array(
'title' => 'The string to validate against the blacklist', 'title' => 'The string to validate against the blacklist',
@ -98,10 +101,16 @@ class ApiQueryTitleBlacklist extends ApiBase {
); );
} }
/**
* @deprecated since MediaWiki core 1.25
*/
public function getDescription() { public function getDescription() {
return 'Validate an article title, filename, or username against the TitleBlacklist.'; return 'Validate an article title, filename, or username against the TitleBlacklist.';
} }
/**
* @deprecated since MediaWiki core 1.25
*/
public function getExamples() { public function getExamples() {
return array( return array(
'api.php?action=titleblacklist&tbtitle=Foo', 'api.php?action=titleblacklist&tbtitle=Foo',
@ -109,7 +118,15 @@ class ApiQueryTitleBlacklist extends ApiBase {
); );
} }
public function getVersion() { /**
return __CLASS__ . ': $Id$'; * @see ApiBase::getExamplesMessages()
*/
protected function getExamplesMessages() {
return array(
'action=titleblacklist&tbtitle=Foo'
=> 'apihelp-titleblacklist-example-1',
'action=titleblacklist&tbtitle=Bar&tbaction=edit'
=> 'apihelp-titleblacklist-example-2',
);
} }
} }

View file

@ -19,5 +19,11 @@
"titleblacklist-warning": "<strong>Warning: This page can only be edited by administrators and other users with the <code>tboverride</code> right because it matches the following title blacklist entry:</strong><br /><code>$1</code>", "titleblacklist-warning": "<strong>Warning: This page can only be edited by administrators and other users with the <code>tboverride</code> right because it matches the following title blacklist entry:</strong><br /><code>$1</code>",
"right-tboverride": "Override the title or username blacklist", "right-tboverride": "Override the title or username blacklist",
"right-tboverride-account": "Override the username blacklist", "right-tboverride-account": "Override the username blacklist",
"right-titleblacklistlog": "View title blacklist log" "right-titleblacklistlog": "View title blacklist log",
"apihelp-titleblacklist-description": "Validate an article title, filename, or username against the TitleBlacklist.",
"apihelp-titleblacklist-param-title": "The string to validate against the blacklist.",
"apihelp-titleblacklist-param-action": "The action to be checked.",
"apihelp-titleblacklist-param-nooverride": "Don't try to override the titleblacklist.",
"apihelp-titleblacklist-example-1": "Check whether [[Foo]] is blacklisted",
"apihelp-titleblacklist-example-2": "Check whetner [[Bar]] is blacklisted for editing"
} }

View file

@ -27,5 +27,11 @@
"titleblacklist-warning": "Displayed when a user is editing a page that only administrators (or custom user groups with the tboverride right) can edit due to the title blacklist. Parameters:\n* $1 - blacklist entry", "titleblacklist-warning": "Displayed when a user is editing a page that only administrators (or custom user groups with the tboverride right) can edit due to the title blacklist. Parameters:\n* $1 - blacklist entry",
"right-tboverride": "{{doc-right|tboverride}}", "right-tboverride": "{{doc-right|tboverride}}",
"right-tboverride-account": "{{doc-right|tboverride-account}}", "right-tboverride-account": "{{doc-right|tboverride-account}}",
"right-titleblacklistlog": "{{doc-right|titleblacklistlog}}" "right-titleblacklistlog": "{{doc-right|titleblacklistlog}}",
"apihelp-titleblacklist-description": "{{doc-apihelp-description|titleblacklist}}",
"apihelp-titleblacklist-param-title": "{{doc-apihelp-param|titleblacklist|title}}",
"apihelp-titleblacklist-param-action": "{{doc-apihelp-param|titleblacklist|action}}",
"apihelp-titleblacklist-param-nooverride": "{{doc-apihelp-param|titleblacklist|nooverride}}",
"apihelp-titleblacklist-example-1": "{{doc-apihelp-example|titleblacklist}}",
"apihelp-titleblacklist-example-2": "{{doc-apihelp-example|titleblacklist}}"
} }