From 0ee46eaec14f7985b39d2da7058a44aee1dcb1fe Mon Sep 17 00:00:00 2001 From: Santhosh Thottingal Date: Mon, 1 Jul 2013 16:12:48 +0530 Subject: [PATCH] Remove namespace parameter from ApiULSLocalization Return messages from all known namespaces for the language Change-Id: I3fe70108458dd5dfa6689a6d30c65f510e94b4d8 --- api/ApiULSLocalization.php | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/api/ApiULSLocalization.php b/api/ApiULSLocalization.php index 07685889..0e45c3dd 100644 --- a/api/ApiULSLocalization.php +++ b/api/ApiULSLocalization.php @@ -29,28 +29,23 @@ class ApiULSLocalization extends ApiBase { $params = $this->extractRequestParams(); $language = $params['language']; - $namespace = $params['namespace']; if ( !Language::isValidCode( $language ) ) { $this->dieUsage( 'Invalid language', 'invalidlanguage' ); } $contents = array(); // jQuery.uls localization - if ( !$namespace || $namespace === 'uls' ) { - $filename = __DIR__ . "/../lib/jquery.uls/i18n/$language.json"; - if ( file_exists( $filename ) ) { - $contents += json_decode( file_get_contents( $filename ), true ); - } + $filename = __DIR__ . "/../lib/jquery.uls/i18n/$language.json"; + if ( file_exists( $filename ) ) { + $contents += json_decode( file_get_contents( $filename ), true ); } // mediaWiki.uls localization - if ( !$namespace || $namespace === 'ext-uls' ) { - $filename = __DIR__ . "/../i18n/$language.json"; - if ( file_exists( $filename ) ) { - $contents += json_decode( file_get_contents( $filename ), true ); - } + $filename = __DIR__ . "/../i18n/$language.json"; + if ( file_exists( $filename ) ) { + $contents += json_decode( file_get_contents( $filename ), true ); } // Output the file's contents raw - $this->getResult()->addValue( null, 'text', json_encode( $contents ) ); + $this->getResult()->addValue( null, 'text', json_encode( $contents ) ); $this->getResult()->addValue( null, 'mime', 'application/json' ); } @@ -68,17 +63,12 @@ class ApiULSLocalization extends ApiBase { ApiBase::PARAM_REQUIRED => true, ApiBase::PARAM_TYPE => 'string', ), - 'namespace' => array( - ApiBase::PARAM_TYPE => 'string', - ApiBase::PARAM_REQUIRED => false, - ), ); } public function getParamDescription() { return array( 'language' => 'Language string', - 'namespace' => 'Namespace string. If not given loads messages for all namespaces known', ); } @@ -90,7 +80,6 @@ class ApiULSLocalization extends ApiBase { return array( 'api.php?action=ulslocalization&language=ta', 'api.php?action=ulslocalization&language=hi', - 'api.php?action=ulslocalization&language=or&namespace=ext-uls', ); }