_x()从获取的文本中返回翻译的字符串

目录

描述

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.

_x() 描述

用法

<?php $translated_text _x$text$context$domain ?>

_x() 用法

参数

$text

(string) (必填) Text to translate

默认值: None

$context

(string) (必填) Context information for the translators

默认值: None

$domain

(string) (可选) Domain to retrieve the translated text

默认值: 'default'

_x() 参数

返回值

(string) 

Translated context string.

_x() 返回值

示例

Since the string 'Read' on its own could have one of several different meanings in English, context is given so that translators know that they should be supplying a short term that means "Books I have read."

_x() 示例

注意

  • l10n is an abbreviation for localization.

_x() 注意

历史

  • 添加于 版本: 2.8.0

_x() 历史

源文件

_x() 函数的代码位于 wp-includes/l10n.php.

_x() 源文件

相关