A linting and fixing tool for WordPress plugin and theme textdomains in PHP files. Version 1.0.1 is latest. It scans PHP files using glob patterns and validates/replaces textdomain arguments in gettext functions like __, _e, _x, etc. Supports multiple domains in an array, automatic fixes (fix option), and custom keyword definitions. Key differentiators: specifically designed for WordPress, unlike general PHP linters; can fix missing or incorrect textdomains; configurable via options like engine (php-parser), variableDomain, and missingDomain.
npm install wp-textdomainNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic linting and fixing of WordPress textdomains in PHP files using wp-textdomain.
Always ensure the primary domain is listed first in the domain array when fix:true.
Test with your codebase and consider reporting issues on GitHub.
Consider using a custom date function or a lightweight alternative.
Ensure options object is provided with a 'domain' property (string or array).
Double-check the pattern and working directory; use an absolute path if needed.
Temporarily remove or fix the problematic PHP syntax, or update php-parser settings.