From c41c508875c983e6558ff6ed41489347584497ed Mon Sep 17 00:00:00 2001 From: Michael Dale Date: Tue, 18 Aug 2009 21:44:37 +0000 Subject: [PATCH] * removed in favor of normal $messages['en'] check * updated maintenance script accordingly --- js2/mwEmbed/php/languages/mwEmbed.i18n.php | 4 +--- .../php/maintenance/mergeJavascriptMsg.php | 23 +++++++++---------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/js2/mwEmbed/php/languages/mwEmbed.i18n.php b/js2/mwEmbed/php/languages/mwEmbed.i18n.php index 436e707a0c..e31ba4af03 100644 --- a/js2/mwEmbed/php/languages/mwEmbed.i18n.php +++ b/js2/mwEmbed/php/languages/mwEmbed.i18n.php @@ -7,7 +7,6 @@ * the following English language portion is automatically merged via the maintenance script. */ -# $messages['en'] = array( /* * js file: /libTimedText/mvTextInterface.js @@ -258,5 +257,4 @@ $messages['en'] = array( 'size-megabytes' => '$1 MB', 'size-kilobytes' => '$1 K', 'size-bytes' => '$1 B', -); -# \ No newline at end of file +); \ No newline at end of file diff --git a/js2/mwEmbed/php/maintenance/mergeJavascriptMsg.php b/js2/mwEmbed/php/maintenance/mergeJavascriptMsg.php index 8a807303fe..66268f255e 100644 --- a/js2/mwEmbed/php/maintenance/mergeJavascriptMsg.php +++ b/js2/mwEmbed/php/maintenance/mergeJavascriptMsg.php @@ -15,8 +15,9 @@ define( 'MEDIAWIKI', true ); // get the scriptLoader globals: require_once('../../jsScriptLoader.php'); -$mwSTART_MSG_KEY = '#'; -$mwEND_MSG_KEY = '#'; +$mwSTART_MSG_KEY = '$messages[\'en\'] = array('; +$mwEND_MSG_KEY = ', +);'; $mwLangFilePath = '../languages/mwEmbed.i18n.php'; // get options (like override JS or override PHP) @@ -24,7 +25,7 @@ $mwLangFilePath = '../languages/mwEmbed.i18n.php'; $rawLangFile = file_get_contents( $mwLangFilePath ); $startInx = strpos( $rawLangFile, $mwSTART_MSG_KEY) + strlen( $mwSTART_MSG_KEY ); -$endInx = strpos( $rawLangFile, $mwEND_MSG_KEY ); +$endInx = strpos( $rawLangFile, $mwEND_MSG_KEY ) +1; if( $startInx === false || $endInx === false ){ print "Could not find $mwSTART_MSG_KEY or $mwEND_MSG_KEY in mwEmbed.i18n.php \n"; exit(); @@ -39,7 +40,7 @@ $path = realpath('../../'); $curFileName = ''; // @@todo existing msgSet should be parsed (or we just "include" the file first) -$msgSet = '$messages[\'en\'] = array('; +$msgSet = ""; $objects = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $path ), RecursiveIteratorIterator::SELF_FIRST ); foreach( $objects as $fname => $object){ @@ -54,8 +55,12 @@ foreach( $objects as $fname => $object){ } } } -// close up the msgSet: -$msgSet.= ");\n"; +// rebuild and output to file +if( file_put_contents( $mwLangFilePath, trim( $preFile ) . "\n\t" . trim( $msgSet ) . "\n" . trim( $postFile ) ) ){ + print "updated $mwLangFilePath file\n"; + exit(); +} + function doJsonMerge( $json_txt ){ global $curFileName; @@ -73,10 +78,4 @@ function doJsonMerge( $json_txt ){ print "could not get any json vars from:$curFileName \n"; return ''; } -} - -// rebuild and output to file -if( file_put_contents( $mwLangFilePath, trim( $preFile ) . "\n" . trim( $msgSet ) . "\n" . trim( $postFile ) ) ){ - print "updated $mwLangFilePath file\n"; - exit(); } \ No newline at end of file -- 2.20.1