/** * Add strings to polylang register. */ protected function add_to_polylang_register($strings, $context) { if (!empty($strings)) { foreach ($strings as $string) { pll_register_string($string, $string, __('TTfP:', 'polylang-tt') . ' ' . $context); } } }
/** * Registers theme_mod strings into Polylang * * @since 1.6.0 */ public function register_strings() { if (function_exists('pll_register_string') && ($strings = wpex_register_theme_mod_strings())) { foreach ($strings as $string => $default) { pll_register_string($string, get_theme_mod($string, $default), 'Theme Mod', true); } } }
public function register_string($string) { if (function_exists('pll_register_string')) { pll_register_string($string, $string, 'WP Libre Form'); } else { // Don't kill anything. } }
/** * Add registration for multilanguage string (contain hook) * * @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 register_string($plugin_name_human_format, $string_name, $value) { if (function_exists('icl_register_string')) { icl_register_string($plugin_name_human_format, $string_name, $value); } elseif (has_filter('cml_my_translations')) { add_filter('cml_my_translations', create_function("{$groups}, {$plugin_name_human_format}", "\n {$plugin_name_human_format_replaced} = str_replace( ' ', '-', {$plugin_name_human_format} );\n CMLTranslations:add( {$string_name}, {$value}, {$plugin_name_human_format} );\n {$groups[$plugin_name_human_format_replaced]} = {$plugin_name_human_format};\n return {$groups};")); } elseif (function_exists('pll_register_string')) { $plugin_name_human_format_replaced = str_replace(' ', '-', $plugin_name_human_format); pll_register_string($plugin_name_human_format_replaced, $string_name); } }
/** * Register translations. * * @param array $groups * @param bool $multiline * * @throws \BadFunctionCallException * * @return void */ function register_translations(array $groups, $multiline = false) { if (!function_exists('pll_register_string')) { throw new BadFunctionCallException('Please active the Polylang plugin.'); } foreach ($groups as $group => $translations) { foreach ($translations as $key => $description) { pll_register_string($description, $key, $group, $multiline); } } }
/** * Add registration for multilanguage string (contain hook) * * @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 register_string($plugin_name_human_format, $string_name, $value) { if (function_exists('icl_register_string')) { icl_register_string($plugin_name_human_format, $string_name, $value); } elseif (has_filter('cml_my_translations')) { CMLTranslations::add($string_name, $value, str_replace(' ', '-', $plugin_name_human_format)); } elseif (function_exists('pll_register_string')) { $plugin_name_human_format_replaced = str_replace(' ', '-', $plugin_name_human_format); pll_register_string($plugin_name_human_format_replaced, $string_name); } }
/** * Make all attributes lables managed by polylang string translation * * @global \Polylang $polylang * @global \WooCommerce $woocommerce * * @return boolean false if polylang or woocommerce can not be found */ public function manageAttrLablesTranslation() { global $polylang, $woocommerce; if (!$polylang || !$woocommerce) { return false; } $attrs = wc_get_attribute_taxonomies(); $section = __('Woocommerce Attributes', 'woo-poly-integration'); foreach ($attrs as $attr) { pll_register_string($attr->attribute_label, $attr->attribute_label, $section); } }
/** * Registers a string for translation. Needs a supported translation plugin active. * Parameters should be identical to respective calls of ci_get_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 The string $value passed. */ function ci_register_string_translation($name, $value, $context) { // WPML support if (function_exists('icl_register_string')) { icl_register_string($context, $name . ' - ' . md5($value), $value); } elseif (function_exists('pll_register_string')) { // Must be run in every pageload. pll_register_string($context . ' - ' . $name, $value); } // qTranslate seems to be working out of the box. // Return the $value so that the function can be used in nested calls. // E.g.: $value = ci_register_string_translation( $name, sanitize_text_field($value), $context ); return $value; }
public function register_strings() { if (!class_exists('GFAPI') || !function_exists('pll_register_string')) { return; } $forms = GFAPI::get_forms(); foreach ($forms as $form) { $this->form = $form; $this->iterate_form($form, function ($value, $key) { $name = ''; // todo: suitable naming $group = "Form #{$this->form['id']}: {$this->form['title']}"; pll_register_string($name, $value, $group); $this->registered_strings[] = $value; }); } }
function bookingwp_email_strings() { $name = 'bookingwp-quoted-subject'; $string = booking_get_option('bookingwp_quoted_email_subject'); $group = 'bookingwp'; $multiline = true; pll_register_string($name, $string, $group, $multiline); $name = 'bookingwp-quoted'; $string = booking_get_option('bookingwp_quoted_email'); $group = 'bookingwp'; $multiline = true; pll_register_string($name, $string, $group, $multiline); $name = 'bookingwp-refused-subject'; $string = booking_get_option('bookingwp_refused_email_subject'); $group = 'bookingwp'; $multiline = true; pll_register_string($name, $string, $group, $multiline); $name = 'bookingwp-refused'; $string = booking_get_option('bookingwp_refused_email'); $group = 'bookingwp'; $multiline = true; pll_register_string($name, $string, $group, $multiline); $name = 'bookingwp-confirmed-email-subject'; $string = booking_get_option('bookingwp_confirmed_email_subject'); $group = 'bookingwp'; $multiline = true; pll_register_string($name, $string, $group, $multiline); $name = 'bookingwp-confirmed'; $string = booking_get_option('bookingwp_confirmed_email'); $group = 'bookingwp'; $multiline = true; pll_register_string($name, $string, $group, $multiline); $name = 'bookingwp-confirm-button'; $string = booking_get_option('bookingwp_confirm_button'); $group = 'bookingwp'; $multiline = true; pll_register_string($name, $string, $group, $multiline); $name = 'bookingwp-cancellation-policy'; $string = booking_get_option('bookingwp_cancellation_policy'); $group = 'bookingwp'; $multiline = true; pll_register_string($name, $string, $group, $multiline); }
function tc_pll_strings_setup() { // grab theme options $tc_options = tc__f('__options'); // grab settings map, useful for some options labels $tc_settings_map = TC_utils_settings_map::$instance->tc_get_customizer_map($get_default = true); $tc_controls_map = $tc_settings_map['add_setting_control']; // set $polylang_group; $polylang_group = 'customizr-pro' == TC___::$theme_name ? 'Customizr-Pro' : 'Customizr'; //get options to translate $tc_translatable_raw_options = TC_plugins_compat::$instance->tc_get_string_options_to_translate(); $tc_pll_options = array(); //build array if option => array( label (gettext-ed), option ) foreach ($tc_translatable_raw_options as $tc_translatable_option) { if (isset($tc_options[$tc_translatable_option])) { switch ($tc_translatable_option) { case 'tc_front_slider': $label = __('Front page slider name', 'customizr'); break; case 'tc_posts_slider_button_text': $label = __('Posts slider button text', 'customizr'); break; default: $label = $tc_controls_map[$tc_translatable_option]['label']; break; } //endswitch $tc_pll_options[$tc_translatable_option] = array('label' => $label, 'value' => $tc_options[$tc_translatable_option]); } } //register the strings to translate foreach ($tc_pll_options as $tc_pll_option) { pll_register_string($tc_pll_option['label'], $tc_pll_option['value'], $polylang_group); } }
function sydney_polylang() { for ($i = 1; $i <= 5; $i++) { pll_register_string('Slide title ' . $i, get_theme_mod('slider_title_' . $i), 'Sydney'); pll_register_string('Slide subtitle ' . $i, get_theme_mod('slider_subtitle_' . $i), 'Sydney'); } pll_register_string('Slider button text', get_theme_mod('slider_button_text'), 'Sydney'); pll_register_string('Slider button URL', get_theme_mod('slider_button_url'), 'Sydney'); }
function registerStrings() { pll_register_string('Lithuanian films', 'Pasirinkite'); pll_register_string('Lithuanian films', 'Ilgametražis'); pll_register_string('Lithuanian films', 'Trumpametražis'); pll_register_string('Lithuanian films', 'Spalvotas'); pll_register_string('Lithuanian films', 'Nespalvotas'); pll_register_string('Lithuanian films', 'Gaminamas'); pll_register_string('Lithuanian films', 'Pagamintas'); pll_register_string('Lithuanian films', 'Paieškos forma'); pll_register_string('Lithuanian films', 'Filtruoti'); pll_register_string('Lithuanian films', 'nuo'); pll_register_string('Lithuanian films', 'iki'); pll_register_string('Lithuanian films', 'Pagal pasirinktus paieškos kriterijus filmų nerasta'); pll_register_string('Lithuanian films', 'Rasta filmų'); foreach ($this->fields as $key => $val) { pll_register_string('Lithuanian films', $val['label']); } }
/** * Register Woocommerce Payment Gateway custom titles, descriptions and * instructions in Polylang's Strings translations table. */ public function registerGatewayStringsForTranslation() { if (function_exists('pll_register_string') && !empty($this->enabledGateways)) { foreach ($this->enabledGateways as $gateway) { $settings = get_option($gateway->plugin_id . $gateway->id . '_settings'); if (!empty($settings)) { if (isset($settings['title'])) { pll_register_string($gateway->plugin_id . $gateway->id . '_gateway_title', $settings['title'], __('Woocommerce Payment Gateways', 'woo-poly-integration')); } if (isset($settings['description'])) { pll_register_string($gateway->plugin_id . $gateway->id . '_gateway_description', $settings['description'], __('Woocommerce Payment Gateways', 'woo-poly-integration')); } if (isset($settings['instructions'])) { pll_register_string($gateway->plugin_id . $gateway->id . '_gateway_instructions', $settings['instructions'], __('Woocommerce Payment Gateways', 'woo-poly-integration')); } } } } }
/** * Register email subjects and headings strings for translation in Polylang * Strings Translations table. * * Note: This function uses get_option to retrive the subject and heading * string from the WooCommerce Admin Settings page. get_option will return false * if the Admin user has not changed (nor saved) the default settings. * * @param string $email_type Email type * @param string $sufix Additional string variation, e.g. invoice paid vs invoice */ public function registerString($email_type, $sufix = '') { if (function_exists('pll_register_string')) { $settings = get_option('woocommerce_' . $email_type . '_settings'); if ($settings) { if (isset($settings['subject' . $sufix]) && isset($settings['heading' . $sufix])) { pll_register_string('woocommerce_' . $email_type . '_subject' . $sufix, $settings['subject' . $sufix], __('Woocommerce Emails', 'woo-poly-integration')); pll_register_string('woocommerce_' . $email_type . '_heading' . $sufix, $settings['heading' . $sufix], __('Woocommerce Emails', 'woo-poly-integration')); } } } }
/** * Registers the string to the translation plugin. * * @param string $text The string to register to the multilingual plugin. * @param boolean $multiline True if multiline text, false otherwise. * @param string $context The context of the registered string. * @param string $identifier A unique identifier ie. plugin name */ public function register($text, $multiline = false, $context = 'Buzz SEO', $identifier = 'buzz-seo') { pll_register_string($identifier, $text, $context, $multiline); }
function icl_register_string($context, $name, $string) { pll_register_string($name, $string); }
/** * Register shipping method custom titles in Polylang's Strings translations table. */ public function registerShippingStringsForTranslation() { if (function_exists('pll_register_string')) { $shipping_methods = $this->getActiveShippingMethods(); foreach ($shipping_methods as $method_id => $plugin_id) { $setting = get_option($plugin_id . $method_id . '_settings'); if ($setting && isset($setting['title'])) { pll_register_string($plugin_id . $method_id . '_shipping_method', $setting['title'], __('Woocommerce Shipping Methods', 'woo-poly-integration')); } } } }
function registerStrings() { pll_register_string('Filmų registras', 'nuo'); pll_register_string('Filmų registras', 'iki'); pll_register_string('Filmų registras', 'Paieškos rezultatai'); pll_register_string('Filmų registras', 'Pagal pasirinktus paieškos kriterijus filmų nerasta'); pll_register_string('Filmų registras', 'Ieškoti'); pll_register_string('Filmų registras', 'Prašome įvesti bent 1 paieškos kriterijų'); pll_register_string('Filmų registras', 'identifikavimo kodą'); pll_register_string('Filmų registras', 'pagaminimo datą'); pll_register_string('Filmų registras', 'pavadinimą'); pll_register_string('Filmų registras', 'rikiuoti pagal'); pll_register_string('Filmų registras', 'Rikiuoti didėjimo tvarka'); pll_register_string('Filmų registras', 'Rikiuoti mažėjimo tvarka'); pll_register_string('Filmų registras', 'Įrašykite'); pll_register_string('Filmų registras', 'Pasirinkite'); pll_register_string('Filmų registras', 'Pridėti'); pll_register_string('Filmų registras', 'Pašalinti'); pll_register_string('Filmų registras', 'Grįžti į filmų paiešką'); pll_register_string('Filmų registras', 'rodyti'); pll_register_string('Filmų registras', 'visus'); pll_register_string('Filmų registras', 'Filmas nepaskelbtas, negaliojantis arba išregistruotas'); }
return $attachment_id; } add_action('init', 'transportation_posttype'); if (function_exists("pll_register_string")) { pll_register_string('Schedule', 'Програма'); pll_register_string('Others', 'Други'); pll_register_string('follow', 'Последвайте ни в:'); pll_register_string('venue', 'VENUE_LOCATION'); pll_register_string('venue_w', 'Място'); pll_register_string('sponsors_w', 'Спонсори'); pll_register_string('partners_w', 'Партньори'); pll_register_string('speakers_w', 'Лектори'); pll_register_string('time', 'EVENT_TIME'); pll_register_string('publishedon', 'Публикувано на'); pll_register_string('by_w', 'От'); pll_register_string('see_whole_news', 'виж цялата новина'); pll_register_string('news', 'Новини'); pll_register_string('share_freedom', 'Да споделим свободата'); pll_register_string('hall1', 'София'); pll_register_string('hall2', 'Варна'); pll_register_string('hall3', 'G1'); pll_register_string('hall4', 'Пловдив'); pll_register_string('hall5', 'Бургас'); pll_register_string('bulgaria_hall', 'BULGARIA_HALL'); pll_register_string('chamber_hall', 'CHAMBER_HALL'); pll_register_string('music_hall', 'MUSIC_HALL'); pll_register_string('low_quality', 'LOW_QUALITY'); pll_register_string('normal_quality', 'NORMAL_QUALITY'); pll_register_string('high_quality', 'HIGH_QUALITY'); pll_register_string('all_streams', 'ALL_STREAMS'); }
protected function register_string_recursive($context, $strings, $options) { foreach ($options as $name => $value) { if (isset($strings[$name])) { if (is_string($value) && $strings[$name] == 1) { pll_register_string($name, $value, $context); } elseif (is_array($value) && is_array($strings[$name])) { $this->register_string_recursive($context, $strings[$name], $value); } } } }
/** * Get endpoint translations * * Register endpoint as polylang string if not registered and returne the * endpoint translation for the current langauge * * @global \Polylang $polylang * * @param string $endpoint the endpoint name * * @return string endpoint translation */ public function getEndpointTranslation($endpoint) { pll_register_string($endpoint, $endpoint, static::getPolylangStringSection()); $this->endpoints[] = $endpoint; return pll__($endpoint); }
$text = implode(' ', $words); } if ($echo) { echo apply_filters('the_content', $text); } else { return $text; } } function get_my_excerpt($excerpt_length = 55, $id = false, $echo = false) { return my_excerpt($excerpt_length, $id, $echo); } //[fenty] function return_fenty($atts) { $id = $atts['id']; if ($id) { ob_start(); echo '<figure' . (mt_rand(0, 3) === 0 ? ' class="spin-svg"' : '') . '>'; get_template_part('assets/svg/j' . $id . '.svg'); echo '</figure>'; return ob_get_clean(); } } add_shortcode('fenty', 'return_fenty'); pll_register_string('form', 'Number of persons'); pll_register_string('form', 'Full name'); pll_register_string('form', 'Phone'); pll_register_string('form', 'Email'); pll_register_string('form', 'Send'); require_once REEF_THEME_DIR . 'includes/send-email.php';
function pll_fpc_strings_setup() { $polylang_group = TC_fpu::$instance->plug_name; $plug_option_prefix = TC_fpu::$instance->plug_option_prefix; // grab plugin options $pll_tc_fpu_options = array_merge(TC_utils_fpu::$instance->default_options, get_option($plug_option_prefix)); $pll_tc_fpu_areas = TC_utils_fpu::$instance->tc_get_custom_fp_nb(); // grab settings map, useful for some options labels $tc_fpu_settings_map = TC_utils_fpu::$instance->tc_customizer_map($get_default = true); $tc_fpu_controls_map = $tc_fpu_settings_map['add_setting_control']; // Add featured pages button text to Polylang's string translation panel if (isset($pll_tc_fpu_options['tc_fp_button_text'])) { pll_register_string($tc_fpu_controls_map["{$plug_option_prefix}[tc_fp_button_text]"]["label"], esc_attr($pll_tc_fpu_options['tc_fp_button_text']), $polylang_group); } // Add featured pages excerpt text to Polylang's string translation panel foreach ($pll_tc_fpu_areas as $area) { if (isset($pll_tc_fpu_options["tc_featured_text_{$area}"])) { pll_register_string($tc_fpu_controls_map["{$plug_option_prefix}[tc_featured_text_{$area}]"]["label"], esc_attr($pll_tc_fpu_options['tc_featured_text_' . $area]), $polylang_group); } } }
/** * Register translation strings to translatable strings * * @param $parameters ["translations" => [ ["domain" => "wpsolr facel label", "name" => "categories", "text" => "my categories"] */ function register_translation_strings($parameters) { foreach ($parameters['translations'] as $text_to_add) { pll_register_string($text_to_add['text'], $text_to_add['name'], $text_to_add['domain'], false); } return; }
echo 'Dev9t'; ?> "/> <meta property="og:description" content="<?php echo 'Stvaraj dalje!'; ?> "/> <meta property="og:type" content="article"/> <meta property="og:url" content="<?php echo the_permalink(); ?> "/> <meta property="og:site_name" content="<?php echo get_bloginfo(); ?> "/> <meta property="og:image" content="<?php echo get_stylesheet_directory_uri() . '/img/post1.jpg'; ?> "/> <?php } } add_action('wp_head', 'fb_opengraph', 5); /*------------------------------------*\ POLYLANG \*------------------------------------*/ pll_register_string('Podeli', 'podeli'); pll_register_string('Datum održavanja', 'datum-odrzavanja'); pll_register_string('Jezik', 'jezik');
function perth_polylang() { pll_register_string('Header text', esc_attr(get_theme_mod('header_text')), 'Perth'); pll_register_string('Left button text', esc_attr(get_theme_mod('button_left')), 'Perth'); pll_register_string('Right button text', esc_attr(get_theme_mod('button_right')), 'Perth'); }
//id and name of form element should be same as the setting name. ?> <input type="text" size="40" name="mail" id="mail" value="<?php echo get_option('mail'); ?> " /> <?php } //this action is executed after loads its core, after registering all actions, finds out what page to execute and before producing the actual output(before calling any action callback) add_action("admin_init", "display_options"); define('SM_BASE_URL', 'http://localhost/wordpress'); define('SM_FBLINK', 'http://facebook.com/SmartGuideApp'); if (is_admin()) { pll_register_string('SmartGuide', 'Smart Guide App'); pll_register_string('SmartGuide', 'Contact For Support'); pll_register_string('SmartGuide', 'Social Network'); } function wpbootstrap_scripts_with_jquery() { // Register the script like this for a theme: wp_register_script('bootstrap', get_template_directory_uri() . '/bootstrap/js/libs/bootstrap.min.js', array('jquery')); wp_register_script('easing', get_template_directory_uri() . '/bootstrap/js/libs/jquery.easing.min.js', array()); wp_register_script('mobile', get_template_directory_uri() . '/bootstrap/js/libs/jquery.mobile.custom.js', array()); wp_register_script('material', get_template_directory_uri() . '/bootstrap/js/libs/material.min.js', array()); wp_register_script('ripples', get_template_directory_uri() . '/bootstrap/js/libs/ripples.min.js', array()); wp_register_script('bootbox', get_template_directory_uri() . '/bootstrap/js/libs/bootbox.min.js', array()); wp_register_script('mail', get_template_directory_uri() . '/bootstrap/js/libs/email.js', array()); wp_register_script('main', get_template_directory_uri() . '/bootstrap/js/main.js', array()); wp_register_script('retina', get_template_directory_uri() . '/bootstrap/js/libs/retina.min.js', array()); // For either a plugin or a theme, you can then enqueue the script: wp_enqueue_script('bootstrap');
function tc_pll_strings_setup() { // grab theme options $pll_tc_options = tc__f('__options'); // grab settings map, useful for some options labels $tc_settings_map = TC_utils_settings_map::$instance -> tc_customizer_map( $get_default = true ); $tc_controls_map = $tc_settings_map['add_setting_control']; // set $polylang_group; $polylang_group = 'customizr-pro' == TC___::$theme_name ? 'Customizr-Pro' : 'Customizr'; // Add front page slider name to Polylang's string translation panel if ( isset( $pll_tc_options['tc_front_slider'] ) ) pll_register_string( 'Front page slider name', esc_attr($pll_tc_options['tc_front_slider']), $polylang_group ); // Add archive title strings to Polylang's string translation panel $archive_titles_settings = array( 'tc_tag_title', 'tc_cat_title', 'tc_author_title', 'tc_search_title'); foreach ( $archive_titles_settings as $archive_title_setting_name ) if ( isset( $pll_tc_options[$archive_title_setting_name] ) ) pll_register_string( $tc_controls_map["tc_theme_options[$archive_title_setting_name]"]["label"], esc_attr($pll_tc_options[$archive_title_setting_name]), $polylang_group ); // Featured Pages if ( ! class_exists('TC_fpu') && ! class_exists('TC_fpc') ) { $pll_tc_fp_areas = TC_init::$instance -> fp_ids; // Add featured pages button text to Polylang's string translation panel if ( isset( $pll_tc_options[ 'tc_featured_page_button_text'] ) ) pll_register_string( $tc_controls_map["tc_theme_options[tc_featured_page_button_text]"]["label"], esc_attr($pll_tc_options[ 'tc_featured_page_button_text']), $polylang_group ); // Add featured pages excerpt text to Polylang's string translation panel foreach ( $pll_tc_fp_areas as $area ) if ( isset( $pll_tc_options["tc_featured_text_$area"] ) ) pll_register_string( $tc_controls_map["tc_theme_options[tc_featured_text_$area]"]["label"], esc_attr($pll_tc_options['tc_featured_text_'.$area]), $polylang_group ); } //end Featured Pages }// end tc_pll_strings_setup function
protected function register_string_recursive($context, $strings, $options) { foreach ($options as $name => $value) { if (isset($strings[$name])) { // allow numeric values to be translated // https://wordpress.org/support/topic/wpml-configxml-strings-skipped-when-numbers-ids if ((is_numeric($value) || is_string($value)) && $strings[$name] == 1) { pll_register_string($name, $value, $context); } elseif (is_array($value) && is_array($strings[$name])) { $this->register_string_recursive($context, $strings[$name], $value); } } } }