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,它返回複數形式。

過濾一個字串的單數或複數形式。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$translation = apply_filters( 'ngettext', $translation, $single, $plural, $number, $domain );
$translation = apply_filters( 'ngettext', $translation, $single, $plural, $number, $domain );
$translation = apply_filters( 'ngettext', $translation, $single, $plural, $number, $domain );

常見問題

FAQs
檢視更多 >