williamisted / plural
Simple plural plugin for Craft - Usage: {{ entries | length | plural('result') }}
Installs: 95
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 2
Forks: 2
Type:craft-plugin
Requires
- craftcms/cms: ^3.0.0-RC1
This package is auto-updated.
Last update: 2024-12-12 13:44:17 UTC
README
Simple plural plugin for Craft
Requirements
This plugin requires Craft CMS 3.0.0-beta.23 or later.
Installation
To install the plugin, follow these instructions.
-
Open your terminal and go to your Craft project:
cd /path/to/project
-
Then tell Composer to load the plugin:
composer require WilliamIsted/plural
-
In the Control Panel, go to Settings → Plugins and click the “Install” button for Plural.
Using Plural
Twig filter: {{ powerPlant.lastAccident | plural( 'day' ) }} since last accident.
Twig function: {% set dayPlural = plural( powerPlant.lastAccident, 'day' ) %}{{ dayPlural }} since last accident.
{{ entries | length | plural('result') }} found.
Output: 2 results found.
{{ 0 | plural('result') }} found.
Output: 0 results found.
{{ 1 | plural('result') }} found.
Output: 0 result found.
{{ 1 | plural('result', 'foobars') }} found.
Output: 1 result found.
{{ 2 | plural('result', 'foobars') }} found.
Output: 2 foobars found.
Plural Roadmap
Some things to do, and ideas for potential features:
- If you have any simple functionality improvements to propose or issues, create a ticket here: GitHub
Brought to you by William Isted