Index: branches/wmf/1.17wmf1/includes/LocalisationCache.php |
— | — | @@ -101,7 +101,7 @@ |
102 | 102 | * by a fallback sequence. |
103 | 103 | */ |
104 | 104 | static public $mergeableMapKeys = array( 'messages', 'namespaceNames', 'mathNames', |
105 | | - 'dateFormats', 'defaultUserOptionOverrides', 'magicWords', 'imageFiles', |
| 105 | + 'dateFormats', 'defaultUserOptionOverrides', 'imageFiles', |
106 | 106 | 'preloadedMessages', |
107 | 107 | ); |
108 | 108 | |
— | — | @@ -124,6 +124,11 @@ |
125 | 125 | static public $optionalMergeKeys = array( 'bookstoreList' ); |
126 | 126 | |
127 | 127 | /** |
| 128 | + * Keys for items that are formatted like $magicWords |
| 129 | + */ |
| 130 | + static public $magicWordKeys = array( 'magicWords' ); |
| 131 | + |
| 132 | + /** |
128 | 133 | * Keys for items where the subitems are stored in the backend separately. |
129 | 134 | */ |
130 | 135 | static public $splitKeys = array( 'messages' ); |
— | — | @@ -187,7 +192,8 @@ |
188 | 193 | self::$mergeableMapKeys, |
189 | 194 | self::$mergeableListKeys, |
190 | 195 | self::$mergeableAliasListKeys, |
191 | | - self::$optionalMergeKeys |
| 196 | + self::$optionalMergeKeys, |
| 197 | + self::$magicWordKeys |
192 | 198 | ) ); |
193 | 199 | } |
194 | 200 | return isset( $this->mergeableKeys[$key] ); |
— | — | @@ -435,6 +441,8 @@ |
436 | 442 | if ( isset( $value['inherit'] ) ) { |
437 | 443 | unset( $value['inherit'] ); |
438 | 444 | } |
| 445 | + } elseif ( in_array( $key, self::$magicWordKeys ) ) { |
| 446 | + $this->mergeMagicWords( $value, $fallbackValue ); |
439 | 447 | } |
440 | 448 | } |
441 | 449 | } else { |
— | — | @@ -442,6 +450,19 @@ |
443 | 451 | } |
444 | 452 | } |
445 | 453 | |
| 454 | + protected function mergeMagicWords( &$value, $fallbackValue ) { |
| 455 | + foreach ( $fallbackValue as $magicName => $fallbackInfo ) { |
| 456 | + if ( !isset( $value[$magicName] ) ) { |
| 457 | + $value[$magicName] = $fallbackInfo; |
| 458 | + } else { |
| 459 | + $oldSynonyms = array_slice( $fallbackInfo, 1 ); |
| 460 | + $newSynonyms = array_slice( $value[$magicName], 1 ); |
| 461 | + $synonyms = array_unique( array_merge( $oldSynonyms, $newSynonyms ) ); |
| 462 | + $value[$magicName] = array_merge( array( $fallbackInfo[0] ), $synonyms ); |
| 463 | + } |
| 464 | + } |
| 465 | + } |
| 466 | + |
446 | 467 | /** |
447 | 468 | * Given an array mapping language code to localisation value, such as is |
448 | 469 | * found in extension *.i18n.php files, iterate through a fallback sequence |
Property changes on: branches/wmf/1.17wmf1/includes/LocalisationCache.php |
___________________________________________________________________ |
Added: svn:mergeinfo |
449 | 470 | Merged /branches/REL1_15/phase3/includes/LocalisationCache.php:r51646 |
450 | 471 | Merged /branches/wmf/1.16wmf4/includes/LocalisationCache.php:r67177,69199,76243,77266 |
451 | 472 | Merged /branches/sqlite/includes/LocalisationCache.php:r58211-58321 |
452 | 473 | Merged /trunk/phase3/includes/LocalisationCache.php:r81960 |
453 | 474 | Merged /branches/new-installer/phase3/includes/LocalisationCache.php:r43664-66004 |
454 | 475 | Merged /branches/wmf-deployment/includes/LocalisationCache.php:r53381,60970 |