Add autonyms to language database
Change-Id: Ifad5721485634142505a37ba00ca68c744781103
This commit is contained in:
File diff suppressed because one or more lines are too long
26
data/ulsdata2json.php
Normal file
26
data/ulsdata2json.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Script to create the language data in json format for ULS
|
||||
*/
|
||||
// Standard boilerplate to define $IP
|
||||
if ( getenv( 'MW_INSTALL_PATH' ) !== false ) {
|
||||
$IP = getenv( 'MW_INSTALL_PATH' );
|
||||
} else {
|
||||
$dir = __DIR__; $IP = "$dir/../../..";
|
||||
}
|
||||
require_once( "$IP/maintenance/commandLine.inc" );
|
||||
include __DIR__ . '/spyc.php';
|
||||
|
||||
$data = file_get_contents( 'langdb.yaml' );
|
||||
$parsed = spyc_load( $data );
|
||||
$json = json_encode( $parsed );
|
||||
$languageNames = FormatJSON::encode( Language::fetchLanguageNames() );
|
||||
$js = <<<EOD
|
||||
( function ( $ ) {
|
||||
$.uls = {};
|
||||
$.uls.data = $json;
|
||||
$.uls.data.autonyms = $languageNames;
|
||||
} )( jQuery );
|
||||
|
||||
EOD;
|
||||
file_put_contents( 'ext.uls.data.js', $js );
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Script to create the language data in json format for ULS
|
||||
*/
|
||||
include __DIR__ . '/spyc.php';
|
||||
$data = file_get_contents( 'langdb.yaml' );
|
||||
$parsed = spyc_load( $data );
|
||||
$json = json_encode( $parsed );
|
||||
$js = "( function ( $ ) {\n"
|
||||
."\t$.uls = {};\n"
|
||||
."\t$.uls.data = $json;\n"
|
||||
."} )( jQuery );\n";
|
||||
file_put_contents( 'ext.uls.data.js', $js );
|
||||
Reference in New Issue
Block a user