Merge "Update for API error i18n"

This commit is contained in:
jenkins-bot 2016-12-08 03:58:39 +00:00 committed by Gerrit Code Review
commit 0a78939e77
3 changed files with 9 additions and 8 deletions

View file

@ -19,11 +19,9 @@ class ApiTemplateData extends ApiBase {
*/
public function getCustomPrinter() {
if ( $this->getMain()->getVal( 'format' ) === null ) {
$this->setWarning(
"The default output format will change to jsonfm in the future." .
" Please specify format=json explicitly."
$this->addDeprecation(
'apiwarn-templatedata-deprecation-format', 'action=templatedata&!format'
);
$this->logFeatureUsage( 'action=templatedata&!format' );
return $this->getMain()->createPrinterByName( 'json' );
}
return null;
@ -46,7 +44,7 @@ class ApiTemplateData extends ApiBase {
if ( is_null( $params['lang'] ) ) {
$langCode = false;
} elseif ( !Language::isValidCode( $params['lang'] ) ) {
$this->dieUsage( 'Invalid language code for parameter lang', 'invalidlang' );
$this->dieWithError( [ 'apierror-invalidlang', 'lang' ] );
} else {
$langCode = $params['lang'];
}
@ -78,9 +76,8 @@ class ApiTemplateData extends ApiBase {
$status = $tdb->getStatus();
if ( !$status->isOK() ) {
$this->dieUsage(
'Page #' . intval( $row->pp_page ) . ' templatedata contains invalid data: '
. $status->getMessage(), 'templatedata-corrupt'
$this->dieWithError(
[ 'apierror-templatedata-corrupt', intval( $row->pp_page ), $status->getMessage() ]
);
}

View file

@ -10,6 +10,8 @@
"apihelp-templatedata-description": "Fetch data stored by the TemplateData extension.",
"apihelp-templatedata-example-1": "Return data for [[Template:Stub]] and [[Template:Example]]",
"apihelp-templatedata-param-lang": "Return localized values in this language. By default all available translations are returned.",
"apierror-templatedata-corrupt": "Page #$1 templatedata contains invalid data: $2",
"apiwarn-templatedata-deprecation-format": "The default output format will change to <kbd>jsonfm</kbd> in the future. Please specify <kbd>format=json</kbd> explicitly.",
"templatedata-desc": "Implement data storage for template parameters (using JSON)",
"templatedata-doc-desc-empty": "No description.",
"templatedata-doc-format-inline": "This template prefers inline formatting of parameters.",

View file

@ -20,6 +20,8 @@
"apihelp-templatedata-description": "{{doc-apihelp-description|templatedata}}",
"apihelp-templatedata-example-1": "{{doc-apihelp-example|templatedata}}",
"apihelp-templatedata-param-lang": "{{doc-apihelp-param|templatedata|lang}}",
"apierror-templatedata-corrupt": "{{doc-apierror}}\n\nParameters:\n* $1 - Page ID number\n* $2 - Localized message with further information.",
"apiwarn-templatedata-deprecation-format": "{{doc-apierror}}",
"templatedata-desc": "{{desc|name=Template Data|url=https://www.mediawiki.org/wiki/Extension:TemplateData}}",
"templatedata-doc-desc-empty": "Displayed when a template has no description (should be a valid sentence).\n{{Identical|No description}}",
"templatedata-doc-format-inline": "Use inline formatting of the template parameters in wikitext.",