better language handling - abandon magic language switch in favor of using int:lang as parameter, use parser->getFunctionLang() instead of wgContLanguage in case of use in interface messages

This commit is contained in:
Ryan Kaldari 2011-05-02 23:30:05 +00:00
parent 752dd28e01
commit a3dd6784c8

View file

@ -505,14 +505,11 @@ class ExtParserFunctions {
return '<strong class="error">' . wfMsgForContent( 'pfunc_time_too_long' ) . '</strong>';
} else {
if ( $ts < 100000000000000 ) { // Language can't deal with years after 9999
if ( $language == 'user' ) { // use user's interface language
$parser->getOptions()->getUserLang();
$result = $wgLang->sprintfDate( $format, $ts );
} elseif ( $language !== '' ) { // use whatever language is passed as a parameter
if ( $language !== '' ) { // use whatever language is passed as a parameter
$langObject = Language::factory( $language );
$result = $langObject->sprintfDate( $format, $ts );
} else { // use wiki's content language
$result = $wgContLang->sprintfDate( $format, $ts );
$result = $parser->getFunctionLang()->sprintfDate( $format, $ts );
}
} else {
return '<strong class="error">' . wfMsgForContent( 'pfunc_time_too_big' ) . '</strong>';