diff options
author | Filip Komar <filip@mageia.org> | 2014-03-05 20:14:12 +0000 |
---|---|---|
committer | Filip Komar <filip@mageia.org> | 2014-03-05 20:14:12 +0000 |
commit | 140f314e64631208f259f889b60789c07b99bef7 (patch) | |
tree | 6fe9c33ddf16d8d41b1555ed1e958e35747ca792 /tools/extract2gettext.php | |
parent | ea3fd5fed461738c9f5d3eda76622ee936a4f280 (diff) | |
download | www-140f314e64631208f259f889b60789c07b99bef7.tar www-140f314e64631208f259f889b60789c07b99bef7.tar.gz www-140f314e64631208f259f889b60789c07b99bef7.tar.bz2 www-140f314e64631208f259f889b60789c07b99bef7.tar.xz www-140f314e64631208f259f889b60789c07b99bef7.zip |
script translated_converter.py adjusted for the need + some error managament improvemnts + bug fixes
Diffstat (limited to 'tools/extract2gettext.php')
-rw-r--r-- | tools/extract2gettext.php | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/tools/extract2gettext.php b/tools/extract2gettext.php index 0b1687540..424bb9172 100644 --- a/tools/extract2gettext.php +++ b/tools/extract2gettext.php @@ -54,8 +54,8 @@ $f = array(); $error = 0; if(count($out) == 0) { - echo "No strings to save from $php_source.\n"; - $error = 1; + if(!$quiet) { echo "No strings to save from $php_source.\n"; } + $error = 10; } foreach ($out as $str) { @@ -74,9 +74,10 @@ foreach ($out as $str) { } } else { - echo "\n\n!!!! Could not find string in $file, line $line: $str\n"; - echo "!!!! Please fix $file before using $domain.pot file!!!\n\n"; - $error = 2; + $parse_error = "\n\n!!!! Could not find string in $file, line $line: $str\n"; + $parse_error .= "!!!! Parse error, please fix $file before using $domain.pot file!!!\n\n"; + if(!$quiet) { echo $parse_error; } + $error = 20; } } @@ -121,13 +122,13 @@ foreach ($strings as $domain => $strs) { $dir = dirname($dest); if (!is_dir($dir)) { - echo "making $dir\n"; + if(!$quiet) { echo "making $dir\n"; } mkdir($dir, 0755, true); } - echo sprintf("saved %d strings in %s\n", count($strs), $dest); + if(!$quiet) { echo sprintf("saved %d strings in %s\n", count($strs), $dest); } if (FALSE === file_put_contents($dest, $f)) { - echo "Failed to write.\n"; - $error = 3; + if(!$quiet) { echo "Failed to write $f to $dest.\n"; } + $error = 30; } } if(!$quiet) { echo "Done. thxbye.\n"; } |