What are you using for gettext string extraction

Ajax
Member | 61
+
0
-

Hello everyone!

I need to upgrade an old project from PHP 7.4 to 8.4. It uses Nette Database and Nette Latte. The upgrade went smoothly thanks to Rector, but I’ve hit a problem extracting strings for gettext translations. The old app used voda/gettext-extractor, which now appears to be abandoned.

So my question is: what are you using for string extraction and .pot file generation in 2025? I can’t find a suitable replacement. Thanks for any tips!

sun-med
Member | 1
+
0
-

Hi there!

I’ve faced a similar situation recently. Since voda/gettext-extractor seems unmaintained now, I’ve switched to using PHP-Gettext-Extractor by raulfraile. It's not super active either, but still works quite well and can handle basic extraction if your codebase sticks to standard gettext function calls like __(‘…’).

If you're using Latte templates heavily, you might want to check out Latte Tools, which has some support for static analysis. Alternatively, a custom script with regex or token parsing (paired with xgettext or Poedit) might be necessary, depending on your template complexity.

Another option worth exploring is using the Symfony Translation component if you're open to switching formats—though it’s not gettext-based, it's actively maintained and has decent tooling.

Let me know if you want a sample config or extraction script—I’d be happy to share what worked for me.

Good luck with the upgrade!

Ajax
Member | 61
+
0
-

For future readers: Because all projects are abandoned or does not support PHP 8.4, I ended with approach "Compile all .latte to PHP, transform all translate calls to native gettext format and run official gettext/gettext with PHP parser. It was easier, than debug and tune old projects. Thanks for tips!