Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 738 Bytes

i18n-translator-comments.md

File metadata and controls

35 lines (26 loc) · 738 Bytes

Enforce adding translator comments (i18n-translator-comments)

If using translation functions with placeholders in them, they need accompanying translator comments.

Rule details

Examples of incorrect code for this rule:

var color = '';
sprintf( __( 'Color: %s' ), color );

var address = '';
sprintf( __( 'Address: %s' ), address );

// translators: %s: Name
var name = '';
sprintf( __( 'Name: %s' ), name );

Examples of correct code for this rule:

var color = '';
// translators: %s: Color
sprintf( __( 'Color: %s' ), color );

var address = '';
sprintf(
	// translators: %s: Address.
	__( 'Address: %s' ),
	address
);