ngettext
(PHP 4 >= 4.2.0, PHP 5, PHP 7)
ngettext — gettext の複数形版
説明
ngettext
( string $singular
, string $plural
, int $count
) : string
複数形版の gettext() です。 言語によっては、数量に応じていくつかの複数形が存在することがあります。
パラメータ
singular
- 単数形のメッセージ ID。
plural
- 複数形のメッセージ ID。
count
- 数 (件数など)。この数にあわせて翻訳を決定します。
返り値
singular
および plural
で表されるメッセージの、数 count
に対応する複数形を返します。
例
例1 ngettext() の例
<?phpsetlocale(LC_ALL, 'cs_CZ');printf(ngettext("%d window", "%d windows", 1), 1); // 1 oknoprintf(ngettext("%d window", "%d windows", 2), 2); // 2 oknaprintf(ngettext("%d window", "%d windows", 5), 5); // 5 oken?>