Make translation-checker.php less verbose.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
This commit is contained in:
Daniel Kesselberg 2020-07-14 22:05:11 +02:00
parent 8f78205be0
commit 5ffe9fc7db
No known key found for this signature in database
GPG Key ID: 36E3664E099D0614
1 changed files with 5 additions and 8 deletions

View File

@ -21,7 +21,6 @@
$directories = [ $directories = [
__DIR__ . '/../core/l10n', __DIR__ . '/../core/l10n',
__DIR__ . '/../settings/l10n',
]; ];
$apps = new \DirectoryIterator(__DIR__ . '/../apps'); $apps = new \DirectoryIterator(__DIR__ . '/../apps');
@ -34,6 +33,7 @@ foreach ($apps as $app) {
} }
$errors = []; $errors = [];
$valid = 0;
foreach ($directories as $dir) { foreach ($directories as $dir) {
if (!file_exists($dir)) { if (!file_exists($dir)) {
continue; continue;
@ -49,21 +49,18 @@ foreach ($directories as $dir) {
$json = json_decode($content, true); $json = json_decode($content, true);
if (json_last_error() !== JSON_ERROR_NONE) { if (json_last_error() !== JSON_ERROR_NONE) {
echo '[Error] Could not parse: ' . $file->getPathname() . "\n";
echo ' ' . json_last_error_msg() . "\n";
$errors[] = $file->getPathname() . "\n" . ' ' . json_last_error_msg() . "\n"; $errors[] = $file->getPathname() . "\n" . ' ' . json_last_error_msg() . "\n";
} else { } else {
echo '[OK] ' . $file->getPathname() . "\n"; $valid++;
} }
} }
} }
echo "\n\n";
if (count($errors) > 0) { if (count($errors) > 0) {
echo sprintf('ERROR: There were %d errors:', count($errors)) . "\n"; echo sprintf('ERROR: There were %d errors:', count($errors)) . "\n\n";
echo implode("\n", $errors) . "\n"; echo implode("\n", $errors);
exit(1); exit(1);
} }
echo 'OK: all files parse' . "\n"; echo 'OK: ' . $valid . ' files parse' . "\n";
exit(0); exit(0);