Handle case where no translations were found

Right now, the program emits a warning when trying to use max() on an
empty array.
This commit is contained in:
Grégoire Paris 2019-04-07 09:54:46 +02:00
parent 98f26cb628
commit 79b1fb8333
No known key found for this signature in database
GPG Key ID: 6CE0C6A7B0858F70
1 changed files with 5 additions and 0 deletions

View File

@ -159,6 +159,11 @@ function printTitle($title)
function printTable($translations, $verboseOutput)
{
if (0 === count($translations)) {
echo 'No translations found';
return;
}
$longestLocaleNameLength = max(array_map('strlen', array_keys($translations)));
foreach ($translations as $locale => $translation) {