__ngettext()根据总数检查单复数形式

目录

描述

译文

根据总数检查单复数形式。

如果域名不在$110n列表中,会做出一个比较,返回$plural或$single参数。

如果域名存在,$single、$plural与$number会首先被传递到域名的ngettext方法。之后域名与这些参数会被传递到'ngettext'过滤器钩子中。预计返回类型是字符串。

原文

Retrieve the plural or single form based on the amount.

If the domain is not set in the $l10n list, then a comparsion will be made and either $plural or $single parameters returned.

If the domain does exist, then the parameters $single, $plural, and $number will first be passed to the domain's ngettext method. Then it will be passed to the 'ngettext' filter hook along with the same parameters. The expected type will be a string.

__ngettext() 描述

用法

<?php __ngettext$single$plural$number$domain ?>

__ngettext() 用法

参数

$single

(string) (必填) The text that will be used if $number is 1

默认值: None

$plural

(string) (必填) The text that will be used if $number is not 1

默认值: None

$number

(integer) (必填) The number to compare against to use either $single or $plural

默认值: None

$domain

(string) (可选) The domain identifier the text should be retrieved in

默认值: 'default'

__ngettext() 参数

返回值

(string) 

Either $single or $plural translated text

__ngettext() 返回值

注意

  • 使用到: apply_filters() 调用 'ngettext' hook on domains text returned, along with $single, $plural, and $number parameters. Expected to return string.
  • 使用到 global: (array) $l10n Gets list of domain translated string (gettext_reader) objects.
  • l10n is an abbreviation for localization.
  • This function name has two leading underscores in a row. In some fonts it looks like one long underscore.

__ngettext() 注意

历史

  • 添加于 版本: 1.2.0
  • Deprecated: 2.8.0

__ngettext() 历史

源文件

__ngettext() was located in wp-includes/l10n.php. As of Version 2.8 it was moved to wp-includes/deprecated.php.

__ngettext() 源文件

相关