Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F4739
13010.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 10:06 PM
2014-11-21 22:06:07 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
13010.patch
View Options
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
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4304
Default Alt Text
13010.patch (1 KB)
Attached To
Mode
T15010: Invalid language codes should fallback to default wiki language not English
Attached
Detach File
Event Timeline
Log In to Comment