From 49edf82e057039844d9288717592ff5e69091b2a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Fri, 29 Aug 2014 21:51:56 +0200 Subject: [PATCH] ApiQuerySiteinfo: Use proper localised skin display names if available MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Based on the code in Preferences::generateSkinOptions(). This should probably be turned into a helper method one day… Bug: 48953 Change-Id: Ib85a783bd19de8a59e7b81a4203a05b786e67772 --- includes/api/ApiQuerySiteinfo.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index 741445393c..fd0c429d35 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -696,6 +696,16 @@ class ApiQuerySiteinfo extends ApiQueryBase { $allowed = Skin::getAllowedSkins(); $default = Skin::normalizeKey( 'default' ); foreach ( Skin::getSkinNames() as $name => $displayName ) { + $msg = $this->msg( "skinname-{$name}" ); + $code = $this->getParameter( 'inlanguagecode' ); + if ( $code && Language::isValidCode( $code ) ) { + $msg->inLanguage( $code ); + } else { + $msg->inContentLanguage(); + } + if ( $msg->exists() ) { + $displayName = $msg->text(); + } $skin = array( 'code' => $name ); ApiResult::setContent( $skin, $displayName ); if ( !isset( $allowed[$name] ) ) { @@ -849,7 +859,8 @@ class ApiQuerySiteinfo extends ApiQueryBase { ' restrictions - Returns information on available restriction (protection) types', ' languages - Returns a list of languages MediaWiki supports ' . "(optionally localised by using {$p}inlanguagecode)", - ' skins - Returns a list of all enabled skins', + ' skins - Returns a list of all enabled skins ' . + "(optionally localised by using {$p}inlanguagecode, otherwise in content language)", ' extensiontags - Returns a list of parser extension tags', ' functionhooks - Returns a list of parser function hooks', ' showhooks - Returns a list of all subscribed hooks (contents of $wgHooks)', @@ -861,7 +872,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { 'showalldb' => 'List all database servers, not just the one lagging the most', 'numberingroup' => 'Lists the number of users in user groups', 'inlanguagecode' => 'Language code for localised language names ' . - '(best effort, use CLDR extension)', + '(best effort, use CLDR extension) and skin names', ); } -- 2.20.1