2011-11-28 20:28:28 +00:00
|
|
|
<?php
|
2014-03-13 00:41:42 +00:00
|
|
|
// The messages are in modules/ve-mw/i18n and modules/ve-wmf/i18n
|
2011-11-28 20:28:28 +00:00
|
|
|
$messages = array();
|
2013-12-17 10:00:33 +00:00
|
|
|
$GLOBALS['wgHooks']['LocalisationCacheRecache'][] = function ( $cache, $code, &$cachedData ) {
|
|
|
|
global $wgMessagesDirs;
|
|
|
|
$codeSequence = array_merge( array( $code ), $cachedData['fallbackSequence'] );
|
|
|
|
foreach ( (array)$wgMessagesDirs['VisualEditor'] as $dir ) {
|
|
|
|
foreach ( $codeSequence as $csCode ) {
|
|
|
|
$fileName = "$dir/$csCode.json";
|
|
|
|
if ( !is_readable( $fileName ) ) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$data = FormatJson::decode( file_get_contents( $fileName ), true );
|
|
|
|
foreach ( $data as $key => $unused ) {
|
|
|
|
if ( $key === '' || $key[0] === '@' ) {
|
|
|
|
unset( $data[$key] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$cachedData['messages'] = array_merge( $data, $cachedData['messages'] );
|
|
|
|
$cachedData['deps'][] = new FileDependency( $fileName );
|
|
|
|
}
|
2013-12-12 21:46:49 +00:00
|
|
|
}
|
2013-12-17 10:00:33 +00:00
|
|
|
return true;
|
|
|
|
};
|