返回介绍

_c()

发布于 2017-09-11 13:14:41 字数 1966 浏览 1536 评论 0 收藏 0

Warning: This function has been deprecated. Use _x() instead.

_c( string $text,  string $domain = 'default' )

Retrieve translated string with vertical bar context


description

Quite a few times, there will be collisions with similar translatable text found in more than two places but with different translated context.

In order to use the separate contexts, the _c() function is used and the translatable string uses a pipe (‘|’) which has the context the string is in.

When the translated string is returned, it is everything before the pipe, not including the pipe character. If there is no pipe in the translated text then everything is returned.


参数

$text

(string) (Required) Text to translate

$domain

(string) (Optional) Domain to retrieve the translated text

Default value: 'default'


返回值

(string) Translated context string without pipe


源代码

File: wp-includes/deprecated.php

function _c( $text, $domain = 'default' ) {
	_deprecated_function( __FUNCTION__, '2.9.0', '_x()' );
	return before_last_bar( translate( $text, $domain ) );
}

更新日志

Versiondescription
2.9.0Use _x()
2.2.0Introduced.

相关函数

Uses

  • wp-includes/l10n.php: before_last_bar()
  • wp-includes/l10n.php: translate()
  • wp-includes/functions.php: _deprecated_function()

User Contributed Notes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文