Suggestion #9077

format.numberChoice

Added by Christian Zenker over 9 years ago. Updated about 9 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Start date:
2010-07-29
Due date:
% Done:

0%

Has patch:
Tags:

Description

This ViewHelper is a port of Symfony's format_number_choice() helper.

You can use it to render different strings depending on a given number. In the simplest of cases it can be used to have correct singulars and plurals. It also works well with localized strings.

Example:

<f:format.numberChoice number="42" arguments="{number:42}">[0] no eggs|[1] 1 egg|[2,+Inf] ###number### eggs</f:format.numberChoice>

will output
42 eggs

Also available in: Atom PDF