Translation functions must be called with a valid string literal as the text domain.
Examples of incorrect code for this rule:
__( 'Hello World' ); // unless allowedTextDomain contains 'default'
__( 'Hello World', 'default' ); // with allowedTextDomain = [ 'default' ]
__( 'Hello World', foo );
Examples of correct code for this rule:
__( 'Hello World' ); // with allowedTextDomain = [ 'default' ]
__( 'Hello World', 'foo-bar' ); // with allowedTextDomain = [ 'foo-bar' ]
This rule accepts a single options argument:
- Set
allowedTextDomain
to specify the list of allowed text domains, e.g.[ 'foo', 'bar' ]
. The default is[ 'default' ]
.