Index: trunk/phase3/includes/LocalisationCache.php |
— | — | @@ -514,6 +514,7 @@ |
515 | 515 | foreach ( $data as $key => $value ) { |
516 | 516 | $this->mergeItem( $key, $coreData[$key], $value ); |
517 | 517 | } |
| 518 | + |
518 | 519 | } |
519 | 520 | |
520 | 521 | # Fill in the fallback if it's not there already |
— | — | @@ -532,17 +533,24 @@ |
533 | 534 | } |
534 | 535 | |
535 | 536 | # Load the fallback localisation item by item and merge it |
536 | | - foreach ( $coreData['fallbackSequence'] as $fallback ) { |
537 | | - $deps = array_merge( $deps, $this->getItem( $fallback, 'deps' ) ); |
| 537 | + foreach ( $coreData['fallbackSequence'] as $fbCode ) { |
| 538 | + |
| 539 | + # Load the secondary localisation from the source file to |
| 540 | + # avoid infinite cycles on cyclic fallbacks |
| 541 | + $fbFilename = Language::getMessagesFileName( $fbCode ); |
| 542 | + if ( !file_exists( $fbFilename ) ) continue; |
| 543 | + |
| 544 | + $deps[] = new FileDependency( $fbFilename ); |
| 545 | + $fbData = $this->readPHPFile( $fbFilename, 'core' ); |
538 | 546 | foreach ( self::$allKeys as $key ) { |
| 547 | + if ( !isset( $fbData[$key] ) ) continue; |
539 | 548 | if ( is_null( $coreData[$key] ) || $this->isMergeableKey( $key ) ) { |
540 | | - $fallbackValue = $this->getItem( $fallback, $key ); |
541 | | - $this->mergeItem( $key, $coreData[$key], $fallbackValue ); |
| 549 | + $this->mergeItem( $key, $coreData[$key], $fbData[$key] ); |
542 | 550 | } |
543 | 551 | } |
544 | 552 | } |
545 | | - |
546 | 553 | } |
| 554 | + |
547 | 555 | $codeSequence = array_merge( array( $code ), $coreData['fallbackSequence'] ); |
548 | 556 | |
549 | 557 | # Load the extension localisations |