@license GPL-2.0-or-later
More...
|
| static | getPluralRule (string $code) |
| | Returns Gettext plural rule for given language.
|
| |
| static | getPluralCount (string $rule) |
| | Returns how many plural forms are expected by a given plural rule.
|
| |
| static | hasPlural (string $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 (string $text, int $expectedPluralCount) |
| | Format translation with plural forms as array of forms.
|
| |
| static | parsePluralForms (string $text) |
| | Parses plural markup into a structure form.
|
| |
| static | expandTemplate (string $template, array $instanceMap, int $expectedPluralCount) |
| | Gives fully expanded forms given a template and parsed plural markup instances.
|
| |
@license GPL-2.0-or-later
- Since
- 2019.09
Definition at line 13 of file GettextPlural.php.
◆ expandTemplate()
| static MediaWiki\Extension\Translate\Utilities\GettextPlural::expandTemplate |
( |
string | $template, |
|
|
array | $instanceMap, |
|
|
int | $expectedPluralCount ) |
|
static |
Gives fully expanded forms given a template and parsed plural markup instances.
- Returns
- string[]
Definition at line 168 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
-
Definition at line 72 of file GettextPlural.php.
◆ getPluralCount()
| static MediaWiki\Extension\Translate\Utilities\GettextPlural::getPluralCount |
( |
string | $rule | ) |
|
|
static |
Returns how many plural forms are expected by a given plural rule.
- Parameters
-
| string | $rule | Gettext style plural rule. |
- Exceptions
-
Definition at line 51 of file GettextPlural.php.
◆ getPluralRule()
| static MediaWiki\Extension\Translate\Utilities\GettextPlural::getPluralRule |
( |
string | $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 23 of file GettextPlural.php.
◆ hasPlural()
| static MediaWiki\Extension\Translate\Utilities\GettextPlural::hasPlural |
( |
string | $text | ) |
|
|
static |
Quick way to check if the text contains plural syntax.
Definition at line 63 of file GettextPlural.php.
◆ parsePluralForms()
| static MediaWiki\Extension\Translate\Utilities\GettextPlural::parsePluralForms |
( |
string | $text | ) |
|
|
static |
Parses plural markup into a structure form.
- Returns
- array{0:string,1:array} [ string $template, array $instanceMap ]
- Exceptions
-
Definition at line 129 of file GettextPlural.php.
◆ unflatten()
| static MediaWiki\Extension\Translate\Utilities\GettextPlural::unflatten |
( |
string | $text, |
|
|
int | $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.
- Returns
- string[]
Definition at line 85 of file GettextPlural.php.
The documentation for this class was generated from the following file: