"; $CHECKLANG=$_REQUEST['CHECKLANG']; include realpath( './lang/en.php' ); $english_lang = $lang; unset( $lang ); $lang_dir = realpath( './lang/recoded' ); $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 "
  1. Unused English key: $key
        (" . htmlspecialchars( $grep_cmd ) . ")
  2. \n"; flush(); } } if( false === $unused_keys ) echo "No unused English strings."; echo "
\n"; echo "

Incomplete or Erroneous Language Files

\n\n"; if ($CHECKLANG) printf("

Checking language files %s

\n\n",$CHECKLANG); echo "

check all languages

\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; unset( $lang ); $lang = array(); include realpath( $lang_dir.'/'.$file ); $has_errors = false; if ($CHECKLANG=="" || $file===$CHECKLANG ){ echo "

$file

\n"; echo "
    \n"; foreach( $english_lang as $key => $string ) if( ! isset( $lang[ $key ] ) ) { $has_errors = true; echo "
  1. missing entry: $key
  2. \n"; } foreach( $lang as $key => $string ) if( ! isset( $english_lang[ $key ] ) ){ $has_errors = true; echo "
  3. extra entry: $key
  4. \n"; } if( ! $has_errors ) echo "(No errors)\n"; } echo "
\n"; } echo ""; ?>