Permalink
Browse files

CS

git-svn-id: http://svn.php.net/repository/pear/packages/Translation2/trunk@245169 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent 1713a30 commit 1c5338b1a58303be46e34e6203a83c7a70172506 @quipo quipo committed Oct 29, 2007
Showing with 17 additions and 9 deletions.
  1. +17 −9 scripts/t2xmlchk.php
View
@@ -2,7 +2,15 @@
<?php
/**
* Check XML files intended to be used with Translation2
- * @author Olivier Guilyardi <ylf@xung.org>
+ *
+ * @category Internationalization
+ * @package Translation2
+ * @author Olivier Guilyardi <ylf@xung.org>
+ * @copyright 2004-2007 Olivier Guilyardi
+ * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/Translation2
+ *
*/
//error_reporting (E_ALL);
@@ -23,13 +31,13 @@ function print_usage()
require_once 'XML/DTD/XmlValidator.php';
if (!$xml_file = $argv[1]) {
- echo ("ERROR : No xml filename provided\n\n");
+ echo "ERROR : No xml filename provided\n\n";
print_usage();
exit("\n");
}
-if (!is_readable ($xml_file)) {
- echo ("ERROR : No such file : \"$xml_file\"\n\n");
+if (!is_readable($xml_file)) {
+ echo "ERROR : No such file : \"$xml_file\"\n\n";
print_usage();
exit("\n");
}
@@ -52,21 +60,21 @@ function print_usage()
echo "Unserializing... ";
-$keyAttr = array (
+$keyAttr = array(
'lang' => 'id',
'page' => 'key',
'string' => 'key',
'tr' => 'lang'
);
-$unserializer = &new XML_Unserializer (array('keyAttribute' => $keyAttr));
+$unserializer = &new XML_Unserializer(array('keyAttribute' => $keyAttr));
if (PEAR::isError($status = $unserializer->unserialize($xml_file, true))) {
exit("FAILED : " . $status->getMessage() . "\n");
} else {
echo "OK\n";
}
$data = $unserializer->getUnserializedData();
-Translation2_Container_xml::fixEmptySets ($data);
+Translation2_Container_xml::fixEmptySets($data);
// This should be done by XML_DTD :
echo "Checking lang IDs... ";
@@ -101,7 +109,7 @@ function print_usage()
foreach ($data['pages'] as $pagename => $pagedata) {
foreach ($pagedata as $stringname => $stringvalues) {
foreach ($stringvalues as $lang => $translation) {
- if (!in_array ($lang, $known_langs)) {
+ if (!in_array($lang, $known_langs)) {
exit("FAILED : Unknow lang \"$lang\" in page \"$pagename\" at string \"$stringname\"\n");
}
}
@@ -114,7 +122,7 @@ function print_usage()
foreach ($data['pages'] as $pagename => $pagedata) {
foreach ($pagedata as $stringname => $stringvalues) {
foreach ($stringvalues as $lang => $translation) {
- if (is_array ($translation)) {
+ if (is_array($translation)) {
exit("FAILED : found duplicate in page \"$pagename\" for string \"stringname\" with lang \"$lang\"\n");
}
}

0 comments on commit 1c5338b

Please sign in to comment.