vslavik / poedit

Translations editor for Mac, Windows and Unix
https://poedit.net
MIT License
1.71k stars 274 forks source link

Extracting text from PHP files fails if there is an "indented" HEREDOC block #726

Closed LionelMarbot closed 2 years ago

LionelMarbot commented 2 years ago

Since PHP 7.3 it is possible to change the indentation of HEREDOC blocks.

So, instead of:

class Foo
{
    public function bar():void
    {
        $str = <<<EOL
This is some random text.

Over multiple lines.
EOL;

        echo __('This is text that should be translated.');
    }
}

We can now indent the HEREDOC block like this:

class Foo
{
    public function bar():void
    {
        $str = <<<EOL
            This is some random text.

            Over multiple lines.
            EOL;
           ^
           ^
           ^

        echo __('This is text that should be translated.');
    }
}

However, we noticed that whenever there is an indented HEREDOC block like the example above, any "PO" text after it will not be parsed anymore. If we use "Update from code" (within POEdit) and there is at least one indented HEREDOC block in the file, it will omit every PO text element after it.

If the HEREDOC is not indented (just as the first example above), everything works fine.

Is this issue related to POEdit or to gettext in general?

vslavik commented 2 years ago

Is this issue related to POEdit or to gettext in general?

GNU gettext in general and xgettext in particular. I see no mention of it in their bug tracker at http://savannah.gnu.org/bugs/?group=gettext

Supporting new language features is beyond what I can reasonably do in Poedit, I'm afraid. But I update bundled gettext binaries as soon as they are released, so the eventual fix will bubble up into Poedit quickly.

doiftrue commented 2 years ago

I have the same problem!