From d297f0b4c604e9497ee573abf9f0468a2a702588 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Thu, 6 Jan 2011 18:22:24 +0000 Subject: [PATCH] Fix ParserOptions so it uses correct language when transforming messages as reported on translatewiki.net. --- config/index.php | 2 ++ includes/installer/CoreInstaller.php | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/config/index.php b/config/index.php index e394a0428a..95faba8801 100644 --- a/config/index.php +++ b/config/index.php @@ -39,6 +39,8 @@ function wfInstallerMain() { } $wgLang = Language::factory( $langCode ); + $installer->setParserLanguage( $wgLang->getCode() ); + $wgMetaNamespace = $wgCanonicalNamespaceNames[NS_PROJECT]; $session = $installer->execute( $session ); diff --git a/includes/installer/CoreInstaller.php b/includes/installer/CoreInstaller.php index b8380a3515..e852760fbf 100644 --- a/includes/installer/CoreInstaller.php +++ b/includes/installer/CoreInstaller.php @@ -242,7 +242,7 @@ abstract class CoreInstaller extends Installer { } $this->parserTitle = Title::newFromText( 'Installer' ); - $this->parserOptions = new ParserOptions; + $this->parserOptions = new ParserOptions; // language will be wrong :( $this->parserOptions->setEditSection( false ); } @@ -258,6 +258,14 @@ abstract class CoreInstaller extends Installer { return true; } + /** + * ParserOptions are constructed before we determined the language, so fix it + */ + public function setParserLanguage( $lang ) { + $this->parserOptions->setTargetLanguage( $lang ); + $this->parserOptions->setUserLang( $lang ); + } + /** * Extension tag hook for a documentation link. */ -- 2.20.1