[MediaWiki-commits] [Gerrit] mediawiki...ApiFeatureUsage[master]: Update for API error i18n
jenkins-bot has submitted this change and it was merged. Change subject: Update for API error i18n .. Update for API error i18n See Iae0e2ce3. Change-Id: I3b4aa182b8feaec7c659ab68bb0134e11fbd9fa9 --- M ApiQueryFeatureUsage.php M i18n/en.json M i18n/qqq.json 3 files changed, 18 insertions(+), 8 deletions(-) Approvals: Gergő Tisza: Looks good to me, approved jenkins-bot: Verified diff --git a/ApiQueryFeatureUsage.php b/ApiQueryFeatureUsage.php index 607e26a..a67fede 100644 --- a/ApiQueryFeatureUsage.php +++ b/ApiQueryFeatureUsage.php @@ -13,7 +13,11 @@ : $params['agent']; if ( empty( $agent ) ) { $encParamName = $this->encodeParamName( 'agent' ); - $this->dieUsage( 'Cannot query an empty user agent', "bad_$encParamName" ); + if ( is_callable( [ $this, 'dieWithError' ] ) ) { + $this->dieWithError( 'apierror-apifeatureusage-emptyagent', "bad_$encParamName" ); + } else { + $this->dieUsage( 'Cannot query an empty user agent', "bad_$encParamName" ); + } } $conf = ConfigFactory::getDefaultInstance()->makeConfig( 'ApiFeatureUsage' ); @@ -36,12 +40,16 @@ $this->dieStatus( $status ); } - foreach ( $status->getWarningsArray() as $warning ) { - if ( !$warning instanceof Message ) { - $key = array_shift( $warning ); - $warning = $this->msg( $key, $warning ); + if ( is_callable( [ $this, 'addMessagesFromStatus' ] ) ) { + $this->addMessagesFromStatus( $status ); + } else { + foreach ( $status->getWarningsArray() as $warning ) { + if ( !$warning instanceof Message ) { + $key = array_shift( $warning ); + $warning = $this->msg( $key, $warning ); + } + $this->setWarning( $warning->inLanguage( 'en' )->useDatabase( false )->plain() ); } - $this->setWarning( $warning->inLanguage( 'en' )->useDatabase( false )->plain() ); } $r = [ diff --git a/i18n/en.json b/i18n/en.json index aca2aae..0ac3696 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -24,5 +24,6 @@ "apihelp-query+featureusage-param-end": "End of date range to query.", "apihelp-query+featureusage-param-agent": "User agent to query. If not specified, the agent in the request will be queried.", "apihelp-query+featureusage-param-features": "If specified, return details on only these features.", - "apihelp-query+featureusage-example-simple": "Query feature usage for the current user agent" + "apihelp-query+featureusage-example-simple": "Query feature usage for the current user agent", + "apierror-apifeatureusage-emptyagent": "Cannot query an empty user agent." } diff --git a/i18n/qqq.json b/i18n/qqq.json index 389f6bd..be31c92 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -29,5 +29,6 @@ "apihelp-query+featureusage-param-end": "{{doc-apihelp-param|query+featureusage|end}}", "apihelp-query+featureusage-param-agent": "{{doc-apihelp-param|query+featureusage|agent|info=See definition of [[w:User agent|user agent]] on Wikipedia.}}", "apihelp-query+featureusage-param-features": "{{doc-apihelp-param|query+featureusage|features}}", - "apihelp-query+featureusage-example-simple": "{{doc-apihelp-example|query+featureusage|info=See definition of [[w:User agent|user agent]] on Wikipedia.}}" + "apihelp-query+featureusage-example-simple": "{{doc-apihelp-example|query+featureusage|info=See definition of [[w:User agent|user agent]] on Wikipedia.}}", + "apierror-apifeatureusage-emptyagent": "{{doc-apierror}}" } -- To view, visit https://gerrit.wikimedia.org/r/321409 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3b4aa182b8feaec7c659ab68bb0134e11fbd9fa9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ApiFeatureUsage Gerrit-Branch: master Gerrit-Owner: AnomieGerrit-Reviewer: Gergő Tisza Gerrit-Reviewer: Siebrand Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...ApiFeatureUsage[master]: Update for API error i18n
Anomie has uploaded a new change for review. https://gerrit.wikimedia.org/r/321409 Change subject: Update for API error i18n .. Update for API error i18n See Iae0e2ce3. Change-Id: I3b4aa182b8feaec7c659ab68bb0134e11fbd9fa9 --- M ApiQueryFeatureUsage.php M i18n/en.json M i18n/qqq.json 3 files changed, 18 insertions(+), 8 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ApiFeatureUsage refs/changes/09/321409/1 diff --git a/ApiQueryFeatureUsage.php b/ApiQueryFeatureUsage.php index 607e26a..a67fede 100644 --- a/ApiQueryFeatureUsage.php +++ b/ApiQueryFeatureUsage.php @@ -13,7 +13,11 @@ : $params['agent']; if ( empty( $agent ) ) { $encParamName = $this->encodeParamName( 'agent' ); - $this->dieUsage( 'Cannot query an empty user agent', "bad_$encParamName" ); + if ( is_callable( [ $this, 'dieWithError' ] ) ) { + $this->dieWithError( 'apierror-apifeatureusage-emptyagent', "bad_$encParamName" ); + } else { + $this->dieUsage( 'Cannot query an empty user agent', "bad_$encParamName" ); + } } $conf = ConfigFactory::getDefaultInstance()->makeConfig( 'ApiFeatureUsage' ); @@ -36,12 +40,16 @@ $this->dieStatus( $status ); } - foreach ( $status->getWarningsArray() as $warning ) { - if ( !$warning instanceof Message ) { - $key = array_shift( $warning ); - $warning = $this->msg( $key, $warning ); + if ( is_callable( [ $this, 'addMessagesFromStatus' ] ) ) { + $this->addMessagesFromStatus( $status ); + } else { + foreach ( $status->getWarningsArray() as $warning ) { + if ( !$warning instanceof Message ) { + $key = array_shift( $warning ); + $warning = $this->msg( $key, $warning ); + } + $this->setWarning( $warning->inLanguage( 'en' )->useDatabase( false )->plain() ); } - $this->setWarning( $warning->inLanguage( 'en' )->useDatabase( false )->plain() ); } $r = [ diff --git a/i18n/en.json b/i18n/en.json index aca2aae..0ac3696 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -24,5 +24,6 @@ "apihelp-query+featureusage-param-end": "End of date range to query.", "apihelp-query+featureusage-param-agent": "User agent to query. If not specified, the agent in the request will be queried.", "apihelp-query+featureusage-param-features": "If specified, return details on only these features.", - "apihelp-query+featureusage-example-simple": "Query feature usage for the current user agent" + "apihelp-query+featureusage-example-simple": "Query feature usage for the current user agent", + "apierror-apifeatureusage-emptyagent": "Cannot query an empty user agent." } diff --git a/i18n/qqq.json b/i18n/qqq.json index 389f6bd..be31c92 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -29,5 +29,6 @@ "apihelp-query+featureusage-param-end": "{{doc-apihelp-param|query+featureusage|end}}", "apihelp-query+featureusage-param-agent": "{{doc-apihelp-param|query+featureusage|agent|info=See definition of [[w:User agent|user agent]] on Wikipedia.}}", "apihelp-query+featureusage-param-features": "{{doc-apihelp-param|query+featureusage|features}}", - "apihelp-query+featureusage-example-simple": "{{doc-apihelp-example|query+featureusage|info=See definition of [[w:User agent|user agent]] on Wikipedia.}}" + "apihelp-query+featureusage-example-simple": "{{doc-apihelp-example|query+featureusage|info=See definition of [[w:User agent|user agent]] on Wikipedia.}}", + "apierror-apifeatureusage-emptyagent": "{{doc-apierror}}" } -- To view, visit https://gerrit.wikimedia.org/r/321409 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3b4aa182b8feaec7c659ab68bb0134e11fbd9fa9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ApiFeatureUsage Gerrit-Branch: master Gerrit-Owner: Anomie___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits