StringTemplate
StringTemplate copied to clipboard
Support for human-readable booleans
The only thing that I really miss from this template engine is a support for different placeholders for booleans.
For example:
$engine->render("The engine is turned {status|on|off}.", ['status' => true]); // The engine is turned on
$engine->render("The engine is turned {electricity|on|off}.", ['electricity' => false]); // The light is turned off
Do you have an idea how this could be added?
Of course, I can use ternary operator in the values, but when it comes to real case (i.e. the data comes from 3rd party library) it would be much simpler to place the desired values in the template.