Version Description
- Added a conditional Elementor block for language.
- Fixed Google Translate breaking some characters such as & #8220;
- Improvements to error handling
- Fixed a js error
Download this release
Release Info
| Developer | madalin.ungureanu |
| Plugin | |
| Version | 1.6.4 |
| Comparing to | |
| See all releases | |
Code changes from version 1.6.3 to 1.6.4
- assets/js/trp-translate-dom-changes.js +1 -1
- class-translate-press.php +5 -1
- includes/class-elementor-language-for-blocks.php +284 -0
- includes/class-machine-translator.php +4 -1
- includes/class-query.php +2 -2
- includes/class-translation-manager.php +1 -1
- includes/compatibility-functions.php +0 -16
- index.php +1 -1
- languages/translatepress-multilingual.pot +2 -2
- readme.txt +8 -2
assets/js/trp-translate-dom-changes.js
CHANGED
|
@@ -84,7 +84,7 @@ function TRP_Translator(){
|
|
| 84 |
var nodeInfo = nodesInfo[j];
|
| 85 |
var translation_found = false;
|
| 86 |
var initial_value = nodeInfo.original;
|
| 87 |
-
for( var i
|
| 88 |
var response_string = response[i].translationsArray[language_to_query];
|
| 89 |
if (response[i].original.trim() == nodeInfo.original.trim()) {
|
| 90 |
// The nodeInfo can contain duplicates and response cannot. We need duplicates to refer to different jQuery objects where the same string appears in different places on the page.
|
| 84 |
var nodeInfo = nodesInfo[j];
|
| 85 |
var translation_found = false;
|
| 86 |
var initial_value = nodeInfo.original;
|
| 87 |
+
for( var i = 0; i < response.length; i++ ) {
|
| 88 |
var response_string = response[i].translationsArray[language_to_query];
|
| 89 |
if (response[i].original.trim() == nodeInfo.original.trim()) {
|
| 90 |
// The nodeInfo can contain duplicates and response cannot. We need duplicates to refer to different jQuery objects where the same string appears in different places on the page.
|
class-translate-press.php
CHANGED
|
@@ -52,7 +52,7 @@ class TRP_Translate_Press{
|
|
| 52 |
define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
| 53 |
define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
|
| 54 |
define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
|
| 55 |
-
define( 'TRP_PLUGIN_VERSION', '1.6.
|
| 56 |
|
| 57 |
wp_cache_add_non_persistent_groups(array('trp'));
|
| 58 |
|
|
@@ -104,6 +104,10 @@ class TRP_Translate_Press{
|
|
| 104 |
require_once TRP_PLUGIN_DIR . 'assets/lib/simplehtmldom/simple_html_dom.php';
|
| 105 |
require_once TRP_PLUGIN_DIR . 'includes/shortcodes.php';
|
| 106 |
require_once TRP_PLUGIN_DIR . 'includes/class-machine-translation-tab.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
}
|
| 108 |
|
| 109 |
/**
|
| 52 |
define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
| 53 |
define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
|
| 54 |
define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
|
| 55 |
+
define( 'TRP_PLUGIN_VERSION', '1.6.4' );
|
| 56 |
|
| 57 |
wp_cache_add_non_persistent_groups(array('trp'));
|
| 58 |
|
| 104 |
require_once TRP_PLUGIN_DIR . 'assets/lib/simplehtmldom/simple_html_dom.php';
|
| 105 |
require_once TRP_PLUGIN_DIR . 'includes/shortcodes.php';
|
| 106 |
require_once TRP_PLUGIN_DIR . 'includes/class-machine-translation-tab.php';
|
| 107 |
+
|
| 108 |
+
if ( did_action( 'elementor/loaded' ) )
|
| 109 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-elementor-language-for-blocks.php';
|
| 110 |
+
|
| 111 |
}
|
| 112 |
|
| 113 |
/**
|
includes/class-elementor-language-for-blocks.php
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
// Exit if accessed directly
|
| 4 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
| 5 |
+
|
| 6 |
+
use Elementor\Controls_Manager;
|
| 7 |
+
|
| 8 |
+
class TRP_Elementor {
|
| 9 |
+
private static $_instance = null;
|
| 10 |
+
public $locations = array(
|
| 11 |
+
array(
|
| 12 |
+
'element' => 'common',
|
| 13 |
+
'action' => '_section_style',
|
| 14 |
+
),
|
| 15 |
+
array(
|
| 16 |
+
'element' => 'section',
|
| 17 |
+
'action' => 'section_advanced',
|
| 18 |
+
)
|
| 19 |
+
);
|
| 20 |
+
public $section_name_show = 'trp_section_show';
|
| 21 |
+
public $section_name_exclude = 'trp_section_exclude';
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Register plugin action hooks and filters
|
| 25 |
+
*/
|
| 26 |
+
public function __construct() {
|
| 27 |
+
|
| 28 |
+
// Register new section to display restriction controls
|
| 29 |
+
$this->register_sections();
|
| 30 |
+
|
| 31 |
+
// Setup controls
|
| 32 |
+
$this->register_controls();
|
| 33 |
+
|
| 34 |
+
// Filter widget content
|
| 35 |
+
add_filter( 'elementor/widget/render_content', array( $this, 'widget_render' ), 10, 2 );
|
| 36 |
+
|
| 37 |
+
// Filter sections display & add custom messages
|
| 38 |
+
add_action( 'elementor/frontend/section/should_render', array( $this, 'section_render' ), 10, 2 );
|
| 39 |
+
|
| 40 |
+
// Add data-no-translation to elements that are restricted to a particular language
|
| 41 |
+
add_action( 'elementor/element/after_add_attributes', array( $this, 'add_attributes' ) );
|
| 42 |
+
|
| 43 |
+
add_filter( 'trp_allow_language_redirect', array( $this, 'trp_elementor_compatibility' ) );
|
| 44 |
+
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
/**
|
| 48 |
+
*
|
| 49 |
+
* Ensures only one instance of the class is loaded or can be loaded.
|
| 50 |
+
*
|
| 51 |
+
* @return TRP_Elementor An instance of the class.
|
| 52 |
+
*/
|
| 53 |
+
public static function instance() {
|
| 54 |
+
|
| 55 |
+
if ( is_null( self::$_instance ) )
|
| 56 |
+
self::$_instance = new self();
|
| 57 |
+
|
| 58 |
+
return self::$_instance;
|
| 59 |
+
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
private function register_sections() {
|
| 63 |
+
|
| 64 |
+
foreach( $this->locations as $where ){
|
| 65 |
+
add_action( 'elementor/element/'.$where['element'].'/'.$where['action'].'/after_section_end', array( $this, 'add_section_show' ), 10, 2 );
|
| 66 |
+
add_action( 'elementor/element/'.$where['element'].'/'.$where['action'].'/after_section_end', array( $this, 'add_section_exclude' ), 10, 2 );
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
// Register controls to sections and widgets
|
| 72 |
+
private function register_controls() {
|
| 73 |
+
|
| 74 |
+
foreach( $this->locations as $where ){
|
| 75 |
+
add_action('elementor/element/'.$where['element'].'/'.$this->section_name_show.'/before_section_end', array( $this, 'add_controls_show' ), 10, 2 );
|
| 76 |
+
add_action('elementor/element/'.$where['element'].'/'.$this->section_name_exclude.'/before_section_end', array( $this, 'add_controls_exclude' ), 10, 2 );
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
public function add_section_show( $element, $args ) {
|
| 82 |
+
|
| 83 |
+
$exists = \Elementor\Plugin::instance()->controls_manager->get_control_from_stack( $element->get_unique_name(), $this->section_name_show );
|
| 84 |
+
|
| 85 |
+
if( !is_wp_error( $exists ) )
|
| 86 |
+
return false;
|
| 87 |
+
|
| 88 |
+
$element->start_controls_section(
|
| 89 |
+
$this->section_name_show, array(
|
| 90 |
+
'tab' => Controls_Manager::TAB_ADVANCED,
|
| 91 |
+
'label' => __( 'Restrict by Language', 'translatepress' )
|
| 92 |
+
)
|
| 93 |
+
);
|
| 94 |
+
|
| 95 |
+
$element->end_controls_section();
|
| 96 |
+
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
public function add_section_exclude( $element, $args ) {
|
| 100 |
+
|
| 101 |
+
$exists = \Elementor\Plugin::instance()->controls_manager->get_control_from_stack( $element->get_unique_name(), $this->section_name_exclude );
|
| 102 |
+
|
| 103 |
+
if( !is_wp_error( $exists ) )
|
| 104 |
+
return false;
|
| 105 |
+
|
| 106 |
+
$element->start_controls_section(
|
| 107 |
+
$this->section_name_exclude, array(
|
| 108 |
+
'tab' => Controls_Manager::TAB_ADVANCED,
|
| 109 |
+
'label' => __( 'Exclude from Language', 'translatepress' )
|
| 110 |
+
)
|
| 111 |
+
);
|
| 112 |
+
|
| 113 |
+
$element->end_controls_section();
|
| 114 |
+
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
// Define controls
|
| 118 |
+
public function add_controls_show( $element, $args ) {
|
| 119 |
+
|
| 120 |
+
$element_type = $element->get_type();
|
| 121 |
+
|
| 122 |
+
$element->add_control(
|
| 123 |
+
'trp_language_restriction', array(
|
| 124 |
+
'label' => __( 'Restrict element to language', 'translatepress' ),
|
| 125 |
+
'type' => Controls_Manager::SWITCHER,
|
| 126 |
+
'description' => __( 'Show this element only in one language.', 'translatepress' ),
|
| 127 |
+
)
|
| 128 |
+
);
|
| 129 |
+
|
| 130 |
+
$element->add_control(
|
| 131 |
+
'trp_language_restriction_heading', array(
|
| 132 |
+
'label' => __( 'Select language', 'translatepress' ),
|
| 133 |
+
'type' => Controls_Manager::HEADING,
|
| 134 |
+
'separator' => 'before',
|
| 135 |
+
)
|
| 136 |
+
);
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
$trp = TRP_Translate_Press::get_trp_instance();
|
| 140 |
+
$trp_languages = $trp->get_component( 'languages' );
|
| 141 |
+
$trp_settings = $trp->get_component( 'settings' );
|
| 142 |
+
$published_languages = $trp_languages->get_language_names( $trp_settings->get_settings()['publish-languages'] );
|
| 143 |
+
|
| 144 |
+
$element->add_control(
|
| 145 |
+
'trp_restricted_languages', array(
|
| 146 |
+
'type' => Controls_Manager::SELECT2,
|
| 147 |
+
'options' => $published_languages,
|
| 148 |
+
'label_block' => 'true',
|
| 149 |
+
'description' => __( 'Choose in which language to show this element.', 'translatepress' ),
|
| 150 |
+
)
|
| 151 |
+
);
|
| 152 |
+
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
public function add_controls_exclude( $element, $args ) {
|
| 156 |
+
|
| 157 |
+
$element_type = $element->get_type();
|
| 158 |
+
|
| 159 |
+
$element->add_control(
|
| 160 |
+
'trp_exclude_handler', array(
|
| 161 |
+
'label' => __( 'Exclude element from language', 'translatepress' ),
|
| 162 |
+
'type' => Controls_Manager::SWITCHER,
|
| 163 |
+
'description' => __( 'Exclude this element from specific languages.', 'translatepress' ),
|
| 164 |
+
)
|
| 165 |
+
);
|
| 166 |
+
|
| 167 |
+
$element->add_control(
|
| 168 |
+
'trp_excluded_heading', array(
|
| 169 |
+
'label' => __( 'Select languages', 'translatepress' ),
|
| 170 |
+
'type' => Controls_Manager::HEADING,
|
| 171 |
+
'separator' => 'before',
|
| 172 |
+
)
|
| 173 |
+
);
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
$trp = TRP_Translate_Press::get_trp_instance();
|
| 177 |
+
$trp_languages = $trp->get_component( 'languages' );
|
| 178 |
+
$trp_settings = $trp->get_component( 'settings' );
|
| 179 |
+
$published_languages = $trp_languages->get_language_names( $trp_settings->get_settings()['publish-languages'] );
|
| 180 |
+
|
| 181 |
+
$element->add_control(
|
| 182 |
+
'trp_excluded_languages', array(
|
| 183 |
+
'type' => Controls_Manager::SELECT2,
|
| 184 |
+
'options' => $published_languages,
|
| 185 |
+
'multiple' => 'true',
|
| 186 |
+
'label_block' => 'true',
|
| 187 |
+
'description' => __( 'Choose from which languages to exclude this element.', 'translatepress' ),
|
| 188 |
+
)
|
| 189 |
+
);
|
| 190 |
+
|
| 191 |
+
$message = '<p>' . __( 'This element will still be visible when you are translating your website through the Translation Editor.', 'translatepress' ) . '</p>';
|
| 192 |
+
$message .= '<p>' . __( 'The content of this element should be written in the default language.', 'translatepress' ) . '</p>';
|
| 193 |
+
|
| 194 |
+
$element->add_control(
|
| 195 |
+
'trp_excluded_message', array(
|
| 196 |
+
'type' => Controls_Manager::RAW_HTML,
|
| 197 |
+
'raw' => $message,
|
| 198 |
+
)
|
| 199 |
+
);
|
| 200 |
+
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
// Verifies if element is hidden
|
| 204 |
+
public function is_hidden( $element ) {
|
| 205 |
+
|
| 206 |
+
$settings = $element->get_settings();
|
| 207 |
+
|
| 208 |
+
if( isset( $settings['trp_language_restriction'] ) && $settings['trp_language_restriction'] == 'yes' && !empty( $settings['trp_restricted_languages'] ) ){
|
| 209 |
+
|
| 210 |
+
$current_language = get_locale();
|
| 211 |
+
|
| 212 |
+
if( $current_language != $settings['trp_restricted_languages'] )
|
| 213 |
+
return true;
|
| 214 |
+
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
if( !isset( $_GET['trp-edit-translation'] ) && isset( $settings['trp_exclude_handler'] ) && $settings['trp_exclude_handler'] == 'yes' && !empty( $settings['trp_excluded_languages'] ) ){
|
| 218 |
+
|
| 219 |
+
$current_language = get_locale();
|
| 220 |
+
|
| 221 |
+
if( in_array( $current_language, $settings['trp_excluded_languages'] ) )
|
| 222 |
+
return true;
|
| 223 |
+
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
return false;
|
| 227 |
+
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
// Widget display & custom messages
|
| 231 |
+
public function widget_render( $content, $widget ) {
|
| 232 |
+
|
| 233 |
+
if( $this->is_hidden( $widget ) ){
|
| 234 |
+
|
| 235 |
+
if( \Elementor\Plugin::$instance->editor->is_edit_mode() )
|
| 236 |
+
return $content;
|
| 237 |
+
|
| 238 |
+
return '<style>' . $widget->get_unique_selector() . '{display:none !important}</style>';
|
| 239 |
+
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
return $content;
|
| 243 |
+
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
// Section display
|
| 247 |
+
public function section_render( $should_render, $element ) {
|
| 248 |
+
|
| 249 |
+
if( $this->is_hidden( $element ) === true )
|
| 250 |
+
return false;
|
| 251 |
+
|
| 252 |
+
return $should_render;
|
| 253 |
+
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
public function add_attributes( $element ){
|
| 257 |
+
|
| 258 |
+
$settings = $element->get_settings();
|
| 259 |
+
|
| 260 |
+
if( isset( $settings['trp_language_restriction'] ) && $settings['trp_language_restriction'] == 'yes' && !empty( $settings['trp_restricted_languages'] ) )
|
| 261 |
+
$element->add_render_attribute( '_wrapper', 'data-no-translation' );
|
| 262 |
+
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
/**
|
| 266 |
+
* Do not redirect when elementor preview is present
|
| 267 |
+
*
|
| 268 |
+
* @param $allow_redirect
|
| 269 |
+
*
|
| 270 |
+
* @return bool
|
| 271 |
+
*/
|
| 272 |
+
public function trp_elementor_compatibility( $allow_redirect ){
|
| 273 |
+
|
| 274 |
+
// compatibility with Elementor preview. Do not redirect to subdir language when elementor preview is present.
|
| 275 |
+
if ( isset( $_GET['elementor-preview'] ) )
|
| 276 |
+
return false;
|
| 277 |
+
|
| 278 |
+
return $allow_redirect;
|
| 279 |
+
|
| 280 |
+
}
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
// Instantiate Plugin Class
|
| 284 |
+
TRP_Elementor::instance();
|
includes/class-machine-translator.php
CHANGED
|
@@ -161,7 +161,10 @@ class TRP_Machine_Translator {
|
|
| 161 |
$shortcode_tags_to_execute = apply_filters( 'trp_do_these_shortcodes_before_automatic_translation', array('trp_language') );
|
| 162 |
|
| 163 |
foreach ($strings as $key => $string) {
|
| 164 |
-
|
|
|
|
|
|
|
|
|
|
| 165 |
$strings[$key] = trp_do_these_shortcodes( $strings[$key], $shortcode_tags_to_execute );
|
| 166 |
}
|
| 167 |
|
| 161 |
$shortcode_tags_to_execute = apply_filters( 'trp_do_these_shortcodes_before_automatic_translation', array('trp_language') );
|
| 162 |
|
| 163 |
foreach ($strings as $key => $string) {
|
| 164 |
+
/* html_entity_decode is needed before replacing the character "#" from the list because characters like “ (8220 utf8)
|
| 165 |
+
* will get an extra space after '&' which will break the character, rendering it like this: & #8220;
|
| 166 |
+
*/
|
| 167 |
+
$strings[$key] = str_replace($trp_exclude_words_from_automatic_translation, $placeholders, html_entity_decode( $string ));
|
| 168 |
$strings[$key] = trp_do_these_shortcodes( $strings[$key], $shortcode_tags_to_execute );
|
| 169 |
}
|
| 170 |
|
includes/class-query.php
CHANGED
|
@@ -81,7 +81,7 @@ class TRP_Query{
|
|
| 81 |
$this->maybe_record_automatic_translation_error(array( 'details' => 'Error running get_existing_translations()' ) );
|
| 82 |
if ( is_array( $dictionary ) && count( $dictionary ) === 0 && !$this->table_exists($this->get_table_name( $language_code )) ){
|
| 83 |
// if table is missing then last_error is empty for the select query
|
| 84 |
-
$this->maybe_record_automatic_translation_error(array( 'details' => 'Missing table ' . $this->get_table_name( $language_code ) ), true );
|
| 85 |
}
|
| 86 |
if ($this->db->last_error !== '')
|
| 87 |
$dictionary = false;
|
|
@@ -607,7 +607,7 @@ class TRP_Query{
|
|
| 607 |
$dictionary = $this->db->get_results( "SELECT id, original, translated, domain FROM `" . sanitize_text_field( $this->get_gettext_table_name( $language_code ) ) . "`", ARRAY_A );
|
| 608 |
if ( is_array( $dictionary ) && count( $dictionary ) === 0 && !$this->table_exists($this->get_gettext_table_name( $language_code )) ){
|
| 609 |
// if table is missing then last_error is empty
|
| 610 |
-
$this->maybe_record_automatic_translation_error(array( 'details' => 'Missing table ' . $this->get_gettext_table_name( $language_code ) ), true );
|
| 611 |
}
|
| 612 |
$this->maybe_record_automatic_translation_error(array( 'details' => 'Error running get_all_gettext_strings()' ) );
|
| 613 |
return $dictionary;
|
| 81 |
$this->maybe_record_automatic_translation_error(array( 'details' => 'Error running get_existing_translations()' ) );
|
| 82 |
if ( is_array( $dictionary ) && count( $dictionary ) === 0 && !$this->table_exists($this->get_table_name( $language_code )) ){
|
| 83 |
// if table is missing then last_error is empty for the select query
|
| 84 |
+
$this->maybe_record_automatic_translation_error(array( 'details' => 'Missing table ' . $this->get_table_name( $language_code ) . ' . To regenerate tables, try going to Settings->TranslatePress->General tab and Save Settings.'), true );
|
| 85 |
}
|
| 86 |
if ($this->db->last_error !== '')
|
| 87 |
$dictionary = false;
|
| 607 |
$dictionary = $this->db->get_results( "SELECT id, original, translated, domain FROM `" . sanitize_text_field( $this->get_gettext_table_name( $language_code ) ) . "`", ARRAY_A );
|
| 608 |
if ( is_array( $dictionary ) && count( $dictionary ) === 0 && !$this->table_exists($this->get_gettext_table_name( $language_code )) ){
|
| 609 |
// if table is missing then last_error is empty
|
| 610 |
+
$this->maybe_record_automatic_translation_error(array( 'details' => 'Missing table ' . $this->get_gettext_table_name( $language_code ). ' . To regenerate tables, try going to Settings->TranslatePress->General tab and Save Settings.'), true );
|
| 611 |
}
|
| 612 |
$this->maybe_record_automatic_translation_error(array( 'details' => 'Error running get_all_gettext_strings()' ) );
|
| 613 |
return $dictionary;
|
includes/class-translation-manager.php
CHANGED
|
@@ -938,7 +938,7 @@ class TRP_Translation_Manager{
|
|
| 938 |
* @return mixed
|
| 939 |
*/
|
| 940 |
static function strip_gettext_tags( $string ){
|
| 941 |
-
if( strpos( $string, ' data-trpgettextoriginal=' ) !== false ) {
|
| 942 |
$string = preg_replace('/ data-trpgettextoriginal=\d+#!trpen#/', '', $string);
|
| 943 |
$string = str_replace('#!trpst#trp-gettext', '', $string);
|
| 944 |
$string = str_replace('#!trpst#/trp-gettext', '', $string);
|
| 938 |
* @return mixed
|
| 939 |
*/
|
| 940 |
static function strip_gettext_tags( $string ){
|
| 941 |
+
if( is_string($string) && strpos( $string, ' data-trpgettextoriginal=' ) !== false ) {
|
| 942 |
$string = preg_replace('/ data-trpgettextoriginal=\d+#!trpen#/', '', $string);
|
| 943 |
$string = str_replace('#!trpst#trp-gettext', '', $string);
|
| 944 |
$string = str_replace('#!trpst#/trp-gettext', '', $string);
|
includes/compatibility-functions.php
CHANGED
|
@@ -2,22 +2,6 @@
|
|
| 2 |
|
| 3 |
/** Compatibility functions with WP core and various themes and plugins*/
|
| 4 |
|
| 5 |
-
/**
|
| 6 |
-
* Do not redirect when elementor preview is present
|
| 7 |
-
*
|
| 8 |
-
* @param $allow_redirect
|
| 9 |
-
*
|
| 10 |
-
* @return bool
|
| 11 |
-
*/
|
| 12 |
-
function trp_elementor_compatibility( $allow_redirect ){
|
| 13 |
-
// compatibility with Elementor preview. Do not redirect to subdir language when elementor preview is present.
|
| 14 |
-
if ( isset( $_GET['elementor-preview'] ) ) {
|
| 15 |
-
return false;
|
| 16 |
-
}
|
| 17 |
-
return $allow_redirect;
|
| 18 |
-
}
|
| 19 |
-
add_filter( 'trp_allow_language_redirect', 'trp_elementor_compatibility' );
|
| 20 |
-
|
| 21 |
/**
|
| 22 |
* Remove '?fl_builder' query param from edit translation url (when clicking the admin bar button to enter the translation Editor)
|
| 23 |
*
|
| 2 |
|
| 3 |
/** Compatibility functions with WP core and various themes and plugins*/
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
/**
|
| 6 |
* Remove '?fl_builder' query param from edit translation url (when clicking the admin bar button to enter the translation Editor)
|
| 7 |
*
|
index.php
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
Plugin Name: TranslatePress - Multilingual
|
| 4 |
Plugin URI: https://translatepress.com/
|
| 5 |
Description: Experience a better way of translating your WordPress site using a visual front-end translation editor, with full support for WooCommerce and site builders.
|
| 6 |
-
Version: 1.6.
|
| 7 |
Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
|
| 8 |
Author URI: https://cozmoslabs.com/
|
| 9 |
Text Domain: translatepress-multilingual
|
| 3 |
Plugin Name: TranslatePress - Multilingual
|
| 4 |
Plugin URI: https://translatepress.com/
|
| 5 |
Description: Experience a better way of translating your WordPress site using a visual front-end translation editor, with full support for WooCommerce and site builders.
|
| 6 |
+
Version: 1.6.4
|
| 7 |
Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
|
| 8 |
Author URI: https://cozmoslabs.com/
|
| 9 |
Text Domain: translatepress-multilingual
|
languages/translatepress-multilingual.pot
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# Copyright (C)
|
| 2 |
# This file is distributed under the same license as the TranslatePress Multilingual package.
|
| 3 |
msgid ""
|
| 4 |
msgstr ""
|
|
@@ -637,7 +637,7 @@ msgstr ""
|
|
| 637 |
msgid "click here"
|
| 638 |
msgstr ""
|
| 639 |
|
| 640 |
-
#: ../translatepress/includes/compatibility-functions.php:
|
| 641 |
msgid "<strong>TranslatePress</strong> requires <strong><a href=\"http://php.net/manual/en/book.mbstring.php\">Multibyte String PHP library</a></strong>. Please contact your server administrator to install it on your server."
|
| 642 |
msgstr ""
|
| 643 |
|
| 1 |
+
# Copyright (C) 2020 TranslatePress Multilingual
|
| 2 |
# This file is distributed under the same license as the TranslatePress Multilingual package.
|
| 3 |
msgid ""
|
| 4 |
msgstr ""
|
| 637 |
msgid "click here"
|
| 638 |
msgstr ""
|
| 639 |
|
| 640 |
+
#: ../translatepress/includes/compatibility-functions.php:28
|
| 641 |
msgid "<strong>TranslatePress</strong> requires <strong><a href=\"http://php.net/manual/en/book.mbstring.php\">Multibyte String PHP library</a></strong>. Please contact your server administrator to install it on your server."
|
| 642 |
msgstr ""
|
| 643 |
|
readme.txt
CHANGED
|
@@ -3,9 +3,9 @@ Contributors: cozmoslabs, razvan.mo, madalin.ungureanu, cristophor
|
|
| 3 |
Donate link: https://www.translatepress.com/
|
| 4 |
Tags: translate, translation, multilingual, automatic translation, bilingual, front-end translation, google translate, language
|
| 5 |
Requires at least: 3.1.0
|
| 6 |
-
Tested up to: 5.3.
|
| 7 |
Requires PHP: 5.6.20
|
| 8 |
-
Stable tag: 1.6.
|
| 9 |
License: GPLv2 or later
|
| 10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 11 |
|
|
@@ -143,6 +143,12 @@ For more information please check out [TranslatePress - Multilingual plugin docu
|
|
| 143 |
|
| 144 |
|
| 145 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
= 1.6.3 =
|
| 147 |
* Fixed bug not being able to disable block crawlers option
|
| 148 |
* Improved UI on settings navigation tab
|
| 3 |
Donate link: https://www.translatepress.com/
|
| 4 |
Tags: translate, translation, multilingual, automatic translation, bilingual, front-end translation, google translate, language
|
| 5 |
Requires at least: 3.1.0
|
| 6 |
+
Tested up to: 5.3.2
|
| 7 |
Requires PHP: 5.6.20
|
| 8 |
+
Stable tag: 1.6.4
|
| 9 |
License: GPLv2 or later
|
| 10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 11 |
|
| 143 |
|
| 144 |
|
| 145 |
== Changelog ==
|
| 146 |
+
= 1.6.4 =
|
| 147 |
+
* Added a conditional Elementor block for language.
|
| 148 |
+
* Fixed Google Translate breaking some characters such as & #8220;
|
| 149 |
+
* Improvements to error handling
|
| 150 |
+
* Fixed a js error
|
| 151 |
+
|
| 152 |
= 1.6.3 =
|
| 153 |
* Fixed bug not being able to disable block crawlers option
|
| 154 |
* Improved UI on settings navigation tab
|
