Jdlrobson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/52172
Change subject: Bug 44484: Provide translated language name in API response
......................................................................
Bug 44484: Provide translated language name in API response
In mobile we want to request all language variants of a page and
render the translated name of the language. This change to the API
makes it possible to do this.
Change-Id: I6c3025fae89cafd80c7844542c2a5b49aeb6660e
---
M includes/api/ApiQueryLangLinks.php
1 file changed, 4 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/72/52172/1
diff --git a/includes/api/ApiQueryLangLinks.php
b/includes/api/ApiQueryLangLinks.php
index 0aaa588..9cffaf0 100644
--- a/includes/api/ApiQueryLangLinks.php
+++ b/includes/api/ApiQueryLangLinks.php
@@ -102,13 +102,15 @@
$this->setContinueEnumParameter( 'continue',
"{$row->ll_from}|{$row->ll_lang}" );
break;
}
- $entry = array( 'lang' => $row->ll_lang );
+ $langcode = $row->ll_lang;
+ $entry = array( 'lang' => $langcode );
if ( $params['url'] ) {
$title = Title::newFromText(
"{$row->ll_lang}:{$row->ll_title}" );
if ( $title ) {
$entry['url'] = wfExpandUrl(
$title->getFullURL(), PROTO_CURRENT );
}
}
+ $entry['langname'] = wfGetLangObj( $langcode
)->fetchLanguageName( $langcode, $langcode );
ApiResult::setContent( $entry, $row->ll_title );
$fit = $this->addPageSubItem( $row->ll_from, $entry );
if ( !$fit ) {
@@ -160,6 +162,7 @@
return array(
'' => array(
'lang' => 'string',
+ 'langname' => 'string',
'url' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
--
To view, visit https://gerrit.wikimedia.org/r/52172
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6c3025fae89cafd80c7844542c2a5b49aeb6660e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits