|
static | getPluralRule ( $code) |
| Returns Gettext plural rule for given language.
|
|
static | getPluralCount ( $rule) |
| Returns how many plural forms are expected by a given plural rule.
|
|
static | hasPlural ( $text) |
| Quick way to check if the text contains plural syntax.
|
|
static | flatten (array $forms) |
| Format plural forms as single string suitable for translation.
|
|
static | unflatten ( $text, $expectedPluralCount) |
| Format translation with plural forms as array of forms.
|
|
static | parsePluralForms ( $text) |
| Parses plural markup into a structure form.
|
|
static | expandTemplate ( $template, array $instanceMap, $expectedPluralCount) |
| Gives fully expanded forms given a template and parsed plural markup instances.
|
|
- Since
- 2019.09
Definition at line 14 of file GettextPlural.php.
◆ expandTemplate()
static MediaWiki\Extension\Translate\Utilities\GettextPlural::expandTemplate |
( |
| $template, |
|
|
array | $instanceMap, |
|
|
| $expectedPluralCount ) |
|
static |
Gives fully expanded forms given a template and parsed plural markup instances.
- Parameters
-
string | $template | |
array | $instanceMap | |
int | $expectedPluralCount | |
- Returns
- string[]
Definition at line 181 of file GettextPlural.php.
◆ flatten()
static MediaWiki\Extension\Translate\Utilities\GettextPlural::flatten |
( |
array | $forms | ) |
|
|
static |
Format plural forms as single string suitable for translation.
- Parameters
-
- Returns
- string
Definition at line 78 of file GettextPlural.php.
◆ getPluralCount()
static MediaWiki\Extension\Translate\Utilities\GettextPlural::getPluralCount |
( |
| $rule | ) |
|
|
static |
Returns how many plural forms are expected by a given plural rule.
- Parameters
-
string | $rule | Gettext style plural rule. |
- Returns
- int
- Exceptions
-
Definition at line 53 of file GettextPlural.php.
◆ getPluralRule()
static MediaWiki\Extension\Translate\Utilities\GettextPlural::getPluralRule |
( |
| $code | ) |
|
|
static |
Returns Gettext plural rule for given language.
- Parameters
-
string | $code | Language tag in MediaWiki internal format. |
- Returns
- string Empty string if no plural rule found
Definition at line 24 of file GettextPlural.php.
◆ hasPlural()
static MediaWiki\Extension\Translate\Utilities\GettextPlural::hasPlural |
( |
| $text | ) |
|
|
static |
Quick way to check if the text contains plural syntax.
- Parameters
-
- Returns
- bool
Definition at line 68 of file GettextPlural.php.
◆ parsePluralForms()
static MediaWiki\Extension\Translate\Utilities\GettextPlural::parsePluralForms |
( |
| $text | ) |
|
|
static |
Parses plural markup into a structure form.
- Parameters
-
- Returns
- array [ string $template, array $instanceMap ]
Definition at line 139 of file GettextPlural.php.
◆ unflatten()
static MediaWiki\Extension\Translate\Utilities\GettextPlural::unflatten |
( |
| $text, |
|
|
| $expectedPluralCount ) |
|
static |
Format translation with plural forms as array of forms.
Reverse of flatten. Do note that A may be != flatten( unflatten( A ) ) because translators can place part of the text outside the plural markup or use multiple instances of the markup.
- Parameters
-
string | $text | |
int | $expectedPluralCount | |
- Returns
- string[]
Definition at line 93 of file GettextPlural.php.
The documentation for this class was generated from the following file: