本文整理汇总了PHP中translate_with_gettext_context函数的典型用法代码示例。如果您正苦于以下问题:PHP translate_with_gettext_context函数的具体用法?PHP translate_with_gettext_context怎么用?PHP translate_with_gettext_context使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了translate_with_gettext_context函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _x
public static function _x($text, $context, $domain = null)
{
if (!$domain) {
$domain = Core::ID;
}
return \translate_with_gettext_context($text, $context, $domain);
}
开发者ID:kmvan,项目名称:poil10n,代码行数:7,代码来源:L10n.php
示例2: translate_user_role
/**
* Translates role name. Since the role names are in the database and
* not in the source there are dummy gettext calls to get them into the POT
* file and this function properly translates them back.
*
* The before_last_bar() call is needed, because older installs keep the roles
* using the old context format: 'Role name|User role' and just skipping the
* content after the last bar is easier than fixing them in the DB. New installs
* won't suffer from that problem.
*/
function translate_user_role($name)
{
return translate_with_gettext_context(before_last_bar($name), 'User role');
}
开发者ID:laiello,项目名称:cartonbank,代码行数:14,代码来源:l10n.php
示例3: translate
<?php
/**
* A set of WordPress translation functions.
*
* @see wp-includes/l10n.php
*/
translate('translate');
translate_with_gettext_context('translate_with_gettext_context', 'translate_with_gettext_context-context');
__('__');
esc_attr__('esc_attr__');
esc_html__('esc_html__');
_e('_e');
esc_attr_e('esc_attr_e');
esc_html_e('esc_html_e');
_x('_x', '_x-context');
_ex('_ex', '_ex-context');
esc_attr_x('esc_attr_x', 'esc_attr_x-context');
esc_html_x('esc_html_x', 'esc_html_x-context');
_n('_n-single', '_n-plural', 2);
_nx('_nx-single', '_nx-plural', 2, '_nx-context');
_n_noop('_n_noop-singular', '_n_noop-plural');
_nx_noop('_nx_noop-singular', '_nx_noop-plural', '_nx_noop-context');
开发者ID:sourcerer-mike,项目名称:wp-easy-translate,代码行数:23,代码来源:all-without-opt-arg.php
示例4: __x
/**
* __x
*
* @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
* @return string Translated context string without pipe.
* @version 1.0.1
*/
function __x($text, $context, $domain = null)
{
if (!$domain) {
$domain = theme_functions::$iden;
}
return translate_with_gettext_context($text, $context, $domain);
}
开发者ID:ClayMoreBoy,项目名称:wp-theme-inn2015v2,代码行数:16,代码来源:core-functions.php
示例5: translate
/**
* Shopp wrapper for gettext translation strings (with optional context and Markdown support)
*
* @author Jonathan Davis
* @since 1.3
*
* @param string $text The text to translate
* @param string $context An explination of how and where the text is used
* @return string The translated text
**/
public static function translate($text, $context = null)
{
$domain = 'Shopp';
if (is_null($context)) {
$string = translate($text, $domain);
} else {
$string = translate_with_gettext_context($text, $context, $domain);
}
return $string;
}
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:20,代码来源:Core.php
示例6: _x
function _x($single, $context, $domain = 'default')
{
return translate_with_gettext_context($single, $context, $domain);
}
开发者ID:r15ch13,项目名称:unwakeable,代码行数:4,代码来源:wp-compat.php
示例7: wpdev_141551_translate_user_roles
function wpdev_141551_translate_user_roles($translations, $text, $context, $domain)
{
$plugin_domain = 'learn_press';
$roles = array('Instructor');
if ($context === 'User role' && in_array($text, $roles) && $domain !== $plugin_domain) {
return translate_with_gettext_context($text, $context, $plugin_domain);
}
return $translations;
}
开发者ID:hernanimattos,项目名称:LearnPress,代码行数:9,代码来源:lp-core-functions.php
示例8: ping_settings_field
public function ping_settings_field()
{
$options = parent::get_ping();
$defaults = parent::defaults('ping');
$update_services = get_option('ping_sites');
$prefix = parent::prefix();
$names = array('google' => array('name' => __('Google', 'xml-sitemap-feed')), 'bing' => array('name' => __('Bing & Yahoo', 'xml-sitemap-feed')), 'yandex' => array('name' => __('Yandex', 'xml-sitemap-feed')), 'baidu' => array('name' => __('Baidu', 'xml-sitemap-feed')), 'others' => array('name' => __('Ping-O-Matic', 'xml-sitemap-feed')));
foreach ($names as $key => $values) {
if (array_key_exists($key, $defaults) && is_array($values)) {
$defaults[$key] += $values;
}
}
echo '
<fieldset id="xmlsf_ping"><legend class="screen-reader-text">' . translate('Update Services') . '</legend>
';
foreach ($defaults as $key => $values) {
if (isset($values['type']) && $values['type'] == 'RPC') {
$active = strpos($update_services, untrailingslashit($values['uri'])) === false ? false : true;
} else {
$active = !empty($options[$key]['active']) ? true : false;
}
echo '
<label><input type="checkbox" name="' . $prefix . 'ping[' . $key . '][active]" id="xmlsf_ping_' . $key . '" value="1"' . checked($active, true, false) . ' /> ';
echo isset($names[$key]) && !empty($names[$key]['name']) ? $names[$key]['name'] : $key;
echo '</label>';
echo '
<input type="hidden" name="' . $prefix . 'ping[' . $key . '][uri]" value="' . $values['uri'] . '" />';
echo '
<input type="hidden" name="' . $prefix . 'ping[' . $key . '][type]" value="' . $values['type'] . '" />';
if (isset($values['news'])) {
echo '
<input type="hidden" name="' . $prefix . 'ping[' . $key . '][news]" value="' . $values['news'] . '" />';
}
echo ' <span class="description">';
if (!empty($options[$key]['pong'])) {
if ($tzstring = get_option('timezone_string')) {
// use same timezoneformat as translatable examples in options-general.php
$timezone_format = translate_with_gettext_context('Y-m-d G:i:s', 'timezone date format');
date_default_timezone_set($tzstring);
} else {
$timezone_format = 'Y-m-d G:i:s T';
}
foreach ((array) $options[$key]['pong'] as $pretty => $time) {
echo '
<input type="hidden" name="' . $prefix . 'ping[' . $key . '][pong][' . $pretty . ']" value="' . $time . '" />';
if (!empty($time)) {
echo sprintf(__('Successfully sent %1$s on %2$s.', 'xml-sitemap-feed'), $pretty, date($timezone_format, $time)) . ' ';
}
}
date_default_timezone_set('UTC');
}
echo '</span><br>';
}
echo '
</fieldset>';
}
开发者ID:ashenkar,项目名称:sanga,代码行数:56,代码来源:class-xmlsitemapfeed-admin.php
示例9: esc_attr_x
function esc_attr_x($single, $context, $domain = 'default')
{
return esc_attr(translate_with_gettext_context($single, $context, $domain));
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:4,代码来源:functions.bb-l10n.php
示例10: esc_html_x_emp
/**
* Shortcut for the esc_html_x function
* @param string $text
* @param string $domain
*/
function esc_html_x_emp($text, $context, $domain = 'dbem')
{
return esc_html(translate_with_gettext_context($text, $context, $domain));
}
开发者ID:shieldsdesignstudio,项目名称:trilogic,代码行数:9,代码来源:events-manager-pro.php
示例11: build_linked_posts_shortcode
/**
* Shortcode inside post content
* [linked-post-in lang="fr_fr"]Voir cet article[/linked-post-in]
*
*/
function build_linked_posts_shortcode($atts, $content = null)
{
global $post;
extract(shortcode_atts(array('lang' => '', 'title' => '', 'context' => 'linktitle'), $atts));
$language = xiliml_get_language($lang);
/* test if lang is available */
if ($language !== false) {
$otherpost = $this->linked_post_in($post->ID, $language->slug);
}
if ($otherpost) {
if ('' == $title) {
$obj_lang = xiliml_get_lang_object_of_post($otherpost);
if (false !== $obj_lang) {
$description = $obj_lang->description;
if ($context) {
$text_title = translate_with_gettext_context('A similar post in %s', $context, $this->thetextdomain);
$language_name = translate_with_gettext_context($description, $context, $this->thetextdomain);
} else {
$text_title = translate('A similar post in %s', $this->thetextdomain);
$language_name = translate($description, $this->thetextdomain);
}
$title = esc_html(sprintf($text_title, $language_name));
} else {
$title = esc_html(__('Error with target post #', 'xili-language')) . $otherpost;
}
}
$output = '<a href="' . get_permalink($otherpost) . '" title="' . $title . '">' . $content . '</a>';
/* this link above can be enriched by image or flag inside $content */
} else {
$output = '<a href="#" title="' . __('Error: other post not present !!!', 'xili-language') . '">' . $content . '</a>';
}
return $output;
}
开发者ID:ergov2015,项目名称:rideflag.dev,代码行数:38,代码来源:xili-language.php
注:本文中的translate_with_gettext_context函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论