$_nplurals
$_nplurals
make_entry(string $original, string $translation)
Build a Translation_Entry from original string and translation strings, found in a MO file
string | $original | original string to translate from MO file. Might contain
|
string | $translation | translation string from MO file. Might contain
|
select_plural_form(integer $count)
Given the number of items, returns the 0-based index of the plural form to use
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 overrided by the sub-classes. For example MO/PO can derive the logic from their headers.
integer | $count | number of items |
parenthesize_plural_exression(string $expression) : string
Adds parantheses to the inner parts of ternary operators in plural expressions, because PHP evaluates ternary oerators from left to right
string | $expression | the expression without parentheses |
the expression with parentheses added
set_header(string $header, string $value)
Sets $header PO header to $value
If the header already exists, it will be overwritten
TODO: this should be out of this class, it is gettext specific
string | $header | header name, without trailing : |
string | $value | header value, without trailing \n |