php - Twig Sprintf Gettext -


my question refers twig extension:

https://github.com/deceze/twig-extensions/blob/master/doc/gettext.rst

if use example:

<p>{{ _n('one day without accident.', '%d days without accident.', n)|format(n) }}</p> 

so how can parse variables twig?

i mean %d in example

it first time need use sprintf.

the %d stands number. format filter replace these parameters given filter. placeholders (usually %s or %d) replaced correspondending parameters. first placeholder value form first argument , second second argument ect.

for more information, see php reference: http://php.net/sprintf


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -