r81961 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81960‎ | r81961 | r81962 >
Date:11:58, 11 February 2011
Author:catrope
Status:ok
Tags:
Comment:
1.17wmf1: MFT r81960
Modified paths:
  • /branches/wmf/1.17wmf1/includes/LocalisationCache.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/includes/LocalisationCache.php
@@ -101,7 +101,7 @@
102102 * by a fallback sequence.
103103 */
104104 static public $mergeableMapKeys = array( 'messages', 'namespaceNames', 'mathNames',
105 - 'dateFormats', 'defaultUserOptionOverrides', 'magicWords', 'imageFiles',
 105+ 'dateFormats', 'defaultUserOptionOverrides', 'imageFiles',
106106 'preloadedMessages',
107107 );
108108
@@ -124,6 +124,11 @@
125125 static public $optionalMergeKeys = array( 'bookstoreList' );
126126
127127 /**
 128+ * Keys for items that are formatted like $magicWords
 129+ */
 130+ static public $magicWordKeys = array( 'magicWords' );
 131+
 132+ /**
128133 * Keys for items where the subitems are stored in the backend separately.
129134 */
130135 static public $splitKeys = array( 'messages' );
@@ -187,7 +192,8 @@
188193 self::$mergeableMapKeys,
189194 self::$mergeableListKeys,
190195 self::$mergeableAliasListKeys,
191 - self::$optionalMergeKeys
 196+ self::$optionalMergeKeys,
 197+ self::$magicWordKeys
192198 ) );
193199 }
194200 return isset( $this->mergeableKeys[$key] );
@@ -435,6 +441,8 @@
436442 if ( isset( $value['inherit'] ) ) {
437443 unset( $value['inherit'] );
438444 }
 445+ } elseif ( in_array( $key, self::$magicWordKeys ) ) {
 446+ $this->mergeMagicWords( $value, $fallbackValue );
439447 }
440448 }
441449 } else {
@@ -442,6 +450,19 @@
443451 }
444452 }
445453
 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+
446467 /**
447468 * Given an array mapping language code to localisation value, such as is
448469 * found in extension *.i18n.php files, iterate through a fallback sequence
Property changes on: branches/wmf/1.17wmf1/includes/LocalisationCache.php
___________________________________________________________________
Added: svn:mergeinfo
449470 Merged /branches/REL1_15/phase3/includes/LocalisationCache.php:r51646
450471 Merged /branches/wmf/1.16wmf4/includes/LocalisationCache.php:r67177,69199,76243,77266
451472 Merged /branches/sqlite/includes/LocalisationCache.php:r58211-58321
452473 Merged /trunk/phase3/includes/LocalisationCache.php:r81960
453474 Merged /branches/new-installer/phase3/includes/LocalisationCache.php:r43664-66004
454475 Merged /branches/wmf-deployment/includes/LocalisationCache.php:r53381,60970

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r81960Since 1.17 a whole lot of extensions have sprouted *.i18n.magic.php files. Mo...tstarling11:53, 11 February 2011

Status & tagging log