mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-24 16:04:35 +00:00
0730ff8d67
Procedure per https://www.mediawiki.org/wiki/Manual:GenerateJsonI18n.php with shim. Change-Id: I45c23439d25b081d932ff4354fd3308122e5b186
21 lines
683 B
PHP
21 lines
683 B
PHP
<?php
|
|
$messages = array();
|
|
$GLOBALS['wgHooks']['LocalisationCacheRecache'][] = function ( $cache, $code, &$cachedData ) {
|
|
$codeSequence = array_merge( array( $code ), $cachedData['fallbackSequence'] );
|
|
foreach ( $codeSequence as $csCode ) {
|
|
$fileName = __DIR__ . "/i18n/$csCode.json";
|
|
if ( is_readable( $fileName ) ) {
|
|
$data = FormatJson::decode( file_get_contents( $fileName ), true );
|
|
foreach ( array_keys( $data ) as $key ) {
|
|
if ( $key === '' || $key[0] === '@' ) {
|
|
unset( $data[$key] );
|
|
}
|
|
}
|
|
$cachedData['messages'] = array_merge( $data, $cachedData['messages'] );
|
|
}
|
|
|
|
$cachedData['deps'][] = new FileDependency( $fileName );
|
|
}
|
|
return true;
|
|
};
|