";
include realpath( './lang/en.php' );
$english_lang = $lang;
unset( $lang );
$lang_dir = realpath( './lang' );
$dir = opendir( $lang_dir );
// First, detect any unused strings from the english language:
echo "Checking English language file for unused strings
\n";
echo "\n";
$unused_keys = false;
// special case keys that do not occur hard-coded but are dynamically generated
$ignore_keys['equals'] = 1;
$ignore_keys['starts with'] = 1;
$ignore_keys['ends with'] = 1;
$ignore_keys['sounds like'] = 1;
$ignore_keys['contains'] = 1;
foreach( $english_lang as $key => $string ) {
if( isset( $ignore_keys[$key] ) )
continue;
$grep_cmd = "grep -r \"lang\[['\\\"]$key\" *.php templates/";
$used = `$grep_cmd`;
if( ! $used ) {
$unused_keys = true;
echo "- Unused English key: $key
(" . htmlspecialchars( $grep_cmd ) . ") \n";
flush();
}
}
if( false === $unused_keys )
echo "No unused English strings.";
echo "
\n";
echo "Incomplete or Erroneous Language Files
\n\n";
flush();
while( ( $file = readdir( $dir ) ) !== false ) {
// skip the devel languages, english, and auto
if( $file == "zz.php" || $file == "zzz.php" || $file == "auto.php" || $file == "en.php" )
continue;
// Sanity check. Is this really a PHP file?
if( ! preg_match( "/\.php$/", $file ) )
continue;
echo "$file
\n";
echo "\n";
unset( $lang );
$lang = array();
include realpath( $lang_dir.'/'.$file );
$has_errors = false;
foreach( $english_lang as $key => $string )
if( ! isset( $lang[ $key ] ) ) {
$has_errors = true;
echo "- missing entry: $key
\n";
}
foreach( $lang as $key => $string )
if( ! isset( $english_lang[ $key ] ) ){
$has_errors = true;
echo "- extra entry: $key
\n";
}
if( ! $has_errors )
echo "(No errors)\n";
echo "
\n";
}
echo "