davedevelopment/twig-inflection

Twig filters for inflection

1.0 2013-02-19 00:24 UTC

This package is auto-updated.

Last update: 2024-10-16 19:40:55 UTC


README

pluralize

{{ "chicken"|pluralize }}

=> chickens

{{ rows.length }} {{ "row"|pluralize(rows.length) }}

=> 1 row
=> 2 rows

{{ users.length }} {{ "person"|pluralize(users.length, "users") }}

=> 1 person
=> 2 users

singularize

The opposite of pluralize, working in the same manner

{{ "chickens"|singularize }}

=> chicken

Contributing

Get in touch before hacking on anything, I've no idea what I might be doing, the whole library may have changed since my last push :)

Copyright

Copyright (c) 2013 Dave Marshall. See LICENCE for further details