StringTemplate icon indicating copy to clipboard operation
StringTemplate copied to clipboard

Support for human-readable booleans

Open fracz opened this issue 8 years ago • 0 comments

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.

fracz avatar May 30 '17 19:05 fracz