Skip to content

Getting "Undefined index: messages" Exception in MultidimensionalArrayTrait.php: 78 #3

@kajes

Description

@kajes

I'm using gettext/gettext and gettext/robo for translating two different (but interconnected) pages. The first I'm only using it to translate the js-files with no problem. The second one, however, translates both php- and js-files and Robo keeps throwing this error multiple times (presumably when it finds a translatable string.
This doesn't seem to bother much though since the Robo script finishes the scanning and generates a valid pot-file in the end.

Here's the error that gets printed when Robo has finished scanning:

ERROR: Invalid argument supplied for foreach() in [...]/vendor/gettext/gettext/src/Utils/MultidimensionalArrayTrait.php:78

Robofile.php:

require "../vendor/autoload.php";

class RoboFile extends \Robo\Tasks
{
    use Gettext\Robo\GettextScanner;

    public function gettext()
    {
        $this->taskGettextScanner()
            ->extract("../", "/.*\.js/")
            ->extract("../", "/.*\.php/")
            ->generate("messages.pot")
            ->run();
    }
}

Running a debugger when Robo runs gives the error in the title.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions