<?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); } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
cleanListname.php | File | 2.21 KB | 0644 |
|
cleanUrl.php | File | 3.21 KB | 0644 |
|
dummy.php | File | 169 B | 0644 |
|
parseplaceholders.php | File | 3.38 KB | 0644 |
|
sendmaildirect.php | File | 980 B | 0644 |
|
sendpage.php | File | 1.75 KB | 0644 |
|
subscriber_password.php | File | 1.93 KB | 0644 |
|
test_is_email.php | File | 5.07 KB | 0644 |
|
translation.php | File | 1.34 KB | 0644 |
|