Index: trunk/phase3/RELEASE-NOTES-1.19 |
— | — | @@ -68,6 +68,8 @@ |
69 | 69 | EditPage::showEditForm:initial |
70 | 70 | * (bug 29723) mw.util.wikiGetlink() now defaults to wgPageName. |
71 | 71 | * (bug 29680) Add GetDefaultSortkey hook to override the default sortkey. |
| 72 | +* (bug 16699) {{#language:}} accepts second parameter to specify the language in |
| 73 | + which the language name is wanted. Coverage depends on the cldr extension. |
72 | 74 | |
73 | 75 | === Bug fixes in 1.19 === |
74 | 76 | * (bug 28868) Show total pages in the subtitle of an image on the |
Index: trunk/phase3/includes/parser/CoreParserFunctions.php |
— | — | @@ -597,10 +597,18 @@ |
598 | 598 | return implode( $restrictions, ',' ); |
599 | 599 | } |
600 | 600 | |
601 | | - static function language( $parser, $arg = '' ) { |
| 601 | + static function language( $parser, $code = '', $language = '' ) { |
602 | 602 | global $wgContLang; |
603 | | - $lang = $wgContLang->getLanguageName( strtolower( $arg ) ); |
604 | | - return $lang != '' ? $lang : $arg; |
| 603 | + $code = strtolower( $code ); |
| 604 | + $language = strtolower( $language ); |
| 605 | + |
| 606 | + if ( $language !== '' ) { |
| 607 | + $names = Language::getTranslatedLanguageNames( $language ); |
| 608 | + return isset( $names[$code] ) ? $names[$code] : wfBCP47( $code ); |
| 609 | + } |
| 610 | + |
| 611 | + $lang = $wgContLang->getLanguageName( $code ); |
| 612 | + return $lang !== '' ? $lang : wfBCP47( $code ); |
605 | 613 | } |
606 | 614 | |
607 | 615 | /** |