From 434d2e332f6021cd35ea67506891fe0a3e51ce93 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Thu, 3 Nov 2016 15:16:57 -0400 Subject: [PATCH] Update for API error i18n See Iae0e2ce3. Change-Id: I1082c4aacaa6fb34e36b0a6f7def3a652217f531 --- api/ApiULSLocalization.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/ApiULSLocalization.php b/api/ApiULSLocalization.php index dc13607a..2b618250 100644 --- a/api/ApiULSLocalization.php +++ b/api/ApiULSLocalization.php @@ -30,7 +30,11 @@ class ApiULSLocalization extends ApiBase { $params = $this->extractRequestParams(); $language = $params['language']; if ( !Language::isValidCode( $language ) ) { - $this->dieUsage( 'Invalid language', 'invalidlanguage' ); + if ( is_callable( [ $this, 'dieWithError' ] ) ) { + $this->dieWithError( [ 'apierror-invalidlang', 'language' ], 'invalidlanguage' ); + } else { + $this->dieUsage( 'Invalid language', 'invalidlanguage' ); + } } $contents = ULSJsonMessageLoader::getMessages( $language ); // Output the file's contents raw