_c ( $text, $domain = 'default' )
引數
  • (string) $text Text to translate.
    Required:
  • (string) $domain Optional. Domain to retrieve the translated text.
    Required:
    Default: 'default'
返回值
  • (string) Translated context string without pipe.
相關
  • _x()
定義位置
相關方法
_nc____e_n
引入
2.2.0
棄用
2.9.0

_c: 這個函式用來翻譯一個帶有上下文的字串。它接受一個字串和一個上下文作為其引數,並返回一個包含上下文的翻譯字串。

檢索帶有豎條上下文的翻譯字串

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

為了使用不同的上下文,使用_c()函式,可翻譯的字串使用一個管道(’|’),其中有字串所在的上下文。

當翻譯後的字串被返回時,它是管道之前的所有內容,不包括管道字元。如果在翻譯的文字中沒有管道,那麼就會返回所有的內容。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function _c( $text, $domain = 'default' ) {
_deprecated_function( __FUNCTION__, '2.9.0', '_x()' );
return before_last_bar( translate( $text, $domain ) );
}
function _c( $text, $domain = 'default' ) { _deprecated_function( __FUNCTION__, '2.9.0', '_x()' ); return before_last_bar( translate( $text, $domain ) ); }
function _c( $text, $domain = 'default' ) {
	_deprecated_function( __FUNCTION__, '2.9.0', '_x()' );
	return before_last_bar( translate( $text, $domain ) );
}

常見問題

FAQs
檢視更多 >