Otto42/theme-check — pull request #12 by ryelle (2014-11-17 03:03:07+00:00)
Title: Updates to textdomain checks

This pull request uses a different regular expression for finding the translation functions and strings, and combines the I18NCheck and TextDomainCheck, with some added features.

* This checks `__()`, `_e()`, `_x()`, `_n()`, and `_nx()` for textdomains
* It looks for and checks against the theme's Text Domain (as defined in style.css) or the theme slug, throwing a warning (recommended) if the textdomain doesn't match. This may be overly aggressive, since theme devs can have a second textdomain for frameworks, and this would alert for each use of that allowed extra. In my use, though, it's been helpful to locate extra invalid domains.
* Using the tokenizer from I18NCheck, make sure the textdomain is not a variable, constant, or unquoted string.
* Finally, count and list all unique textdomains used by the theme, and raise a warning (recommended) if there are more than 2.

This doesn't get stuck on parentheses like mentioned in #3, but like the existing regular expression it does skip strings with quotes-- ` _e( "I'm an example" );` is not detected.