Anomie has uploaded a new change for review.
https://gerrit.wikimedia.org/r/321466
Change subject: Update for API error i18n
......................................................................
Update for API error i18n
See Iae0e2ce3.
Change-Id: Icc6242702bc7ffca953fef11440ba4e9b500b66d
---
M i18n/en.json
M i18n/qqq.json
M includes/ApiZeroBanner.php
3 files changed, 15 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ZeroBanner
refs/changes/66/321466/1
diff --git a/i18n/en.json b/i18n/en.json
index ebfc5c9..6eea92b 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -55,5 +55,6 @@
"apihelp-zeroconfig-param-type": "What kind of Zero info is
needed:\n;config:Get a trimmed-down carrier configuration based on the X-CS
header.\n;message:Get language-appropriate verbiage based on X-CS header;
requires agent param.",
"apihelp-zeroconfig-param-agent": "When setting type to message,
include a source agent value as well.",
"apihelp-zeroconfig-example-1": "Get configuration",
- "apihelp-zeroconfig-example-2": "Get verbiage for \"neat-app\""
+ "apihelp-zeroconfig-example-2": "Get verbiage for \"neat-app\"",
+ "apierror-zeroconfig-agent-message": "Non-empty <var>agent</var>
parameter is required when <var>type</var> param is <kbd>message</kbd>."
}
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 0186ccd..cd9892e 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -72,5 +72,6 @@
"apihelp-zeroconfig-param-type":
"{{doc-apihelp-param|zeroconfig|type}}",
"apihelp-zeroconfig-param-agent":
"{{doc-apihelp-param|zeroconfig|agent}}",
"apihelp-zeroconfig-example-1": "{{doc-apihelp-example|zeroconfig}}",
- "apihelp-zeroconfig-example-2": "{{doc-apihelp-example|zeroconfig}}"
+ "apihelp-zeroconfig-example-2": "{{doc-apihelp-example|zeroconfig}}",
+ "apierror-zeroconfig-agent-message": "{{doc-apierror}}"
}
diff --git a/includes/ApiZeroBanner.php b/includes/ApiZeroBanner.php
index 84ca182..2f43917 100644
--- a/includes/ApiZeroBanner.php
+++ b/includes/ApiZeroBanner.php
@@ -83,8 +83,17 @@
case 'message':
if ( ! ( isset( $params['agent'] ) && strlen(
$params['agent'] ) ) ) {
- $this->dieUsage( 'Non-empty agent
parameter is required when type param is message.',
-
'missing_valid_required_parameter', 500 );
+ if ( is_callable( [ $this,
'dieWithError' ] ) ) {
+ $this->dieWithError(
+
'apierror-zeroconfig-agent-message',
+
'missing_valid_required_parameter',
+ [],
+ 500
+ );
+ } else {
+ $this->dieUsage( 'Non-empty
agent parameter is required when type param is message.',
+
'missing_valid_required_parameter', 500 );
+ }
}
$state = PageRenderingHooks::getState( $this );
$config = $state->getZeroConfig();
--
To view, visit https://gerrit.wikimedia.org/r/321466
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icc6242702bc7ffca953fef11440ba4e9b500b66d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ZeroBanner
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits