_x()
_x( string $text, string $context, string $domain = ‘de…
_x( string $text, string $context, string $domain = ‘default’ )
使用gettext上下文检索翻译后的字符串。
Retrieve translated string with gettext context.
目录锚点:#说明#参数#源码#笔记
说明(Description)
很多时候,在两个以上的地方会出现与相似的可译文本的冲突,但是翻译的上下文不同。通过在pot文件中包含上下文,翻译人员可以以不同的方式翻译这两个字符串。
参数(Parameters)
| 参数 | 类型 | 说明 |
|---|---|---|
| $text | (string) | 要翻译的文本。 |
| $context | (string) | 译者的上下文信息。 |
| $domain | (string) | 文本域。用于检索翻译字符串的唯一标识符。 |
源码(Source)
/**
* Retrieve translated string with gettext context.
*
* Quite a few times, there will be collisions with similar translatable text
* found in more than two places, but with different translated context.
*
* By including the context in the pot file, translators can translate the two
* strings differently.
*
* @since 2.8.0
*
* @param string $text Text to translate.
* @param string $context Context information for the translators.
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
* @return string Translated context string without pipe.
*/
function _x( $text, $context, $domain = 'default' ) {
return translate_with_gettext_context( $text, $context, $domain );
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 2.8.0 | wp-includes/l10n.php | 6 | 12 |
笔记(Notes)
例子
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。





还没有任何评论,赶紧来占个楼吧!