nl_tokens: Validate the regular placeholders of an item . This possibly modifies the given validationErrors .
pl_tokens: function validatePlaceholders ( { id , idPlural , translations } , validationErrors ) { // search for {{placeholderName}} // Also search for e.g. Chinese symbols in the placeholderName let pattern = / {{\s*(\S+?)\s*?}} / g ; let placeholders = id . match ( pattern ) || [ ] ; // We also want to add placeholders from the plural string if ( idPlural ) { let pluralPlaceholders = idPlural . match ( pattern ) || [ ] ; pluralPlaceholders . forEach ( ( placeholder ) => { if ( ! placeholders . <mask> ( placeholder ) ) { placeholders . push ( placeholder ) ; } } ) ; } if ( ! placeholders . length ) { return ; } translations . forEach ( ( translation ) => { let translatedPlaceholders = translation . match ( pattern ) || [ ] ; // Search for placeholders in the translated string that are not in the original string let invalidPlaceholder = translatedPlaceholders . find ( ( placeholder ) => ! placeholders . includes ( placeholder ) ) ; if ( invalidPlaceholder ) { validationErrors . push ( { id , translation , message : ` ${ invalidPlaceholder } ${ placeholders . join ( ', ' ) } ` , level : 'ERROR' } ) ; } } ) ; }