This patch automatically includes synonyms from the fallback localisation, and prevents the case flag from being overridden, thus making extensions resistant to translator error.
* by a fallback sequence.
*/
static public $mergeableMapKeys = array( 'messages', 'namespaceNames', 'mathNames',
* by a fallback sequence.
*/
static public $mergeableMapKeys = array( 'messages', 'namespaceNames', 'mathNames',
- 'dateFormats', 'defaultUserOptionOverrides', 'magicWords', 'imageFiles',
+ 'dateFormats', 'defaultUserOptionOverrides', 'imageFiles',
*/
static public $optionalMergeKeys = array( 'bookstoreList' );
*/
static public $optionalMergeKeys = array( 'bookstoreList' );
+ /**
+ * Keys for items that are formatted like $magicWords
+ */
+ static public $magicWordKeys = array( 'magicWords' );
+
/**
* Keys for items where the subitems are stored in the backend separately.
*/
/**
* Keys for items where the subitems are stored in the backend separately.
*/
self::$mergeableMapKeys,
self::$mergeableListKeys,
self::$mergeableAliasListKeys,
self::$mergeableMapKeys,
self::$mergeableListKeys,
self::$mergeableAliasListKeys,
- self::$optionalMergeKeys
+ self::$optionalMergeKeys,
+ self::$magicWordKeys
) );
}
return isset( $this->mergeableKeys[$key] );
) );
}
return isset( $this->mergeableKeys[$key] );
if ( isset( $value['inherit'] ) ) {
unset( $value['inherit'] );
}
if ( isset( $value['inherit'] ) ) {
unset( $value['inherit'] );
}
+ } elseif ( in_array( $key, self::$magicWordKeys ) ) {
+ $this->mergeMagicWords( $value, $fallbackValue );
+ protected function mergeMagicWords( &$value, $fallbackValue ) {
+ foreach ( $fallbackValue as $magicName => $fallbackInfo ) {
+ if ( !isset( $value[$magicName] ) ) {
+ $value[$magicName] = $fallbackInfo;
+ } else {
+ $oldSynonyms = array_slice( $fallbackInfo, 1 );
+ $newSynonyms = array_slice( $value[$magicName], 1 );
+ $synonyms = array_unique( array_merge( $oldSynonyms, $newSynonyms ) );
+ $value[$magicName] = array_merge( array( $fallbackInfo[0] ), $synonyms );
+ }
+ }
+ }
+
/**
* Given an array mapping language code to localisation value, such as is
* found in extension *.i18n.php files, iterate through a fallback sequence
/**
* Given an array mapping language code to localisation value, such as is
* found in extension *.i18n.php files, iterate through a fallback sequence