Add autonyms to language database

Change-Id: Ifad5721485634142505a37ba00ca68c744781103
This commit is contained in:
Santhosh Thottingal
2012-06-29 17:23:59 +05:30
parent 43d7604203
commit 720a3f3885
3 changed files with 27 additions and 13 deletions

File diff suppressed because one or more lines are too long

26
data/ulsdata2json.php Normal file
View 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 );

View File

@@ -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 );