Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/davedevelopment/twig-inflection
https://github.com/davedevelopment/twig-inflection
Last synced: 21 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/davedevelopment/twig-inflection
- Owner: davedevelopment
- License: mit
- Created: 2013-02-18T23:47:28.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2020-04-16T09:36:24.000Z (about 4 years ago)
- Last Synced: 2024-03-13T23:03:17.323Z (3 months ago)
- Language: PHP
- Size: 5.86 KB
- Stars: 4
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Lists
- awesome-twig - Inflection - Filters (singularize and pluralize) (Twig / Extensions)
- awesome-twig - Inflection - Filters (singularize and pluralize) (Twig / Extensions)
README
TwigInflection
==============pluralize
---------``` jinja
{{ "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
``` jinja
{{ "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