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:
parent
98f26cb628
commit
79b1fb8333
@ -159,6 +159,11 @@ function printTitle($title)
|
|||||||
|
|
||||||
function printTable($translations, $verboseOutput)
|
function printTable($translations, $verboseOutput)
|
||||||
{
|
{
|
||||||
|
if (0 === count($translations)) {
|
||||||
|
echo 'No translations found';
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
$longestLocaleNameLength = max(array_map('strlen', array_keys($translations)));
|
$longestLocaleNameLength = max(array_map('strlen', array_keys($translations)));
|
||||||
|
|
||||||
foreach ($translations as $locale => $translation) {
|
foreach ($translations as $locale => $translation) {
|
||||||
|
Reference in New Issue
Block a user