wiki.techinc.nl/includes/cache
Niklas Laxström a064f78053 New hook MessageCache::get
Example usage:

$wgHooks['MessageCache::get'][] = function( &$key ) {
	static $keys = null;
	if ( $keys === null ) {
		global $wgExtensionMessagesFiles;
		require( $wgExtensionMessagesFiles['OverrideMessages'] );
		$keys = array_flip( array_keys( $messages['en'] ) );
	}

	if ( isset( $keys["myprefix-$key"] ) ) {
		$key = "myprefix-$key";
	}

	return true;
}

Pros:
* Easy way to override standard core and extension messages without
  any changes to them
* Messages can be stored in a standard i18n file
* Messages can be translated easily with Translate
* Messages can be shared accross multiple wikis easily
* Takes advantage of the normal message cache behavior unlike the
  MessagePreLoad hook
* Missing translations fallback to the override, not to the
  uncustomized standard translation
* Do not need to handle conflicting message keys at translatewiki.net
  if adopted by WMF

Cons:
* This method is called often, so there will be small performance
  impact if no hooks are registered. Impact can be big if the
  implementation of hook subscriber is inefficient.

This can help with bugs like 36149. It doesn't remove the manual work
needed to detect those messages and adding them to the i18n file.

I have been using this patch in a wiki farm for months.

Change-Id: Ib39937a440e71ae7292cf992ab37a569189741e4
2014-02-10 15:51:52 +00:00
..
BacklinkCache.php Merge "Update some documentation" 2013-12-03 17:10:21 +00:00
CacheDependency.php Random documentation tweaks 2014-01-02 23:45:14 +01:00
FileCacheBase.php Update some documentation 2013-12-03 14:59:45 +01:00
GenderCache.php Update formatting 2013-11-17 21:46:55 +01:00
HTMLFileCache.php Enhance the destination control parameter of wfDebug() and wfDebugLog() 2014-02-04 19:56:24 +00:00
LinkBatch.php Declare visibility on class properties of LinkBatch 2013-11-19 08:32:31 +00:00
LinkCache.php Revert "Include short descriptions for extensions bundled in the release" 2014-01-12 23:59:44 +00:00
LocalisationCache.php Update formatting 2014-02-06 09:27:05 +01:00
MapCacheLRU.php Merge "Made Title cache use MapCacheLRU" 2013-12-26 22:24:14 +00:00
MessageCache.php New hook MessageCache::get 2014-02-10 15:51:52 +00:00
ObjectFileCache.php Added missing GPLv2 headers in some places. 2012-05-08 14:51:21 +02:00
ProcessCacheLRU.php Update formatting 2013-11-17 21:46:55 +01:00
ResourceFileCache.php Update formatting 2013-11-17 21:46:55 +01:00
UserCache.php Update some documentation 2013-12-03 14:59:45 +01:00