mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TemplateData
synced 2024-11-29 01:54:15 +00:00
Merge "Update for API error i18n"
This commit is contained in:
commit
0a78939e77
|
@ -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() ]
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -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.",
|
||||
|
|
|
@ -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.",
|
||||
|
|
Loading…
Reference in a new issue