-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP i18n functions prefixed with a slash are ignored #344
Comments
Well that is surprising! Looks like the PHP functions scanner we're using doesn't properly extract such functions call, so unfortunately this will need to get fixed upstream. |
Just adding a note here that this isn't likely to be fixed in the Gettext repo any time soon due to time constraints; incase anyone from the wp-cli team is able to pick this up. |
It might be good to know that this seems to work well on PHP 7.4, but it goes wrong in PHP 8.
A workaround is to run
|
Maybe it's related to a In PHP In PHP It could be fixed by adding And by adding fully qualified function names ( i18n-command/src/PhpCodeExtractor.php Lines 17 to 33 in c1beab8
|
Interesting, yeah that might be it. In any case, it needs a volunteer to submit a PR to the Gettext library to help fix this properly :) |
The https://github.com/php-gettext/Gettext library is already moved on the version |
Yes it's quite possible, but we cannot use the newer version yet because of PHP version requirements. |
See following issues for more details: - php-gettext#284 - wp-cli/i18n-command#344
I have come up with a fix and opened a PR: I don't have much experience with this, but I did my best to contribute. |
Awesome, thanks a lot! And it has been merged, too! Once a new release of Gettext v4 has been released, we can update the dependency here & update our tests too. Then we should be all set. |
ℹ️ Version |
Working on adding a test here: #344 Updating the dependency here: |
* main: Escape backslashes Add test for wp-cli#344 PHP 8.2: fix "Using ${var} in strings is deprecated, use {$var} instead"
Bug Report
Running the latest version of
wp-cli
(2.7.1) i18n functions prefixed with a slash are ignored. I need to prefix with a slash as I'm using PHP namespaces in my project.Minimal reproducible example:
The output from the snippet above is:
The text was updated successfully, but these errors were encountered: