'. "
".'Projektscann: '."
". "
".'Scanning for prefix: "lng(\'" '." in .php/.htm files in current folder,". "
and create a complete list of language texts that you can translate". '

'; $arrTrans= []; $arrCode= []; $content = file_get_contents('translation.json'); if($content !== FALSE) { $lng = json_decode($content, TRUE); foreach ($lng["language"] as $key => $value) { $code = $value["code"]; $lang_list[$code] = $value["name"]; $arrTrans[$code] = $value["translation"]; $arrCode[]= $code; } } if (isset($_POST['submit'])) $compareCode = $_POST['lngCode']; echo '

'; while (false !== ($entry = $d->read())) { $dir= $entry.'/'; if (is_dir($entry) ) { $files = scandir($dir); if ($files) foreach ($files as $source) { $count= 0; $search= "lng('"; if (($source!=='.') and ($source!=='..') and (!strpos($source,'.bak')) and (!strpos($source,'lngScann.php')) and (!strpos($source,'.csv')) and ((strpos($source,'.php')) or (strpos($source,'.htm'))) ) { $lines = file($dir.$source); foreach ($lines as $line_num => $line) { $line= ' '.$line; if ($a=strpos($line,$search)) { if ((strpos($source,'.php')) or (strpos($source,'.htm'))) { $str= $line; while (strpos($str,$search)) { $a= strpos($str,$search); $str= substr($str,$a+5); $b= strpos($str,"')"); $str= html_entity_decode($str); $str= strip_tags($str); $longest= max($longest,strlen(utf8_decode(substr($str,0,$b)))); $f= substr($str,0,$b); $arrStrings[] = ['"'.$f.'"']; } } $count++; $total++; } } $count= substr('000'.$count,-4); if ($count>0) $buff[] = 'Total: '.$count.' found : "'.$search.'" in file '.$dir.''.$source.'
'; } } } } echo '

'; $d->close(); foreach ($buff as $buf) {echo $buf;}; echo '
Total: '.$total. ' found: '.$search.' in the scanned files
'; $arrStrings= array_unique($arrStrings, SORT_REGULAR); // sort($arrStrings, SORT_NATURAL | SORT_FLAG_CASE); sort($arrStrings); echo '
Sorted list without duplicates for code: '.$compareCode. '

'; '

{
  "appName": "Tiny File Manager",
  "version": "2.5.3",
  "language": [
    {
      "name": "Fill: English name for the language",
      "code": "Fill: language ISO code",
      "translation": {';
        foreach ($arrStrings as $string) {
            if (strlen($string[0])>3) {
                echo '
'.str_repeat(" ",8).$string[0].':'. str_repeat(" ",$longest+3-strlen(utf8_decode(substr($string[0],0)))); if (array_key_exists(trim($string[0],'"'),$arrTrans[$compareCode])) { echo '"'.$arrTrans[$compareCode][trim($string[0],'"')].'",'; $miss++; } else echo '"Missing_native_translated_string",'; }}; echo ' <- REMOVE THIS LAST COMMA ! } },
{... Insert all other languages here ...} ] }
'; echo '

'. '
Total: '.count($arrStrings).' strings i the sorted list. Longest string is on '.$longest.' chars.'. '
You can copy - paste this list to your editor'. '
Remember to escape the char: " with a slash like this: \" if it occurs on translated text !'. '
Status of the analyzed language is '.round($miss / count($arrStrings) * 100).' % translated.'; ?>