Skip to content
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

I18n: Allow setting the allowed text-domains via the command-line. #807

Merged
merged 1 commit into from
Jan 19, 2017

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Jan 18, 2017

For people who work on a lot of WP projects and want to use a generic custom ruleset, setting the text_domain property in the ruleset would mean they would either need to have - yet another - custom ruleset in each project or they would need to manually edit the ruleset each time they would run PHPCS.
Think: theme/plugin reviewers.

With that in mind, adding the ability to set the $text_domain property from the command-line as well, seemed a logical next step.

Inspired by a remark made by @grappler.

To use this from the command-line:
phpcs -p . --standard=WordPress --runtime-set text_domain my-slug,default

Notes:

  • The command line property is to be provided as a comma-delimited list without spaces in it.
  • The value passed via the command-line will overrule any value already set in a custom ruleset.
  • As this feature can also be used for the unit tests, removed the unit test specific static $text_domain_override property from the sniff class and changed the unit test code to use the command line property instead.

For people who work on a lot of WP projects and want to use a generic custom ruleset, setting the `text_domain` property in the ruleset would mean they would either need to have - yet another - custom ruleset in each project or they would need to manually edit the ruleset each time they would run PHPCS.
Think: theme/plugin reviewers.

With that in mind, adding the ability to set the `$text_domain` property from the command-line as well, seemed a logical next step.

Inspired by a remark made by @grappler.

To use this from the command-line:
`phpcs -p . --standard=WordPress --runtime-set text_domain my-slug,default`

Notes:
* The command line property is to be provided as a comma-delimited list without spaces in it.
* The value passed via the command-line will **overrule** any value already set in a custom ruleset.
* As this feature can also be used for the unit tests, removed the unit test specific static `$text_domain_override` property from the sniff class and changed the unit test code to use the command line property instead.
@GaryJones GaryJones merged commit dea3335 into develop Jan 19, 2017
@GaryJones GaryJones deleted the feature/i18n-allow-cl-textdomain-passing branch January 19, 2017 08:03
@jrfnl jrfnl removed the request for review from westonruter January 19, 2017 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants