Provide language names on action=parse&prop=langlinks
authorumherirrender <umherirrender_de.wp@web.de>
Sun, 9 Feb 2014 12:31:15 +0000 (13:31 +0100)
committerAnomie <bjorsch@wikimedia.org>
Mon, 10 Feb 2014 15:44:14 +0000 (15:44 +0000)
This can helps the client to build a language html.

Bug: 58627
Change-Id: Iaa475cbe7b0268ee86e40ec0fa42bbe51bba02c9

RELEASE-NOTES-1.23
includes/api/ApiParse.php

index 660869c..4fc198a 100644 (file)
@@ -163,6 +163,7 @@ production.
 * Added siprop=restrictions to API action=query&meta=siteinfo for querying
   possible page restriction (protection) levels and types.
 * Added prop 'limitreportdata' and 'limitreporthtml' to action=parse.
+* (bug 58627) Provide language names on action=parse&prop=langlinks.
 
 === Languages updated in 1.23 ===
 
index 495071a..f5c072a 100644 (file)
@@ -487,6 +487,10 @@ class ApiParse extends ApiBase {
                        $entry['lang'] = $bits[0];
                        if ( $title ) {
                                $entry['url'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT );
+                               // localised language name in user language (maybe set by uselang=)
+                               $entry['langname'] = Language::fetchLanguageName( $title->getInterwiki(), $this->getLanguage()->getCode() );
+                               // native language name
+                               $entry['autonym'] = Language::fetchLanguageName( $title->getInterwiki() );
                        }
                        ApiResult::setContent( $entry, $bits[1] );
                        $result[] = $entry;