Page MenuHomePhabricator

13010.patch

Authored By
bzimport
Nov 21 2014, 10:06 PM
Size
1 KB
Referenced Files
None
Subscribers
None

13010.patch

Index: Language.php
===================================================================
--- Language.php (revision 30939)
+++ Language.php (working copy)
@@ -2025,7 +2025,7 @@
*/
static function loadLocalisation( $code, $disableCache = false ) {
static $recursionGuard = array();
- global $wgMemc, $wgCheckSerialized;
+ global $wgMemc, $wgCheckSerialized, $wgContLang;
if ( !$code ) {
throw new MWException( "Invalid language code requested" );
@@ -2082,9 +2082,19 @@
# Load the primary localisation from the source file
$filename = self::getMessagesFileName( $code );
if ( !file_exists( $filename ) ) {
- wfDebug( "Language::loadLocalisation(): no localisation file for $code, using implicit fallback to en\n" );
- $cache = array();
- $deps = array();
+ wfDebug( "Language::loadLocalisation(): no localisation file for $code, try falling back to content language\n" );
+ $content_code = $wgContLang->getCode();
+ $filename = self::getMessagesFileName ( $content_code );
+ if ( file_exists ( $filename ) ) {
+ $deps = array( $filename => filemtime( $filename ) );
+ require( $filename );
+ $cache = compact( self::$mLocalisationKeys );
+ wfDebug( "Language::loadLocalisation(): no localisation file for $code; got localisation for $content_code from source instead\n" );
+ } else {
+ wfDebug( "Language::loadLocalisation(): no localisation file for $code, nor for $content_code; using implicit fallback to en\n" );
+ $cache = array();
+ $deps = array();
+ }
} else {
$deps = array( $filename => filemtime( $filename ) );
require( $filename );

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4304
Default Alt Text
13010.patch (1 KB)

Event Timeline