envato / envato-theme-check

The WordPress Theme Check plugin for Envato
GNU General Public License v2.0
208 stars 57 forks source link

Text domain check failed inside _n() function with array value used #30

Closed nk-o closed 3 years ago

nk-o commented 6 years ago

PHP:

echo esc_html( sprintf( _n( '%s comment', '%s comments', $args['comments_number'], 'my_domain' ), $args['comments_number'] ) );

Parser thinking comments_number is text domain.

More than one text-domain is being used in this theme. This means the theme will not be compatible with WordPress.org language packs.
The domains found are my_domain, comments_number

This one works fine:

$comments_number = $args['comments_number'];

echo esc_html( sprintf( _n( '%s comment', '%s comments', $comments_number , 'my_domain' ), $comments_number  ) );
scottparry commented 3 years ago

This is really only relevant to WordPress.org language packs.