php-gettext / Gettext

PHP library to collect and manipulate gettext (.po, .mo, .php, .json, etc)
MIT License
687 stars 132 forks source link

Gettext doesn`t extract template literals from JS #275

Open DaweTaller opened 2 years ago

DaweTaller commented 2 years ago

Hi,

in version 4.6.1 library work fine with extracting translations from template literals in JS files, but after upgrade to 4.8 library doesnt extract translations from template literals for example new version doesnt extract "Foo" from string Text ${__("Foo")} bar but older version does.

Unfortunately I didn`t found solution or some clues to resolve this problem...

Thanks for response.

oscarotero commented 2 years ago

The javascript extractor in version 4.x is very rudimentary. I recommend to upgrade to Gettext 5.x and use JS-Scanner that provide a much more powerful solution, due it uses mck89/peast under the hood.