Added a test script which goal is to ensure all languages files are valid
This commit is contained in:
@@ -9,6 +9,8 @@ $Source$
|
|||||||
* libraries/display_tbl.inc.php3, line 1413: xhtml fix.
|
* libraries/display_tbl.inc.php3, line 1413: xhtml fix.
|
||||||
* libraries/fpdf/fpdf.php3: light optimizations and fixes.
|
* libraries/fpdf/fpdf.php3: light optimizations and fixes.
|
||||||
* sql.php3, lines 509-522: do print the page in "printview" mode.
|
* sql.php3, lines 509-522: do print the page in "printview" mode.
|
||||||
|
* scripts/check_lang.php3: added this script which goal is to ensure
|
||||||
|
all languages files are valid.
|
||||||
|
|
||||||
2002-06-01 Lo<4C>c Chapeaux <lolo@phpheaven.net>
|
2002-06-01 Lo<4C>c Chapeaux <lolo@phpheaven.net>
|
||||||
* db_details_structure.php3, lines 440-441; Documentation.html;
|
* db_details_structure.php3, lines 440-441; Documentation.html;
|
||||||
|
55
scripts/check_lang.php3
Normal file
55
scripts/check_lang.php3
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
/* $Id$ */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test script checks all the language files to ensure there is no errors
|
||||||
|
* inside and nothing is displayed on screen (eg no extra no blank line).
|
||||||
|
*/
|
||||||
|
$failed = array();
|
||||||
|
$passed = array();
|
||||||
|
|
||||||
|
// 1. Do check
|
||||||
|
$languageDirectory = dir('../lang');
|
||||||
|
while ($name = $languageDirectory->read()) {
|
||||||
|
if (strpos($name, '.inc.php3')) {
|
||||||
|
// 1.1 Checks parse errors and extra blank line
|
||||||
|
include('../lang/' . $name);
|
||||||
|
header('X-Ping: pong');
|
||||||
|
// 1.1 Checks "^M"
|
||||||
|
$content = fread(fopen('../lang/' . $name, 'r'), filesize('../lang/' . $name));
|
||||||
|
if ($pos = strpos(' ' . $content, "\015")) {
|
||||||
|
$failed[] = $name;
|
||||||
|
} else {
|
||||||
|
$passed[] = $name;
|
||||||
|
}
|
||||||
|
} // end if
|
||||||
|
} // end while
|
||||||
|
$languageDirectory->close();
|
||||||
|
|
||||||
|
// 2. Checking results
|
||||||
|
$start = '';
|
||||||
|
$failed_cnt = count($failed);
|
||||||
|
sort($failed);
|
||||||
|
$passed_cnt = count($passed);
|
||||||
|
sort($passed);
|
||||||
|
echo ($failed_cnt + $passed_cnt) . ' language files were checked.<br /><br />' . "\n";
|
||||||
|
if ($failed_cnt) {
|
||||||
|
echo ' 1. ' . $failed_cnt . ' contain(s) some "^M":<br />' . "\n";
|
||||||
|
for ($i = 0; $i < $failed_cnt; $i++) {
|
||||||
|
echo ' - ' . $failed[$i] . '<br />' . "\n";
|
||||||
|
} // end for
|
||||||
|
if ($passed_cnt) {
|
||||||
|
echo '<br />' . "\n";
|
||||||
|
echo ' 2. ' . $passed_cnt . ' seems right:<br />' . "\n";
|
||||||
|
$start = ' ';
|
||||||
|
}
|
||||||
|
} // end if
|
||||||
|
if ($passed_cnt) {
|
||||||
|
if (!$failed_cnt) {
|
||||||
|
echo 'They all passed checkings:<br />' . "\n";
|
||||||
|
}
|
||||||
|
for ($i = 0; $i < $passed_cnt; $i++) {
|
||||||
|
echo $start . ' - ' . $passed[$i] . '<br />' . "\n";
|
||||||
|
} // end for
|
||||||
|
} // end if
|
||||||
|
?>
|
Reference in New Issue
Block a user