Merge "Update for API error i18n"

This commit is contained in:
jenkins-bot 2016-12-07 07:15:48 +00:00 committed by Gerrit Code Review
commit 4b97528610
3 changed files with 8 additions and 2 deletions

View file

@ -17,6 +17,7 @@
},
"apihelp-query+references-description": "Return a data representation of references associated with the given pages.",
"apihelp-query+references-example-1": "References associated with <kbd>Albert Einstein</kbd>.",
"apierror-citestoragedisabled": "Cite extension reference storage is not enabled.",
"cite-desc": "Adds <nowiki><ref[ name=id]></nowiki> and <nowiki><references/></nowiki> tags, for citations",
"cite_error": "Cite error: $1",
"cite_error_ref_numeric_key": "Invalid <code>&lt;ref&gt;</code> tag;\nname cannot be a simple integer. Use a descriptive title",

View file

@ -17,6 +17,7 @@
},
"apihelp-query+references-description": "{{doc-apihelp-description|query+references}}",
"apihelp-query+references-example-1": "{{doc-apihelp-example|query+references}}",
"apierror-citestoragedisabled": "{{doc-apierror}}",
"cite-desc": "{{desc|name=Cite|url=https://www.mediawiki.org/wiki/Extension:Cite}}",
"cite_error": "Cite extension.\n\nUsed when there are errors in ref or references tags.\n\nParameters:\n* $1 - an error message",
"cite_error_ref_numeric_key": "Cite extension. Error message shown if the name of a ref tag only contains digits. Examples that cause this error are <code><nowiki><ref name=\"123\" /></nowiki></code> or <code><nowiki><ref name=\"456\">input</ref></nowiki></code>",

View file

@ -30,7 +30,7 @@ class ApiQueryReferences extends ApiQueryBase {
public function getAllowedParams() {
return [
'continue' => [
ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
],
];
}
@ -38,7 +38,11 @@ class ApiQueryReferences extends ApiQueryBase {
public function execute() {
$config = ConfigFactory::getDefaultInstance()->makeConfig( 'cite' );
if ( !$config->get( 'CiteStoreReferencesData' ) ) {
$this->dieUsage( 'Cite extension reference storage is not enabled', 'citestoragedisabled' );
if ( is_callable( [ $this, 'dieWithError' ] ) ) {
$this->dieWithError( 'apierror-citestoragedisabled' );
} else {
$this->dieUsage( 'Cite extension reference storage is not enabled', 'citestoragedisabled' );
}
}
$params = $this->extractRequestParams();
$titles = $this->getPageSet()->getGoodTitles();