From: Victor Vasiliev Date: Sun, 17 Feb 2008 15:36:52 +0000 (+0000) Subject: * (bug 13010) Invalid language codes should fallback to default wiki language not... X-Git-Tag: 1.31.0-rc.0~49463 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=b8ec8a526c6ed9e930aee9032bfbdf72a19fa21b;p=lhc%2Fweb%2Fwiklou.git * (bug 13010) Invalid language codes should fallback to default wiki language not English Patch by Alexandre Emsenhuber --- diff --git a/includes/StubObject.php b/includes/StubObject.php index 876cf50ec5..aa72c36038 100644 --- a/includes/StubObject.php +++ b/includes/StubObject.php @@ -105,7 +105,7 @@ class StubUserLang extends StubObject { $code = $wgContLanguageCode; } - if( $code === $wgContLanguageCode ) { + if( $code === $wgContLanguageCode || !Language::localisationExist( $code ) ) { return $wgContLang; } else { $obj = Language::factory( $code ); @@ -135,3 +135,4 @@ class StubUser extends StubObject { } + diff --git a/languages/Language.php b/languages/Language.php index d9aa5f52f7..67ad0ca28c 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -2013,6 +2013,10 @@ class Language { return self::getFileName( "$IP/languages/classes/Language", $code, '.php' ); } + static function localisationExist( $code ){ + return ( file_exists( self::getMessagesFileName( $code ) ) || file_exists( self::getClassFileName( $code ) ) ); + } + static function getLocalisationArray( $code, $disableCache = false ) { self::loadLocalisation( $code, $disableCache ); return self::$mLocalisationCache[$code];