Index: trunk/phase3/includes/parser/CoreParserFunctions.php |
— | — | @@ -604,15 +604,21 @@ |
605 | 605 | * Gives language names. |
606 | 606 | * @param $parser Parser |
607 | 607 | * @param $code String Language code |
608 | | - * @param $inLanguage String Language code |
| 608 | + * @param $language String Language code |
609 | 609 | * @return String |
610 | 610 | */ |
611 | | - static function language( $parser, $code = '', $inLanguage = '' ) { |
| 611 | + static function language( $parser, $code = '', $language = '' ) { |
| 612 | + global $wgContLang; |
612 | 613 | $code = strtolower( $code ); |
613 | | - # default to native language name |
614 | | - $inLanguage = $inLanguage !== '' ? strtolower( $inLanguage ) : $code; |
615 | | - $names = Language::getTranslatedLanguageNames( $inLanguage ); |
616 | | - return isset( $names[$code] ) ? $names[$code] : wfBCP47( $code ); |
| 614 | + $language = strtolower( $language ); |
| 615 | + |
| 616 | + if ( $language !== '' ) { |
| 617 | + $names = Language::getTranslatedLanguageNames( $language ); |
| 618 | + return isset( $names[$code] ) ? $names[$code] : wfBCP47( $code ); |
| 619 | + } |
| 620 | + |
| 621 | + $lang = $wgContLang->getLanguageName( $code ); |
| 622 | + return $lang !== '' ? $lang : wfBCP47( $code ); |
617 | 623 | } |
618 | 624 | |
619 | 625 | /** |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -682,12 +682,8 @@ |
683 | 683 | $names = array(); |
684 | 684 | wfRunHooks( 'LanguageGetTranslatedLanguageNames', array( &$names, $code ) ); |
685 | 685 | |
686 | | - foreach ( self::getLanguageNames() as $code2 => $name ) { |
687 | | - # Prefer own MediaWiki native name, |
688 | | - # for other names just add if not added through the hook |
689 | | - if ( $code === $code2 || !isset( $names[$code2] ) ) { |
690 | | - $names[$code2] = $name; |
691 | | - } |
| 686 | + foreach ( self::getLanguageNames() as $code => $name ) { |
| 687 | + if ( !isset( $names[$code] ) ) $names[$code] = $name; |
692 | 688 | } |
693 | 689 | |
694 | 690 | return $names; |