mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-14 01:57:02 +00:00
0c870e10ce
Change-Id: I0e01f8d21575ffaa77bac0d79dc1f5e1c2883438
25 lines
845 B
PHP
25 lines
845 B
PHP
<?php
|
|
// The messages are in modules/ve-mw/i18n and modules/ve-wmf/i18n
|
|
$messages = array();
|
|
$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 );
|
|
}
|
|
}
|
|
return true;
|
|
};
|