Update for API error i18n

See Iae0e2ce3. Since TemplateData master requires core master, this just
depends on the master patch instead of trying to maintain BC.

Depends-On: Iae0e2ce3bd42dd4776a9779664086119ac188412
Change-Id: Iebe8557affd5ecf206814e7fdef5d8656417dadb
This commit is contained in:
Brad Jorsch 2016-11-03 15:16:57 -04:00
parent 66b6e8550c
commit 98473f59fe
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.",