translate_nooped_plural
函数
translate_nooped_plural ( $nooped_plural, $count, $domain = 'default' )
- 参数
-
-
(array)
$nooped_plural
{ Array that is usually a return value from _n_noop() or _nx_noop(). @type string $singular Singular form to be localized. @type string $plural Plural form to be localized. @type string|null $context Context information for the translators. @type string|null $domain Text domain. }- Required: 是
-
(int)
$count
Number of objects.- Required: 是
-
(string)
$domain
Optional. Text domain. Unique identifier for retrieving translated strings. If $nooped_plural contains a text domain passed to _n_noop() or _nx_noop(), it will override this value. Default ‘default’.- Required: 否
- Default: ‘default’
-
(array)
- 返回值
-
- (string) Either $singular or $plural translated text.
- 定义位置
-
-
wp-includes/l10n.php
, line 685
-
wp-includes/l10n.php
- 引入
- 3.1.0
- 弃用
- –
翻译并返回已经用_n_noop()或_nx_noop()注册的字符串的单数或复数形式。
当你想在知道数字后使用可翻译的复数字符串时使用。例子:
$message = _n_noop( ‘%s post’, ‘%s posts’, ‘text-domain’ );
…
printf( translate_nooped_plural( $message, $count, ‘text-domain’ ), number_format_i18n( $count ) );
function translate_nooped_plural( $nooped_plural, $count, $domain = 'default' ) { if ( $nooped_plural['domain'] ) { $domain = $nooped_plural['domain']; } if ( $nooped_plural['context'] ) { return _nx( $nooped_plural['singular'], $nooped_plural['plural'], $count, $nooped_plural['context'], $domain ); } else { return _n( $nooped_plural['singular'], $nooped_plural['plural'], $count, $domain ); } }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。