Index: trunk/phase3/RELEASE-NOTES-1.19 |
— | — | @@ -31,10 +31,11 @@ |
32 | 32 | |
33 | 33 | === API changes in 1.19 === |
34 | 34 | * (bug 19838) siprop=interwikimap can now use the interwiki cache. |
35 | | -* (bug 29748) Add API search prefix support |
36 | | -* (bug 29684) Set forgotten parameter types in ApiQueryIWLinks |
37 | | -* (bug 29685) do not output NULL parentid with |
38 | | - list=deletedrevs&drprop=parentid |
| 35 | +* (bug 29748) Add API search prefix support. |
| 36 | +* (bug 29684) Set forgotten parameter types in ApiQueryIWLinks. |
| 37 | +* (bug 29685) do not output NULL parentid with list=deletedrevs&drprop=parentid. |
| 38 | +* siprop=interwikimap and siprop=languages can use silanguagecode to have |
| 39 | + a best effort language name translation. Use CLDR extension for best result. |
39 | 40 | |
40 | 41 | === Languages updated in 1.19 === |
41 | 42 | |
Index: trunk/phase3/includes/api/ApiQuerySiteinfo.php |
— | — | @@ -265,9 +265,18 @@ |
266 | 266 | ApiBase::dieDebug( __METHOD__, "Unknown filter=$filter" ); |
267 | 267 | } |
268 | 268 | |
| 269 | + $params = $this->extractRequestParams(); |
| 270 | + $langCode = isset( $params['languagecode'] ) ? $params['languagecode'] : ''; |
| 271 | + |
| 272 | + if( $langCode ) { |
| 273 | + $langNames = Language::getTranslatedLanguageNames( $langCode ); |
| 274 | + } else { |
| 275 | + $langNames = Language::getLanguageNames(); |
| 276 | + } |
| 277 | + |
269 | 278 | $getPrefixes = Interwiki::getAllPrefixes( $local ); |
270 | 279 | $data = array(); |
271 | | - $langNames = Language::getLanguageNames(); |
| 280 | + |
272 | 281 | foreach ( $getPrefixes as $row ) { |
273 | 282 | $prefix = $row['iw_prefix']; |
274 | 283 | $val = array(); |
— | — | @@ -462,8 +471,18 @@ |
463 | 472 | } |
464 | 473 | |
465 | 474 | public function appendLanguages( $property ) { |
| 475 | + $params = $this->extractRequestParams(); |
| 476 | + $langCode = isset( $params['languagecode'] ) ? $params['languagecode'] : ''; |
| 477 | + |
| 478 | + if( $langCode ) { |
| 479 | + $langNames = Language::getTranslatedLanguageNames( $langCode ); |
| 480 | + } else { |
| 481 | + $langNames = Language::getLanguageNames(); |
| 482 | + } |
| 483 | + |
466 | 484 | $data = array(); |
467 | | - foreach ( Language::getLanguageNames() as $code => $name ) { |
| 485 | + |
| 486 | + foreach ( $langNames as $code => $name ) { |
468 | 487 | $lang = array( 'code' => $code ); |
469 | 488 | ApiResult::setContent( $lang, $name ); |
470 | 489 | $data[] = $lang; |
— | — | @@ -560,6 +579,7 @@ |
561 | 580 | ), |
562 | 581 | 'showalldb' => false, |
563 | 582 | 'numberingroup' => false, |
| 583 | + 'languagecode' => null, |
564 | 584 | ); |
565 | 585 | } |
566 | 586 | |
— | — | @@ -573,13 +593,13 @@ |
574 | 594 | ' specialpagealiases - List of special page aliases', |
575 | 595 | ' magicwords - List of magic words and their aliases', |
576 | 596 | ' statistics - Returns site statistics', |
577 | | - ' interwikimap - Returns interwiki map (optionally filtered)', |
| 597 | + ' interwikimap - Returns interwiki map (optionally filtered, (optionally localised))', |
578 | 598 | ' dbrepllag - Returns database server with the highest replication lag', |
579 | 599 | ' usergroups - Returns user groups and the associated permissions', |
580 | 600 | ' extensions - Returns extensions installed on the wiki', |
581 | 601 | ' fileextensions - Returns list of file extensions allowed to be uploaded', |
582 | 602 | ' rightsinfo - Returns wiki rights (license) information if available', |
583 | | - ' languages - Returns a list of languages MediaWiki supports', |
| 603 | + ' languages - Returns a list of languages MediaWiki supports (optionally localised)', |
584 | 604 | ' skins - Returns a list of all enabled skins', |
585 | 605 | ' extensiontags - Returns a list of parser extension tags', |
586 | 606 | ' functionhooks - Returns a list of parser function hooks', |
— | — | @@ -588,6 +608,7 @@ |
589 | 609 | 'filteriw' => 'Return only local or only nonlocal entries of the interwiki map', |
590 | 610 | 'showalldb' => 'List all database servers, not just the one lagging the most', |
591 | 611 | 'numberingroup' => 'Lists the number of users in user groups', |
| 612 | + 'languagecode' => 'Language code for localised language names (best effort, use CLDR extension)', |
592 | 613 | ); |
593 | 614 | } |
594 | 615 | |