_nx_noop

函数
_nx_noop ( $singular, $plural, $context, $domain = null )
参数
  • (string) $singular Singular form to be localized.
    Required:
  • (string) $plural Plural form to be localized.
    Required:
  • (string) $context Context information for the translators.
    Required:
  • (string) $domain Optional. Text domain. Unique identifier for retrieving translated strings. Default null.
    Required:
    Default: null
返回值
  • (array) { Array of translation information for the strings. @type string $0 Singular form to be localized. No longer used. @type string $1 Plural form to be localized. No longer used. @type string $2 Context information for the translators. No longer used. @type string $singular Singular form to be localized. @type string $plural Plural form to be localized. @type string $context Context information for the translators. @type string|null $domain Text domain. }
定义位置
相关方法
_n_noop__ngettext_noop_nxin_the_loop
引入
2.8.0
弃用
-

_nx_noop: 此函数用于翻译一个带有单数和复数形式以及上下文的字符串,而不对其进行回声。

在POT文件中用gettext上下文注册复数字符串,但不对其进行翻译。

当你想保留带有可翻译的复数字符串的结构并在以后知道数字时使用它们时使用。

通过上下文参数消除歧义的通用短语的例子:
$messages = array(
‘people’ => _nx_noop( ‘%s group’, ‘%s groups’, ‘people’, ‘text-domain’ ),
‘animals’ => _nx_noop( ‘%s group’, ‘%s groups’, ‘animals’, ‘text-domain’ ),
);

$message = $messages[ $type ];
printf( translate_nooped_plural( $message, $count, ‘text-domain’ ), number_format_i18n( $count ) );

function _nx_noop( $singular, $plural, $context, $domain = null ) {
	return array(
		0          => $singular,
		1          => $plural,
		2          => $context,
		'singular' => $singular,
		'plural'   => $plural,
		'context'  => $context,
		'domain'   => $domain,
	);
}

常见问题

FAQs
查看更多 >