_x ( $text, $context, $domain = 'default' )
引數
  • (string) $text Text to translate.
    Required:
  • (string) $context Context information for the translators.
    Required:
  • (string) $domain Optional. Text domain. Unique identifier for retrieving translated strings. Default 'default'.
    Required:
    Default: 'default'
返回值
  • (string) Translated context string without pipe.
定義位置
相關方法
_nx_ex____c
引入
2.8.0
棄用
-

_x: 這個函式用於WordPress的國際化(i18n)目的。它類似於__()和_e()函式,但允許指定一個上下文引數,這可以幫助消除有多種含義的單詞或短語的翻譯。

檢索具有gettext上下文的翻譯字串。

相當多的時候,在兩個以上的地方發現類似的可翻譯文字,但有不同的翻譯上下文,會發生碰撞。

通過在pot檔案中包括上下文,譯者可以對這兩個字串進行不同的翻譯。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function _x( $text, $context, $domain = 'default' ) {
return translate_with_gettext_context( $text, $context, $domain );
}
function _x( $text, $context, $domain = 'default' ) { return translate_with_gettext_context( $text, $context, $domain ); }
function _x( $text, $context, $domain = 'default' ) {
	return translate_with_gettext_context( $text, $context, $domain );
}

常見問題

FAQs
檢視更多 >