_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 ) );

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function _nx_noop( $singular, $plural, $context, $domain = null ) {
return array(
0 => $singular,
1 => $plural,
2 => $context,
'singular' => $singular,
'plural' => $plural,
'context' => $context,
'domain' => $domain,
);
}
function _nx_noop( $singular, $plural, $context, $domain = null ) { return array( 0 => $singular, 1 => $plural, 2 => $context, 'singular' => $singular, 'plural' => $plural, 'context' => $context, 'domain' => $domain, ); }
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
檢視更多 >