apply_filters( 'ngettext', $translation, $single, $plural, $number, $domain )
参数
  • (string) $translation Translated text.
    Required:
  • (string) $single The text to be used if the number is singular.
    Required:
  • (string) $plural The text to be used if the number is plural.
    Required:
  • (int) $number The number to compare against to use either the singular or plural form.
    Required:
  • (string) $domain Text domain. Unique identifier for retrieving translated strings.
    Required:
定义位置
相关勾子
gettextwidget_textget_termget_sitengettext_domain
相关方法
__ngettext__ngettext_noopget_termget_siteget_the_excerptget_the_tags
引入
2.2.0
弃用
-

ngettext是一个WordPress函数,用于在你的主题或插件中翻译支持复数的字符串信息。它允许你翻译一个基于数字值的、可以以不同形式出现的字符串: 该函数接受两个参数,一个单数字符串和一个复数字符串,并根据传递给它的数字参数返回适当的形式。例如,如果数字参数是1,它返回单数形式,如果数字参数大于1,它返回复数形式。

过滤一个字符串的单数或复数形式。

$translation = apply_filters( 'ngettext', $translation, $single, $plural, $number, $domain );

常见问题

FAQs
查看更多 >