-
Notifications
You must be signed in to change notification settings - Fork 112
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
Update TextDomain_Check #389
Conversation
Sorry if I’m missing some steps but the check did not indicate the line number nor the file name. Also, this is very unlikely case, but I replaced all text domains on all files, except the one on the style.css. The test not only returned no warning but also confirmed the text domain was |
Thanks for the PR! It looks like it mentions showing the line number where the error occurred, but so far only shows the file name, which is a great start. Other changes and documentation improvements also look good to me. Displaying the line number in other classes appears to be done via a call I could not reproduce performance issues with this check yet, I guess I need a theme with more PHP files in it :) But it looks like as of commit 5eed747 for #370, each call to
Thanks for testing! While these messages are related, there are more general and indeed don't include a file name or line number, as they can apply to multiple files at once. This PR is about the other two, more specific messages in the same class:
You should be able to see them if you pass only one argument to the |
I see a similar message while checking with non-twenty themes. I haven't checked it with twenty- themes. WARNING More than one text domain is being used in this theme. This means the theme will not be compatible with WordPress.org language packs. The domains found are master, kafleg, apple, new. |
@kafleg Please provide the code that is causing the error. |
I must have left out the line numbers while I was troubleshooting, I am re-adding them in a bit. |
I have re-added the line numbers, but the check is not accurate enough. So the issue is with the string that is fed into tc_grep() on lines 121 and 161. Test theme with known issues: https://themes.trac.wordpress.org/ticket/104185 Result:
|
Improve accuracy of the report by checking if the line includes both the translation function and the argument before displaying the report.
Before After ad27e9c, only the line with the problem is showing: |
Worked for me! Message I got while testing on different scenario.
|
This PR:
How to test:
In your test theme, include any or all of the translation functions in the rules array,
but without text domain or with an invalid amount of parameters.
For example, '_n' expects 3 or 4 parameters, and to test it, you would add only one or two.
Known issues:
The check is very slow.
This PR should not be merged until it's fast enough and any timeout issues have been solved.