mediawiki-extensions-Visual.../VisualEditor.i18n.php
James D. Forrester 560f8642ed Add a note to the top of the i18n shim explaining what it is
Change-Id: I07a6abf0d85e4ec692bb25414d65c226977b69f7
2013-12-11 18:02:19 -08:00

26 lines
694 B
PHP

<?php
/**
* VisualEditor i18n shim file to load the JSON equivalents.
*
* See https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format
*
* @file
*/
$messages = array();
array_map( function ( $dir ) use ( &$messages ) {
$files = glob( __DIR__ . "/$dir/*.json" );
foreach ( $files as $file ) {
$langcode = substr( basename( $file ), 0, -5 );
$data = json_decode( file_get_contents( $file ), /* $assoc = */ true );
unset( $data['@metadata'] );
$messages[$langcode] = isset( $messages[$langcode] ) ?
array_merge( $messages[$langcode], $data ) :
$data;
}
}, array(
'modules/oojs-ui/i18n',
'modules/ve/i18n',
'modules/ve-mw/i18n',
'modules/ve-wmf/i18n'
) );