Fully Qualified Name: | Laminas\I18n\View\Helper\Plural |
Extends: | AbstractHelper |
Helper for rendering text based on a count number (like the I18n plural translation helper, but when translation is not needed).
Please note that we did not write any hard-coded rules for languages, as languages can evolve, we preferred to let the developer define the rules himself, instead of potentially break applications if we change rules in the future.
However, you can find most of the up-to-date plural rules for most languages in those links:
- http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
- https://developer.mozilla.org/en-US/docs/Localization_and_Plurals
Name | Description | Defined By |
---|---|---|
__construct() | Plural | |
__invoke() | Given an array of strings, a number and, if wanted, an optional locale (the default one is used otherwise), this picks the right string according to plural rules of the locale | Plural |
getPluralRule() | Get the plural rule to use | Plural |
getView() | Get the view object | AbstractHelper |
setPluralRule() | Set the plural rule to use | Plural |
setView() | Set the View object | AbstractHelper |
Returns:
Given an array of strings, a number and, if wanted, an optional locale (the default one is used otherwise), this picks the right string according to plural rules of the locale
Parameter Name | Type | Description |
---|---|---|
$strings | array|string | |
$number | int |
Returns: string
Get the plural rule to use
Returns: \PluralRule
Get the view object
Returns: null|\Renderer
Set the plural rule to use
Parameter Name | Type | Description |
---|---|---|
$pluralRule | \PluralRule|string |
Returns: $this
Set the View object
Parameter Name | Type | Description |
---|---|---|
$view | \Renderer |
Returns: \AbstractHelper