Documentation

MessageSelector
in package

Table of Contents

choose()  : mixed
Select a proper translation string based on the given number.
getPluralIndex()  : int
Get the index to use for pluralization.
extract()  : mixed
Extract a translation string using inline conditions.
extractFromString()  : mixed
Get the translation string if the condition matches.
stripConditions()  : array<string|int, mixed>
Strip the inline conditions from each segment, just leaving the text.

Methods

choose()

Select a proper translation string based on the given number.

public choose(string $line, int $number, string $locale) : mixed
Parameters
$line : string
$number : int
$locale : string
Return values
mixed

getPluralIndex()

Get the index to use for pluralization.

public getPluralIndex(string $locale, int $number) : int

The plural rules are derived from code of the Zend Framework (2010-09-25), which is subject to the new BSD license (http://framework.zend.com/license/new-bsd) Copyright (c) 2005-2010 - Zend Technologies USA Inc. (http://www.zend.com)

Parameters
$locale : string
$number : int
Return values
int

extract()

Extract a translation string using inline conditions.

private extract(array<string|int, mixed> $segments, int $number) : mixed
Parameters
$segments : array<string|int, mixed>
$number : int
Return values
mixed

extractFromString()

Get the translation string if the condition matches.

private extractFromString(string $part, int $number) : mixed
Parameters
$part : string
$number : int
Return values
mixed

stripConditions()

Strip the inline conditions from each segment, just leaving the text.

private stripConditions(array<string|int, mixed> $segments) : array<string|int, mixed>
Parameters
$segments : array<string|int, mixed>
Return values
array<string|int, mixed>

Search results