WordPress函数文档_x()

从获取的文本中返回翻译的字符串 描述 Retrieve translated string with gett…

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

描述

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.

用法

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

参数

$text

(string) (必填) Text to translate

默认值: None

$context

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

默认值: None

$domain

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

默认值: ‘default’

返回值

(string) 

Translated context string.

示例

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.”

注意

  • l10n is an abbreviation for localization.

历史

  • 添加于 版本: 2.8.0

源文件

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

相关

L10n:
translate(),
__(),
_e(),
_n(),
_x(),
_ex(),
_nx(),
esc_attr__(),
esc_attr_e(),
esc_attr_x(),
esc_html__(),
esc_html_e(),
esc_html_x(),
_n_noop(),
_nx_noop(),
translate_nooped_plural()

  • 原文:http://codex.wordpress.org/Function_Reference/_x
类别:WordPress函数文档

本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

评论 (0)COMMENT