Index: trunk/extensions/LocalisationUpdate/LocalisationUpdate.class.php |
— | — | @@ -20,14 +20,26 @@ |
21 | 21 | * @return true |
22 | 22 | */ |
23 | 23 | public static function onRecache( LocalisationCache $lc, $langcode, array &$cache ) { |
24 | | - $cache['messages'] = array_merge( |
25 | | - $cache['messages'], |
26 | | - self::readFile( $langcode ) |
27 | | - ); |
| 24 | + // Handle fallback sequence and load all fallback messages from the cache |
| 25 | + $codeSequence = array_merge( array( $langcode ), $cache['fallbackSequence'] ); |
| 26 | + // Iterate over the fallback sequence in reverse, otherwise the fallback |
| 27 | + // language will override the requested language |
| 28 | + foreach ( array_reverse( $codeSequence ) as $code ) { |
| 29 | + if ( $code == 'en' ) { |
| 30 | + // Skip English, otherwise we end up trying to read |
| 31 | + // the nonexistent cache file for en a couple hundred times |
| 32 | + continue; |
| 33 | + } |
| 34 | + |
| 35 | + $cache['messages'] = array_merge( |
| 36 | + $cache['messages'], |
| 37 | + self::readFile( $code ) |
| 38 | + ); |
28 | 39 | |
29 | | - $cache['deps'][] = new FileDependency( |
30 | | - self::filename( $langcode ) |
31 | | - ); |
| 40 | + $cache['deps'][] = new FileDependency( |
| 41 | + self::filename( $code ) |
| 42 | + ); |
| 43 | + } |
32 | 44 | |
33 | 45 | return true; |
34 | 46 | } |