Skip to content

Commit

Permalink
bug #30951 Handle case where no translations were found (greg0ire)
Browse files Browse the repository at this point in the history
This PR was merged into the 3.4 branch.

Discussion
----------

Handle case where no translations were found

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Right now, the program emits a warning when trying to use max() on an
empty array.

Commits
-------

79b1fb8 Handle case where no translations were found
  • Loading branch information
fabpot committed Apr 7, 2019
2 parents 1f48f7b + 79b1fb8 commit 3d6f152
Showing 1 changed file with 5 additions and 0 deletions.
Expand Up @@ -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) {
Expand Down

0 comments on commit 3d6f152

Please sign in to comment.