WordPress函数文档__ngettext()

根据总数检查单复数形式 描述 译文 根据总数检查单复数形式。 如果域名不在$110n列表中,会做出一个比较,返…

根据总数检查单复数形式

描述

译文

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

如果域名不在$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.

用法

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

参数

$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’

返回值

(string) 

Either $single or $plural translated text

注意

  • 使用到: 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.

历史

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

源文件

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

相关

L10n:
translate(),
__(),
_e(),
_n(),
_x(),
_ex(),
_nx(),
esc_attr__(),
esc_attr_e(),
esc_attr_x(),
esc_html__(),
esc_html_e(),
esc_html_x(),
_n_noop(),
_nx_noop(),
translate_nooped_plural()

  • 原文:http://codex.wordpress.org/Function_Reference/_2ngettext
类别:WordPress函数文档

本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

评论 (0)COMMENT