-
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
Command to add text domains to i18n functions #25
Comments
This would mean we need to work with the AST of PHP / JavaScript file. #26 already uses a JS AST parser. https://github.com/nikic/PHP-Parser is a popular one for PHP. It would make sense to use that for the |
After looking at #28 I think this command would need:
|
@swissspidy is there any update on this ? |
@swissspidy how can i use |
@varunsridharan No update I am afraid. However, you can achieve this using the WordPress-Coding-Standards PHPCS configuration as long as you set your text domain accordingly. I think that is probably the best solution for this specific task. Once you've configured PHPCS with the WordPress coding standards, you can use phpcbf to automatically fix any i18n functions that don't use your required text domain. |
@swissspidy thanks for your faster reply. well i work on quite a lot of projects and i use common rules-set.xl in phpstorm and i dont think that will work for me :-( |
I think that should still work. You don't have to include all of WPCS in your ruleset, just the text domain sniff is enough. Then, you can even auto-fix things directly in PHPStorm. |
Based on my testing i can say that PHPStorm dose not support multiple ruleset in a single project. |
@swissspidy thanks for your time. i was not able to get this done using PHPStrom / Rule set not sure why may be i was doing something wrong. and i created a simple composer package which dose this job |
Closing for now as this seems better suited for a tool like PHPCS, as mentioned in the discussion above. https://github.com/varunsridharan/wp-cli-textdomain exists for people who want a dedicated command/script. |
It might be a good time to think about a
wp i18n add-text-domain
command.See #7, #11 for discussions / some background about this.
The text was updated successfully, but these errors were encountered: