Translations::select_plural_form() WordPress Method
The Translations::select_plural_form() method is used to select the appropriate form of a string for a given number. It is used internally by the __() and _n() functions. This method accepts two parameters: $count (int) – The number of items $forms (array) – An array of strings containing the different forms of the string. The first form is used for singular, the second for two items, the third for three items, and so on. This method returns the appropriate form of the string for the given number.
Translations::select_plural_form( int $count ) #
Given the number of items, returns the 0-based index of the plural form to use
Description
Here, in the base Translations class, the common logic for English is implemented: 0 if there is one element, 1 otherwise
This function should be overridden by the subclasses. For example MO/PO can derive the logic from their headers.
Parameters
- $count
(int)(Required)number of items
Source
File: wp-includes/pomo/translations.php
public function select_plural_form( $count ) { return 1 == $count ? 0 : 1; }
Expand full source codeCollapse full source codeView on TracView on GitHub