translate_with_context

函式
translate_with_context ( $text, $domain = 'default' )
引數
  • (string) $text Text to translate.
    Required:
  • (string) $domain Domain to retrieve the translated text.
    Required:
    Default: 'default'
返回值
  • (string) Translated text.
相關
  • _x()
定義位置
相關方法
translate_with_gettext_contexttranslate_smileyget_the_content_wp_translate_postdataregister_widget_control
引入
2.5.0
棄用
2.9.0

translate_with_context: 這個函式檢索一個文字字串到當前語言或指定語言的翻譯,並有一個指定的上下文。這用於消除可能在不同語境中有不同翻譯的類似字串的歧義。

像translate()一樣翻譯$text,但假定文字在其最後一個豎條之後包含一個上下文。

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

常見問題

FAQs
檢視更多 >