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() {
return array(
'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() {
return 'Validate an article title, filename, or username against the TitleBlacklist.';
}
/**
* @deprecated since MediaWiki core 1.25
*/
public function getExamples() {
return array(
'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

@ -1,23 +1,29 @@
{
"@metadata": {
"authors": []
},
"action-titleblacklistlog": "view the title blacklist log",
"log-name-titleblacklist": "Title blacklist log",
"log-description-titleblacklist": "These events track title blacklist hits.",
"logentry-titleblacklist-hit-username": "$1 {{GENDER:$2|caused}} a title blacklist hit when trying to create account $3 matching $4.",
"titleblacklist-desc": "Allows administrators to forbid creation of pages and user accounts per a [[MediaWiki:Titleblacklist|blacklist]] and [[MediaWiki:Titlewhitelist|whitelist]]",
"titleblacklist": "# This is a title blacklist. Titles and users that match a regular expression here cannot be created.\n# Use \"#\" for comments.\n# This is case insensitive by default",
"titlewhitelist": "# This is a title whitelist. Use \"#\" for comments.\n# This is case insensitive by default",
"titleblacklist-forbidden-edit": "The title \"$2\" has been banned from creation.\nIt matches the following blacklist entry: <code>$1</code>",
"titleblacklist-forbidden-move": "\"$2\" cannot be moved to \"$3\", because the title \"$3\" has been banned from creation.\nIt matches the following blacklist entry: <code>$1</code>",
"titleblacklist-forbidden-upload": "The file name \"$2\" has been banned from creation.\nIt matches the following blacklist entry: <code>$1</code>",
"titleblacklist-forbidden-new-account": "The user name \"$2\" has been banned from creation.\nIt matches the following blacklist entry: <code>$1</code>",
"titleblacklist-invalid": "The following {{PLURAL:$1|line|lines}} in the title blacklist {{PLURAL:$1|is|are}} invalid;\nplease correct {{PLURAL:$1|it|them}} before saving:",
"titleblacklist-override": "Ignore the blacklist",
"titleblacklist-autoconfirmed-warning": "<strong>Note:</strong> This page can only be edited by users with the <code>autoconfirmed</code> right because it matches the following title blacklist entry:<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-account": "Override the username blacklist",
"right-titleblacklistlog": "View title blacklist log"
"@metadata": {
"authors": []
},
"action-titleblacklistlog": "view the title blacklist log",
"log-name-titleblacklist": "Title blacklist log",
"log-description-titleblacklist": "These events track title blacklist hits.",
"logentry-titleblacklist-hit-username": "$1 {{GENDER:$2|caused}} a title blacklist hit when trying to create account $3 matching $4.",
"titleblacklist-desc": "Allows administrators to forbid creation of pages and user accounts per a [[MediaWiki:Titleblacklist|blacklist]] and [[MediaWiki:Titlewhitelist|whitelist]]",
"titleblacklist": "# This is a title blacklist. Titles and users that match a regular expression here cannot be created.\n# Use \"#\" for comments.\n# This is case insensitive by default",
"titlewhitelist": "# This is a title whitelist. Use \"#\" for comments.\n# This is case insensitive by default",
"titleblacklist-forbidden-edit": "The title \"$2\" has been banned from creation.\nIt matches the following blacklist entry: <code>$1</code>",
"titleblacklist-forbidden-move": "\"$2\" cannot be moved to \"$3\", because the title \"$3\" has been banned from creation.\nIt matches the following blacklist entry: <code>$1</code>",
"titleblacklist-forbidden-upload": "The file name \"$2\" has been banned from creation.\nIt matches the following blacklist entry: <code>$1</code>",
"titleblacklist-forbidden-new-account": "The user name \"$2\" has been banned from creation.\nIt matches the following blacklist entry: <code>$1</code>",
"titleblacklist-invalid": "The following {{PLURAL:$1|line|lines}} in the title blacklist {{PLURAL:$1|is|are}} invalid;\nplease correct {{PLURAL:$1|it|them}} before saving:",
"titleblacklist-override": "Ignore the blacklist",
"titleblacklist-autoconfirmed-warning": "<strong>Note:</strong> This page can only be edited by users with the <code>autoconfirmed</code> right because it matches the following title blacklist entry:<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-account": "Override the username blacklist",
"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",
"right-tboverride": "{{doc-right|tboverride}}",
"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}}"
}