WordPress / WordPress/plugin-check
Single file plugin text domain check yields mixed and incorrect expected strings
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 362
- Forks
- 126
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 22
Description
For a single file plugin with a text domain set, the WordPress.WP.I18n.TextDomainMismatch check relies on a plugin directory slug (non-existent in this context) and shows different results between the UI and CLI. It has been suggested that this check be bypassed for single-file plugins (hat tip @ernilambar).
To test this, I added the hello-dolly text domain to the hello.php plugin that ships with WP core (required to avoid an error with the WordPress.WP.I18n.MissingArgDomain check):
__( 'Quote from Hello Dolly song, by Jerry Herman:', 'hello-dolly' ),
Running PCP, the admin shows
Mismatched text domain. Expected 'plugins' but got 'hello-dolly'.
whereas the CLI returns
Mismatched text domain. Expected 'hello.php' but got 'hello-dolly'.
Originally reported at https://github.com/WordPress/plugin-check/issues/713#issuecomment-2408257109.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the WordPress.WP.I18n.TextDomainMismatch check and compare how the admin and CLI determine the expected text domain. Reproduce the discrepancy using the hello.php example with the hello-dolly domain. Done means single-file plugins are handled consistently and the admin and CLI no longer report different expected strings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- internationalization, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100