- public static function newMainPage() {
- $title = self::newFromText( wfMessage( 'mainpage' )->inContentLanguage()->text() );
- // Don't give fatal errors if the message is broken
+ public static function newMainPage( MessageLocalizer $localizer = null ) {
+ if ( $localizer ) {
+ $msg = $localizer->msg( 'mainpage' );
+ } else {
+ $msg = wfMessage( 'mainpage' );
+ }
+
+ $title = self::newFromText( $msg->inContentLanguage()->text() );
+
+ // Every page renders at least one link to the Main Page (e.g. sidebar).
+ // If the localised value is invalid, don't produce fatal errors that
+ // would make the wiki inaccessible (and hard to fix the invalid message).
+ // Gracefully fallback...