本文整理汇总了PHP中pll__函数的典型用法代码示例。如果您正苦于以下问题:PHP pll__函数的具体用法?PHP pll__怎么用?PHP pll__使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pll__函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wpmtst_l10n_polylang
/**
* Polylang
*
* @param $string
* @param $context
* @param $name
*
* @return bool|string|void
*/
function wpmtst_l10n_polylang($string, $context, $name)
{
if (function_exists('pll__')) {
return pll__($string);
}
return $string;
}
示例2: translate_strings
public function translate_strings($form)
{
if (function_exists('pll__')) {
$this->iterate_form($form, function (&$value, $key) {
$value = pll__($value);
});
}
return $form;
}
示例3: email_instructions
/**
* Add content to the WC emails.
*
* Note: The difference from WC_Gateway_BACS is that we use __() before
* passing the string through wptexturize() and wpautop().
*
* @param WC_Order $order
* @param bool $sent_to_admin
* @param bool $plain_text
*/
public function email_instructions($order, $sent_to_admin, $plain_text = false)
{
if (!$sent_to_admin && 'bacs' === $order->payment_method && $order->has_status('on-hold')) {
if ($this->instructions) {
echo wpautop(wptexturize(function_exists('pll__') ? pll__($this->instructions) : __($this->instructions, 'woocommerce'))) . PHP_EOL;
}
$this->bank_details($order->id);
}
}
示例4: translate_string
public function translate_string($string)
{
if (function_exists('pll__')) {
return pll__($string);
} else {
return $string;
// Don't kill anything.
}
}
示例5: trans
/**
* Get translations by their strings.
*
* @param string $key
* @param string|null $lang
*
* @throws \BadFunctionCallException
*
* @return string
*/
function trans($key, $lang = null)
{
if (!function_exists('pll__')) {
throw new BadFunctionCallException('Please active the Polylang plugin.');
}
if ($lang) {
return pll_translate_string($key, $lang);
}
return pll__($key);
}
示例6: get_string
/**
* Get multilanguage string
*
* @since 1.0.0
*
* @param string $plugin_name_human_format The Plugin name
* @param string $string_name The name of the string
* @param string $value The value
*/
function get_string($plugin_name_human_format, $string_name, $value)
{
if (function_exists('icl_t')) {
return icl_t($plugin_name_human_format, $string_name, $value);
} elseif (has_filter('cml_my_translations')) {
return CMLTranslations::get(CMLLanguage::get_current_id(), $string_name, str_replace(' ', '-', $plugin_name_human_format));
} elseif (function_exists('pll__')) {
return pll__($string_name);
} else {
return $value;
}
}
示例7: ci_get_string_translation
/**
* Retrieves the translation for a string, if available. Needs a supported translation plugin active.
* Parameters should be identical to respective call of ci_register_string_translation()
*
* @param string $name A description of the value, e.g. 'Booking - Button Text'
* @param string $value The text to be registered for translation, e.g. 'Book Now'
* @param string $context A context for grouping and disambiguation of the value, e.g. 'Widgets'
* @return string A translation of $value if available, else $value.
*/
function ci_get_string_translation($name, $value, $context)
{
$translation = $value;
// WPML support
if (function_exists('icl_t')) {
$translation = icl_t($context, $name . ' - ' . md5($value), $value);
} elseif (function_exists('pll__')) {
// Doesn't work before the 'wp' action.
$translation = pll__($value);
}
// qTranslate seems to be working out of the box.
return $translation;
}
示例8: populateDropdownOptions
function populateDropdownOptions()
{
foreach ($this->fields as $key => $val) {
if ($val['metaType'] == 'taxonomy') {
$this->fields[$key]['dropdownOptions'] = $this->getDropdownOptionsFromTaxonomy($val['taxonomySlug']);
}
}
$this->fields['country']['dropdownOptions'] = $this->countryList;
$this->fields['country']['dropdownOptions'][0] = pll__('Pasirinkite');
$this->fields['license_territory']['dropdownOptions'] = $this->countryList;
$this->fields['license_territory']['dropdownOptions'][0] = pll__('Pasirinkite');
$this->fields['film_original_language']['dropdownOptions'] = $this->countryList22;
$this->fields['film_original_language']['dropdownOptions'][0] = pll__('Pasirinkite');
$this->fields['film_subtitle_language']['dropdownOptions'] = $this->countryList22;
$this->fields['film_subtitle_language']['dropdownOptions'][0] = pll__('Pasirinkite');
}
示例9: perth_header_text
/**
* Header text
*/
function perth_header_text()
{
if (!function_exists('pll_register_string')) {
$header_text = get_theme_mod('header_text', 'Welcome to Perth');
$button_left = get_theme_mod('button_left', 'Start here');
$button_right = get_theme_mod('button_right', 'Read more');
} else {
$header_text = pll__(get_theme_mod('header_text', 'Welcome to Perth'));
$button_left = pll__(get_theme_mod('button_left', 'Start here'));
$button_right = pll__(get_theme_mod('button_right', 'Read more'));
}
$button_left_url = get_theme_mod('button_left_url', '#primary');
$button_right_url = get_theme_mod('button_right_url', '#primary');
echo '<div class="header-info">
<h3 class="header-text">' . esc_html($header_text) . '</h3>
<div class="header-buttons">';
if ($button_left_url) {
echo '<a class="button header-button left-button" href="' . esc_url($button_left_url) . '">' . esc_html($button_left) . '</a>';
}
if ($button_right_url) {
echo '<a class="button header-button right-button" href="' . esc_url($button_right_url) . '">' . esc_html($button_right) . '</a>';
}
echo '</div>';
echo '</div>';
}
示例10: get_translation_string
/**
* Add translation strings to translatable strings
*
* @param array $parameter ["domain" => "wpsolr facel label", "name" => "categories", "text" => "my categories"]
*/
function get_translation_string($string, $parameter)
{
if (empty($parameter['language'])) {
// Translate with current language
$result = pll__($parameter['name']);
} else {
// Translate with parameter language
$result = pll_translate_string($parameter['name'], $parameter['language']);
}
return $result;
}
示例11: icl_translate
function icl_translate($context, $name, $string, $bool = false)
{
PLL_WPML_Compat::instance()->register_string($context, $name, $string);
return pll__($string);
}
示例12: pll_translate_string
function pll_translate_string($string, $lang)
{
if (pll_current_language() == $lang) {
return pll__($string);
}
static $cache;
// cache object to avoid loading the same translations object several times
if (empty($cache)) {
$cache = new PLL_Cache();
}
if (false === ($mo = $cache->get($lang))) {
$mo = new PLL_MO();
$mo->import_from_db(PLL()->model->get_language($lang));
$cache->set($lang, $mo);
}
return $mo->translate($string);
}
示例13: translate_strings_recursive
protected function translate_strings_recursive($strings, $values)
{
foreach ($values as $name => $value) {
if (isset($strings[$name])) {
if (is_string($value) && $strings[$name] == 1) {
$values[$name] = pll__($value);
} elseif (is_array($value) && is_array($strings[$name])) {
$values[$name] = $this->translate_strings_recursive($strings[$name], $value);
}
}
}
return $values;
}
示例14: addEndpoints
/**
* Add endpoints
*
* Add all endpoints translation in the current langauge
*/
public function addEndpoints()
{
foreach ($this->endpoints as $endpoint) {
add_rewrite_endpoint(pll__($endpoint), EP_ROOT | EP_PAGES);
}
}
示例15: get_header
<?php
get_header();
?>
<section class="content">
<?php
echo do_shortcode('[sh-latest-posts cat="news" label="' . pll__('Новини') . '"]');
?>
<div class="separator"></div>
<div class="col-right sponsors sponsors-frontpage">
<?php
echo do_shortcode('[sponsors]');
?>
<?php
echo do_shortcode('[partners]');
?>
</div>
<div class="separator"></div>
</section>
<?php
echo do_shortcode('[transport]');
?>
<?php
get_footer();