bug #30951 Handle case where no translations were found (greg0ire)
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
-------
79b1fb8333
Handle case where no translations were found
This commit is contained in:
commit
3d6f15251a
@ -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