Only set text if a template replacement was made.

Fixes #11664