Version Description
- Fixed admin-bar appearing in translation editor
- Nextgen plugin compatibility fix
- Fixed a notice index translation-engine not set.
- Refactored upgrading settings.
- Solved issue with notifications shown in all backend that couldn't be dismissed
- Added ability to detect if table is missing during requests. Show admin notice on all pages.
- Updated License message and Automatic Translation description
- Created notifications and error page. Disabled machine translations upon error.
Download this release
Release Info
Developer | madalin.ungureanu |
Plugin | TranslatePress – Translate Multilingual sites |
Version | 1.6.2 |
Comparing to | |
See all releases |
Code changes from version 1.6.1 to 1.6.2
- class-translate-press.php +12 -2
- includes/class-error-manager.php +149 -0
- includes/class-machine-translation-tab.php +6 -2
- includes/class-machine-translator.php +1 -1
- includes/class-plugin-notices.php +9 -1
- includes/class-query.php +79 -7
- includes/class-settings.php +22 -36
- includes/class-translation-render.php +5 -0
- includes/class-upgrade.php +54 -14
- includes/compatibility-functions.php +22 -10
- includes/google-translate/class-google-translate-v2-machine-translator.php +5 -1
- index.php +2 -2
- languages/translatepress-multilingual.catalog.php +7 -3
- languages/translatepress-multilingual.pot +58 -42
- partials/error-manager-page.php +12 -0
- partials/license-settings-page.php +1 -1
- partials/machine-translation-settings-page.php +1 -1
- readme.txt +12 -2
class-translate-press.php
CHANGED
@@ -26,6 +26,7 @@ class TRP_Translate_Press{
|
|
26 |
protected $advanced_tab;
|
27 |
protected $translation_memory;
|
28 |
protected $machine_translation_tab;
|
|
|
29 |
|
30 |
public $active_pro_addons = array();
|
31 |
public static $translate_press = null;
|
@@ -51,7 +52,7 @@ class TRP_Translate_Press{
|
|
51 |
define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
52 |
define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
|
53 |
define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
|
54 |
-
define( 'TRP_PLUGIN_VERSION', '1.6.
|
55 |
|
56 |
wp_cache_add_non_persistent_groups(array('trp'));
|
57 |
|
@@ -96,6 +97,7 @@ class TRP_Translate_Press{
|
|
96 |
require_once TRP_PLUGIN_DIR . 'includes/class-plugin-notices.php';
|
97 |
require_once TRP_PLUGIN_DIR . 'includes/class-advanced-tab.php';
|
98 |
require_once TRP_PLUGIN_DIR . 'includes/class-translation-memory.php';
|
|
|
99 |
require_once TRP_PLUGIN_DIR . 'includes/external-functions.php';
|
100 |
require_once TRP_PLUGIN_DIR . 'includes/compatibility-functions.php';
|
101 |
require_once TRP_PLUGIN_DIR . 'includes/functions.php';
|
@@ -131,6 +133,7 @@ class TRP_Translate_Press{
|
|
131 |
$this->plugin_updater = new TRP_Plugin_Updater();
|
132 |
$this->license_page = new TRP_LICENSE_PAGE();
|
133 |
$this->translation_memory = new TRP_Translation_Memory( $this->settings->get_settings() );
|
|
|
134 |
}
|
135 |
|
136 |
/**
|
@@ -189,6 +192,13 @@ class TRP_Translate_Press{
|
|
189 |
//Machine Translation Logger defaults
|
190 |
$this->loader->add_action( 'trp_machine_translation_sanitize_settings', $this->machine_translator_logger, 'sanitize_settings', 10, 1 );
|
191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
$this->loader->add_action( 'wp_ajax_nopriv_trp_get_translations_regular', $this->editor_api_regular_strings, 'get_translations' );
|
193 |
|
194 |
$this->loader->add_action( 'wp_ajax_trp_get_translations_regular', $this->editor_api_regular_strings, 'get_translations' );
|
@@ -239,7 +249,7 @@ class TRP_Translate_Press{
|
|
239 |
if( isset( $_REQUEST['doing_wp_cron'] ) )
|
240 |
return;
|
241 |
|
242 |
-
$this->loader->add_action( 'init', $this->translation_render, 'start_output_buffer', 0 );
|
243 |
$this->loader->add_action( 'wp_enqueue_scripts', $this->translation_render, 'enqueue_scripts', 10 );
|
244 |
$this->loader->add_action( 'wp_enqueue_scripts', $this->translation_render, 'enqueue_dynamic_translation', 1 );
|
245 |
$this->loader->add_filter( 'wp_redirect', $this->translation_render, 'force_preview_on_url_redirect', 99, 2 );
|
26 |
protected $advanced_tab;
|
27 |
protected $translation_memory;
|
28 |
protected $machine_translation_tab;
|
29 |
+
protected $error_manager;
|
30 |
|
31 |
public $active_pro_addons = array();
|
32 |
public static $translate_press = null;
|
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.2' );
|
56 |
|
57 |
wp_cache_add_non_persistent_groups(array('trp'));
|
58 |
|
97 |
require_once TRP_PLUGIN_DIR . 'includes/class-plugin-notices.php';
|
98 |
require_once TRP_PLUGIN_DIR . 'includes/class-advanced-tab.php';
|
99 |
require_once TRP_PLUGIN_DIR . 'includes/class-translation-memory.php';
|
100 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-error-manager.php';
|
101 |
require_once TRP_PLUGIN_DIR . 'includes/external-functions.php';
|
102 |
require_once TRP_PLUGIN_DIR . 'includes/compatibility-functions.php';
|
103 |
require_once TRP_PLUGIN_DIR . 'includes/functions.php';
|
133 |
$this->plugin_updater = new TRP_Plugin_Updater();
|
134 |
$this->license_page = new TRP_LICENSE_PAGE();
|
135 |
$this->translation_memory = new TRP_Translation_Memory( $this->settings->get_settings() );
|
136 |
+
$this->error_manager = new TRP_Error_Manager( $this->settings->get_settings() );
|
137 |
}
|
138 |
|
139 |
/**
|
192 |
//Machine Translation Logger defaults
|
193 |
$this->loader->add_action( 'trp_machine_translation_sanitize_settings', $this->machine_translator_logger, 'sanitize_settings', 10, 1 );
|
194 |
|
195 |
+
//Error manager hooks
|
196 |
+
$this->loader->add_action( 'admin_init', $this->error_manager, 'show_notification_about_errors', 10 );
|
197 |
+
$this->loader->add_action( 'admin_menu', $this->error_manager, 'register_submenu_errors_page', 10 );
|
198 |
+
$this->loader->add_action( 'trp_dismiss_notification', $this->error_manager, 'clear_notification_from_db', 10, 2 );
|
199 |
+
$this->loader->add_filter( 'trp_machine_translation_sanitize_settings', $this->error_manager, 'clear_disable_machine_translation_notification_from_db', 10, 1 );
|
200 |
+
$this->loader->add_filter( 'trp_error_manager_page_output', $this->error_manager, 'output_db_errors', 10, 1 );
|
201 |
+
|
202 |
$this->loader->add_action( 'wp_ajax_nopriv_trp_get_translations_regular', $this->editor_api_regular_strings, 'get_translations' );
|
203 |
|
204 |
$this->loader->add_action( 'wp_ajax_trp_get_translations_regular', $this->editor_api_regular_strings, 'get_translations' );
|
249 |
if( isset( $_REQUEST['doing_wp_cron'] ) )
|
250 |
return;
|
251 |
|
252 |
+
$this->loader->add_action( 'init', $this->translation_render, 'start_output_buffer', apply_filters( 'trp_start_output_buffer_priority', 0 ) );
|
253 |
$this->loader->add_action( 'wp_enqueue_scripts', $this->translation_render, 'enqueue_scripts', 10 );
|
254 |
$this->loader->add_action( 'wp_enqueue_scripts', $this->translation_render, 'enqueue_dynamic_translation', 1 );
|
255 |
$this->loader->add_filter( 'wp_redirect', $this->translation_render, 'force_preview_on_url_redirect', 99, 2 );
|
includes/class-error-manager.php
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class TRP_Error_Manager
|
5 |
+
*/
|
6 |
+
class TRP_Error_Manager{
|
7 |
+
protected $settings;
|
8 |
+
/* @var TRP_Settings */
|
9 |
+
protected $trp_settings;
|
10 |
+
|
11 |
+
public function __construct( $settings){
|
12 |
+
$this->settings = $settings;
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Record specified error in trp_db_errors option
|
17 |
+
*
|
18 |
+
* @param $error_details array Suggested fields:
|
19 |
+
'last_error' => $this->db->last_error,
|
20 |
+
'details' => 'Insert general description',
|
21 |
+
'disable_automatic_translations' => bool
|
22 |
+
*/
|
23 |
+
public function record_error( $error_details ){
|
24 |
+
$option = get_option('trp_db_errors', array(
|
25 |
+
'notifications' => array(),
|
26 |
+
'errors' => array()
|
27 |
+
));
|
28 |
+
if ( count( $option['errors'] ) >= 5 ){
|
29 |
+
// only record the last few errors to avoid huge db options
|
30 |
+
array_shift($option['errors'] );
|
31 |
+
}
|
32 |
+
$error_details['date_time'] = date('Y-m-d H:i:s');
|
33 |
+
$error_details['timestamp'] = time();
|
34 |
+
|
35 |
+
// specific actions for this error: add notification message and disable machine translation
|
36 |
+
if ( isset( $error_details['disable_automatic_translations'] ) && $error_details['disable_automatic_translations'] === true ){
|
37 |
+
|
38 |
+
if ( ! $this->trp_settings ) {
|
39 |
+
$trp = TRP_Translate_Press::get_trp_instance();
|
40 |
+
$this->trp_settings = $trp->get_component( 'settings' );
|
41 |
+
}
|
42 |
+
$error_message = wp_kses( sprintf( __('<strong>TranslatePress</strong> encountered SQL errors. <a href="%s" title="View TranslatePress SQL Errors">Check out the errors</a>.', 'translatepress-multilingual'), admin_url( 'admin.php?page=trp_error_manager' ) ), array('a' => array('href' => array(), 'title' => array()), 'strong' => array()));
|
43 |
+
$mt_settings_option = get_option('trp_machine_translation_settings', $this->trp_settings->get_default_trp_machine_translation_settings() );
|
44 |
+
if ( $mt_settings_option['machine-translation'] != 'no' ) {
|
45 |
+
$mt_settings_option['machine-translation'] = 'no';
|
46 |
+
update_option('trp_machine_translation_settings', $mt_settings_option );
|
47 |
+
|
48 |
+
// filter is needed to block automatic translation in this execution. The settings don't update throughout the plugin for this request. Only the next request will have machine translation turned off.
|
49 |
+
add_filter( 'trp_disable_automatic_translations_due_to_error', __return_true() );
|
50 |
+
|
51 |
+
$error_message = wp_kses( __('Automatic translation has been disabled.','translatepress-multilingual'), array('strong' => array() ) ) . ' ' . $error_message ;
|
52 |
+
}
|
53 |
+
if ( !isset( $option['notifications']['disable_automatic_translations'] ) ) {
|
54 |
+
$option['notifications']['disable_automatic_translations' ] = array(
|
55 |
+
// we need a unique ID so that after the notice is dismissed and this type of error appears again, it's not already marked as dismissed for that user
|
56 |
+
'notification_id' => 'disable_automatic_translations' . time(),
|
57 |
+
'message' => $error_message
|
58 |
+
);
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
|
63 |
+
$option['errors'][] = $error_details;
|
64 |
+
update_option( 'trp_db_errors', $option );
|
65 |
+
}
|
66 |
+
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Remove notification from trp_db_errors too (not only user_meta) when dismissed by user
|
70 |
+
*
|
71 |
+
* Necessary in order to allow logging of this error in the future. Basically allow creation of new notifications about this error.
|
72 |
+
*
|
73 |
+
* Hooked to trp_dismiss_notification
|
74 |
+
*
|
75 |
+
* @param $notification_id
|
76 |
+
* @param $current_user
|
77 |
+
*/
|
78 |
+
public function clear_notification_from_db($notification_id, $current_user ){
|
79 |
+
$option = get_option( 'trp_db_errors', false );
|
80 |
+
if ( isset( $option['notifications'] ) ) {
|
81 |
+
foreach ($option['notifications'] as $key => $logged_notification ){
|
82 |
+
if ( $logged_notification['notification_id'] === $notification_id || $key === $notification_id ) {
|
83 |
+
unset( $option['notifications'][$key] );
|
84 |
+
update_option('trp_db_errors', $option );
|
85 |
+
break;
|
86 |
+
}
|
87 |
+
}
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* When enabling machine translation, clear the Automatic translation has been disabled message
|
93 |
+
*
|
94 |
+
* @param $mt_settings
|
95 |
+
* @return string $mt_settings
|
96 |
+
*/
|
97 |
+
public function clear_disable_machine_translation_notification_from_db( $mt_settings ){
|
98 |
+
if ( $mt_settings['machine-translation'] === 'yes' ){
|
99 |
+
$this->clear_notification_from_db('disable_automatic_translations', null);
|
100 |
+
}
|
101 |
+
return $mt_settings;
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
*
|
106 |
+
* Hooked to admin_init
|
107 |
+
*/
|
108 |
+
public function show_notification_about_errors(){
|
109 |
+
$option = get_option( 'trp_db_errors', false );
|
110 |
+
if ( $option !== false ) {
|
111 |
+
foreach( $option['notifications'] as $logged_notification ) {
|
112 |
+
$notifications = TRP_Plugin_Notifications::get_instance();
|
113 |
+
|
114 |
+
$notification_id = $logged_notification['notification_id'];
|
115 |
+
|
116 |
+
$message = '<p style="padding-right:30px;">' . $logged_notification['message'] . '</p>';
|
117 |
+
//make sure to use the trp_dismiss_admin_notification arg
|
118 |
+
$message .= '<a href="' . add_query_arg(array('trp_dismiss_admin_notification' => $notification_id)) . '" type="button" class="notice-dismiss" style="text-decoration: none;z-index:100;"><span class="screen-reader-text">' . __('Dismiss this notice.', 'translatepress-multilingual') . '</span></a>';
|
119 |
+
|
120 |
+
$notifications->add_notification($notification_id, $message, 'trp-notice trp-narrow notice error is-dismissible', true, array('translate-press'), true);
|
121 |
+
}
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
public function register_submenu_errors_page(){
|
126 |
+
add_submenu_page( 'TRPHidden', 'TranslatePress Error Manager', 'TRPHidden', 'manage_options', 'trp_error_manager', array( $this, 'error_manager_page_content' ) );
|
127 |
+
}
|
128 |
+
|
129 |
+
public function error_manager_page_content(){
|
130 |
+
require_once TRP_PLUGIN_DIR . 'partials/error-manager-page.php';
|
131 |
+
}
|
132 |
+
|
133 |
+
public function output_db_errors( $html_content ){
|
134 |
+
$option = get_option( 'trp_db_errors', false );
|
135 |
+
if ( $option !== false && isset($option['errors']) ) {
|
136 |
+
$html_content .= '<table>';
|
137 |
+
foreach ($option['errors'] as $count => $error) {
|
138 |
+
$count = ( is_int( $count) ) ? $count + 1 : $count;
|
139 |
+
$html_content .= '<tr><td>' . esc_html($count) . '</td></tr>';
|
140 |
+
foreach( $error as $key => $error_detail ){
|
141 |
+
$html_content .= '<tr><td><strong>' . esc_html($key ) . '</strong></td>' . '<td>' .esc_html( $error_detail ) . '</td></tr>';
|
142 |
+
}
|
143 |
+
|
144 |
+
}
|
145 |
+
$html_content .= '</table>';
|
146 |
+
}
|
147 |
+
return $html_content;
|
148 |
+
}
|
149 |
+
}
|
includes/class-machine-translation-tab.php
CHANGED
@@ -8,8 +8,7 @@ class TRP_Machine_Translation_Tab {
|
|
8 |
|
9 |
$this->settings = $settings;
|
10 |
|
11 |
-
|
12 |
-
add_filter( 'trp_machine_translation_engines', [ $this, 'translation_engines_upsell' ], 20 );
|
13 |
|
14 |
}
|
15 |
|
@@ -111,6 +110,11 @@ class TRP_Machine_Translation_Tab {
|
|
111 |
return new $value( $this->settings );
|
112 |
}
|
113 |
|
|
|
|
|
|
|
|
|
|
|
114 |
public function translation_engines_upsell( $engines ){
|
115 |
$engines[] = array( 'value' => 'deepl_upsell', 'label' => __( 'DeepL', 'translatepress-multilingual' ) );
|
116 |
|
8 |
|
9 |
$this->settings = $settings;
|
10 |
|
11 |
+
add_action( 'plugins_loaded', array( $this, 'add_upsell_filter' ) );
|
|
|
12 |
|
13 |
}
|
14 |
|
110 |
return new $value( $this->settings );
|
111 |
}
|
112 |
|
113 |
+
public function add_upsell_filter(){
|
114 |
+
if( !class_exists( 'TRP_DeepL' ) )
|
115 |
+
add_filter( 'trp_machine_translation_engines', [ $this, 'translation_engines_upsell' ], 20 );
|
116 |
+
}
|
117 |
+
|
118 |
public function translation_engines_upsell( $engines ){
|
119 |
$engines[] = array( 'value' => 'deepl_upsell', 'label' => __( 'DeepL', 'translatepress-multilingual' ) );
|
120 |
|
includes/class-machine-translator.php
CHANGED
@@ -153,7 +153,7 @@ class TRP_Machine_Translator {
|
|
153 |
* @return array
|
154 |
*/
|
155 |
public function translate($strings, $target_language_code, $source_language_code = null ){
|
156 |
-
if ( !empty($strings) && is_array($strings) && method_exists( $this, 'translate_array' ) ) {
|
157 |
|
158 |
/* google has a problem translating this characters ( '%', '$', '#' )...for some reasons it puts spaces after them so we need to 'encode' them and decode them back. hopefully it won't break anything important */
|
159 |
$trp_exclude_words_from_automatic_translation = apply_filters('trp_exclude_words_from_automatic_translation', array('%', '$', '#'));
|
153 |
* @return array
|
154 |
*/
|
155 |
public function translate($strings, $target_language_code, $source_language_code = null ){
|
156 |
+
if ( !empty($strings) && is_array($strings) && method_exists( $this, 'translate_array' ) && apply_filters( 'trp_disable_automatic_translations_due_to_error', false ) === false ) {
|
157 |
|
158 |
/* google has a problem translating this characters ( '%', '$', '#' )...for some reasons it puts spaces after them so we need to 'encode' them and decode them back. hopefully it won't break anything important */
|
159 |
$trp_exclude_words_from_automatic_translation = apply_filters('trp_exclude_words_from_automatic_translation', array('%', '$', '#'));
|
includes/class-plugin-notices.php
CHANGED
@@ -42,13 +42,20 @@ class TRP_Add_General_Notices{
|
|
42 |
if ( current_user_can( 'manage_options' ) ){
|
43 |
// Check that the user hasn't already clicked to ignore the message
|
44 |
if ( ! get_user_meta($user_id, $this->notificationId.'_dismiss_notification' ) || $this->force_show ) {//ignore the dismissal if we have force_show
|
45 |
-
|
|
|
|
|
46 |
}
|
47 |
do_action( $this->notificationId.'_notification_displayed', $current_user, $pagenow );
|
48 |
}
|
49 |
do_action( $this->notificationId.'_after_notification_displayed', $current_user, $pagenow );
|
50 |
}
|
51 |
|
|
|
|
|
|
|
|
|
|
|
52 |
function dismiss_notification() {
|
53 |
global $current_user;
|
54 |
|
@@ -233,6 +240,7 @@ Class TRP_Plugin_Notifications {
|
|
233 |
public function dismiss_notification( $notification_id = '' ) {
|
234 |
global $current_user;
|
235 |
add_user_meta( $current_user->ID, $notification_id . '_dismiss_notification', 'true', true );
|
|
|
236 |
}
|
237 |
|
238 |
|
42 |
if ( current_user_can( 'manage_options' ) ){
|
43 |
// Check that the user hasn't already clicked to ignore the message
|
44 |
if ( ! get_user_meta($user_id, $this->notificationId.'_dismiss_notification' ) || $this->force_show ) {//ignore the dismissal if we have force_show
|
45 |
+
add_filter('safe_style_css', array( $this, 'allow_z_index_in_wp_kses'));
|
46 |
+
echo $finalMessage = wp_kses( apply_filters($this->notificationId.'_notification_message','<div class="'. $this->notificationClass .'" >'.$this->notificationMessage.'</div>', $this->notificationMessage), [ 'div' => [ 'class' => [] ], 'p' => ['style' => [], 'class' => []], 'a' => ['href' => [], 'type'=> [], 'class'=> [], 'style'=>[]], 'span' => ['class'=> []], 'strong' => [] ] );
|
47 |
+
remove_filter('safe_style_css', array( $this, 'allow_z_index_in_wp_kses'));
|
48 |
}
|
49 |
do_action( $this->notificationId.'_notification_displayed', $current_user, $pagenow );
|
50 |
}
|
51 |
do_action( $this->notificationId.'_after_notification_displayed', $current_user, $pagenow );
|
52 |
}
|
53 |
|
54 |
+
function allow_z_index_in_wp_kses( $styles ) {
|
55 |
+
$styles[] = 'z-index';
|
56 |
+
return $styles;
|
57 |
+
}
|
58 |
+
|
59 |
function dismiss_notification() {
|
60 |
global $current_user;
|
61 |
|
240 |
public function dismiss_notification( $notification_id = '' ) {
|
241 |
global $current_user;
|
242 |
add_user_meta( $current_user->ID, $notification_id . '_dismiss_notification', 'true', true );
|
243 |
+
do_action('trp_dismiss_notification', $notification_id, $current_user);
|
244 |
}
|
245 |
|
246 |
|
includes/class-query.php
CHANGED
@@ -12,6 +12,8 @@ class TRP_Query{
|
|
12 |
public $db;
|
13 |
protected $settings;
|
14 |
protected $translation_render;
|
|
|
|
|
15 |
|
16 |
const NOT_TRANSLATED = 0;
|
17 |
const MACHINE_TRANSLATED = 1;
|
@@ -76,6 +78,11 @@ class TRP_Query{
|
|
76 |
$prepared_query = $this->db->prepare( $query, $values );
|
77 |
$dictionary = $this->db->get_results( $prepared_query, OBJECT_K );
|
78 |
|
|
|
|
|
|
|
|
|
|
|
79 |
if ($this->db->last_error !== '')
|
80 |
$dictionary = false;
|
81 |
|
@@ -163,12 +170,19 @@ class TRP_Query{
|
|
163 |
$sql_index = "CREATE INDEX index_name ON `" . $table_name . "` (original(100));";
|
164 |
$this->db->query( $sql_index );
|
165 |
|
166 |
-
|
167 |
-
$sql_index = "CREATE FULLTEXT INDEX original_fulltext ON `" . $table_name . "`(original);";
|
168 |
-
$this->db->query( $sql_index );
|
169 |
|
170 |
-
|
171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
}else{
|
173 |
$this->check_for_block_type_column( $language_code, $default_language );
|
174 |
}
|
@@ -202,8 +216,11 @@ class TRP_Query{
|
|
202 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
203 |
dbDelta( $sql );
|
204 |
|
|
|
|
|
205 |
if ( $this->db->get_var( "SHOW TABLES LIKE '$table_name'" ) != $table_name )
|
206 |
{
|
|
|
207 |
// something failed. Table still doesn't exist.
|
208 |
return false;
|
209 |
}
|
@@ -257,6 +274,8 @@ class TRP_Query{
|
|
257 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
258 |
dbDelta( $sql );
|
259 |
|
|
|
|
|
260 |
$sql_index = "CREATE INDEX index_name ON `" . $table_name . "` (original(100));";
|
261 |
$this->db->query( $sql_index );
|
262 |
|
@@ -372,6 +391,8 @@ class TRP_Query{
|
|
372 |
|
373 |
$prepared_query = $this->db->prepare($query . ' ', $values);
|
374 |
$this->db->query( $prepared_query );
|
|
|
|
|
375 |
}
|
376 |
|
377 |
/**
|
@@ -403,6 +424,8 @@ class TRP_Query{
|
|
403 |
// you cannot insert multiple rows at once using insert() method.
|
404 |
// but by using prepare you cannot insert NULL values.
|
405 |
$this->db->query( $this->db->prepare($query . ' ', $values) );
|
|
|
|
|
406 |
}
|
407 |
|
408 |
public function insert_gettext_strings( $new_strings, $language_code ){
|
@@ -436,6 +459,8 @@ class TRP_Query{
|
|
436 |
|
437 |
$query .= implode(', ', $place_holders);
|
438 |
$this->db->query( $this->db->prepare($query . ' ', $values) );
|
|
|
|
|
439 |
|
440 |
if( count( $new_strings ) == 1 )
|
441 |
return $this->db->insert_id;
|
@@ -497,6 +522,8 @@ class TRP_Query{
|
|
497 |
$query .= $on_duplicate;
|
498 |
|
499 |
$this->db->query( $this->db->prepare($query . ' ', $values) );
|
|
|
|
|
500 |
}
|
501 |
|
502 |
/**
|
@@ -521,6 +548,8 @@ class TRP_Query{
|
|
521 |
|
522 |
$query .= "( " . implode ( ", ", $placeholders ) . " )";
|
523 |
$dictionary = $this->db->get_results( $this->db->prepare( $query, $values ), $output );
|
|
|
|
|
524 |
return $dictionary;
|
525 |
}
|
526 |
|
@@ -548,6 +577,7 @@ class TRP_Query{
|
|
548 |
|
549 |
$query .= "( " . implode ( ", ", $placeholders ) . " )";
|
550 |
$dictionary = $this->db->get_results( $this->db->prepare( $query, $values ), OBJECT_K );
|
|
|
551 |
return $dictionary;
|
552 |
}
|
553 |
|
@@ -575,13 +605,17 @@ class TRP_Query{
|
|
575 |
|
576 |
public function get_all_gettext_strings( $language_code ){
|
577 |
$dictionary = $this->db->get_results( "SELECT id, original, translated, domain FROM `" . sanitize_text_field( $this->get_gettext_table_name( $language_code ) ) . "`", ARRAY_A );
|
578 |
-
|
|
|
|
|
|
|
|
|
579 |
return $dictionary;
|
580 |
}
|
581 |
|
582 |
public function get_all_gettext_translated_strings( $language_code ){
|
583 |
$dictionary = $this->db->get_results("SELECT id, original, translated, domain FROM `" . sanitize_text_field( $this->get_gettext_table_name( $language_code ) ) . "` WHERE translated <>'' AND status != " . self::NOT_TRANSLATED, ARRAY_A );
|
584 |
-
|
585 |
return $dictionary;
|
586 |
}
|
587 |
|
@@ -645,6 +679,7 @@ class TRP_Query{
|
|
645 |
|
646 |
|
647 |
$dictionary = $this->db->get_results( $query, $output );
|
|
|
648 |
return $dictionary;
|
649 |
}
|
650 |
|
@@ -663,6 +698,7 @@ class TRP_Query{
|
|
663 |
|
664 |
$query .= "( " . implode ( ", ", $placeholders ) . " )";
|
665 |
$dictionary = $this->db->get_results( $this->db->prepare( $query, $values ), ARRAY_A );
|
|
|
666 |
return $dictionary;
|
667 |
}
|
668 |
|
@@ -681,6 +717,7 @@ class TRP_Query{
|
|
681 |
|
682 |
$query .= "( " . implode ( ", ", $placeholders ) . " )";
|
683 |
$dictionary = $this->db->get_results( $this->db->prepare( $query, $values ), ARRAY_A );
|
|
|
684 |
return $dictionary;
|
685 |
}
|
686 |
|
@@ -829,4 +866,39 @@ class TRP_Query{
|
|
829 |
return $this->db->query( $sql );
|
830 |
}
|
831 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
832 |
}
|
12 |
public $db;
|
13 |
protected $settings;
|
14 |
protected $translation_render;
|
15 |
+
protected $error_manager;
|
16 |
+
protected $tables_exist = array();
|
17 |
|
18 |
const NOT_TRANSLATED = 0;
|
19 |
const MACHINE_TRANSLATED = 1;
|
78 |
$prepared_query = $this->db->prepare( $query, $values );
|
79 |
$dictionary = $this->db->get_results( $prepared_query, OBJECT_K );
|
80 |
|
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;
|
88 |
|
170 |
$sql_index = "CREATE INDEX index_name ON `" . $table_name . "` (original(100));";
|
171 |
$this->db->query( $sql_index );
|
172 |
|
173 |
+
$this->maybe_record_automatic_translation_error(array( 'details' => 'Error creating regular tables' ) );
|
|
|
|
|
174 |
|
175 |
+
if ( $this->db->get_var( "SHOW TABLES LIKE '$table_name'" ) != $table_name ) {
|
176 |
+
// table still doesn't exist after creation
|
177 |
+
$this->maybe_record_automatic_translation_error(array( 'details' => 'Error creating regular strings tables' ), true );
|
178 |
+
}else {
|
179 |
+
// full text index for original
|
180 |
+
$sql_index = "CREATE FULLTEXT INDEX original_fulltext ON `" . $table_name . "`(original);";
|
181 |
+
$this->db->query( $sql_index );
|
182 |
+
|
183 |
+
//syncronize all translation blocks.
|
184 |
+
$this->copy_all_translation_blocks_into_table($default_language, $language_code);
|
185 |
+
}
|
186 |
}else{
|
187 |
$this->check_for_block_type_column( $language_code, $default_language );
|
188 |
}
|
216 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
217 |
dbDelta( $sql );
|
218 |
|
219 |
+
$this->maybe_record_automatic_translation_error(array( 'details' => 'Error creating machine translation log tables' ) );
|
220 |
+
|
221 |
if ( $this->db->get_var( "SHOW TABLES LIKE '$table_name'" ) != $table_name )
|
222 |
{
|
223 |
+
$this->maybe_record_automatic_translation_error(array( 'details' => 'Error creating machine translation log tables' ), true );
|
224 |
// something failed. Table still doesn't exist.
|
225 |
return false;
|
226 |
}
|
274 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
275 |
dbDelta( $sql );
|
276 |
|
277 |
+
$this->maybe_record_automatic_translation_error(array( 'details' => 'Error creating gettext strings tables' ) );
|
278 |
+
|
279 |
$sql_index = "CREATE INDEX index_name ON `" . $table_name . "` (original(100));";
|
280 |
$this->db->query( $sql_index );
|
281 |
|
391 |
|
392 |
$prepared_query = $this->db->prepare($query . ' ', $values);
|
393 |
$this->db->query( $prepared_query );
|
394 |
+
|
395 |
+
$this->maybe_record_automatic_translation_error(array( 'details' => 'Error running update_strings()' ) );
|
396 |
}
|
397 |
|
398 |
/**
|
424 |
// you cannot insert multiple rows at once using insert() method.
|
425 |
// but by using prepare you cannot insert NULL values.
|
426 |
$this->db->query( $this->db->prepare($query . ' ', $values) );
|
427 |
+
|
428 |
+
$this->maybe_record_automatic_translation_error(array( 'details' => 'Error running insert_strings()' ) );
|
429 |
}
|
430 |
|
431 |
public function insert_gettext_strings( $new_strings, $language_code ){
|
459 |
|
460 |
$query .= implode(', ', $place_holders);
|
461 |
$this->db->query( $this->db->prepare($query . ' ', $values) );
|
462 |
+
|
463 |
+
$this->maybe_record_automatic_translation_error(array( 'details' => 'Error running insert_gettext_strings()' ) );
|
464 |
|
465 |
if( count( $new_strings ) == 1 )
|
466 |
return $this->db->insert_id;
|
522 |
$query .= $on_duplicate;
|
523 |
|
524 |
$this->db->query( $this->db->prepare($query . ' ', $values) );
|
525 |
+
|
526 |
+
$this->maybe_record_automatic_translation_error(array( 'details' => 'Error running update_gettext_strings()' ) );
|
527 |
}
|
528 |
|
529 |
/**
|
548 |
|
549 |
$query .= "( " . implode ( ", ", $placeholders ) . " )";
|
550 |
$dictionary = $this->db->get_results( $this->db->prepare( $query, $values ), $output );
|
551 |
+
|
552 |
+
$this->maybe_record_automatic_translation_error(array( 'details' => 'Error running get_string_ids()' ) );
|
553 |
return $dictionary;
|
554 |
}
|
555 |
|
577 |
|
578 |
$query .= "( " . implode ( ", ", $placeholders ) . " )";
|
579 |
$dictionary = $this->db->get_results( $this->db->prepare( $query, $values ), OBJECT_K );
|
580 |
+
$this->maybe_record_automatic_translation_error(array( 'details' => 'Error running get_untranslated_strings()' ) );
|
581 |
return $dictionary;
|
582 |
}
|
583 |
|
605 |
|
606 |
public function get_all_gettext_strings( $language_code ){
|
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;
|
614 |
}
|
615 |
|
616 |
public function get_all_gettext_translated_strings( $language_code ){
|
617 |
$dictionary = $this->db->get_results("SELECT id, original, translated, domain FROM `" . sanitize_text_field( $this->get_gettext_table_name( $language_code ) ) . "` WHERE translated <>'' AND status != " . self::NOT_TRANSLATED, ARRAY_A );
|
618 |
+
$this->maybe_record_automatic_translation_error(array( 'details' => 'Error running get_all_gettext_translated_strings()' ) );
|
619 |
return $dictionary;
|
620 |
}
|
621 |
|
679 |
|
680 |
|
681 |
$dictionary = $this->db->get_results( $query, $output );
|
682 |
+
$this->maybe_record_automatic_translation_error(array( 'details' => 'Error running get_string_rows()' ) );
|
683 |
return $dictionary;
|
684 |
}
|
685 |
|
698 |
|
699 |
$query .= "( " . implode ( ", ", $placeholders ) . " )";
|
700 |
$dictionary = $this->db->get_results( $this->db->prepare( $query, $values ), ARRAY_A );
|
701 |
+
$this->maybe_record_automatic_translation_error(array( 'details' => 'Error running get_gettext_string_rows_by_ids()' ) );
|
702 |
return $dictionary;
|
703 |
}
|
704 |
|
717 |
|
718 |
$query .= "( " . implode ( ", ", $placeholders ) . " )";
|
719 |
$dictionary = $this->db->get_results( $this->db->prepare( $query, $values ), ARRAY_A );
|
720 |
+
$this->maybe_record_automatic_translation_error(array( 'details' => 'Error running get_gettext_string_rows_by_original()' ) );
|
721 |
return $dictionary;
|
722 |
}
|
723 |
|
866 |
return $this->db->query( $sql );
|
867 |
}
|
868 |
|
869 |
+
public function maybe_record_automatic_translation_error($error_details = array(), $ignore_last_error = false ){
|
870 |
+
if ( !empty( $this->db->last_error) || $ignore_last_error ){
|
871 |
+
if( !$this->error_manager ){
|
872 |
+
$trp = TRP_Translate_Press::get_trp_instance();
|
873 |
+
$this->error_manager = $trp->get_component( 'error_manager' );
|
874 |
+
}
|
875 |
+
$default_error_details = array(
|
876 |
+
'last_error' => $this->db->last_error,
|
877 |
+
'disable_automatic_translations' => true
|
878 |
+
);
|
879 |
+
$error_details = array_merge( $default_error_details, $error_details );
|
880 |
+
$this->error_manager->record_error( $error_details );
|
881 |
+
}
|
882 |
+
}
|
883 |
+
|
884 |
+
/**
|
885 |
+
* Return true if table exists in db, return false otherwise
|
886 |
+
*
|
887 |
+
* @param $table_name
|
888 |
+
* @param $ignore_cache
|
889 |
+
* @return bool
|
890 |
+
*/
|
891 |
+
public function table_exists($table_name, $ignore_cache = false ){
|
892 |
+
if( !$ignore_cache && in_array( $table_name, $this->tables_exist ) ){
|
893 |
+
return true;
|
894 |
+
}
|
895 |
+
|
896 |
+
$table_name = sanitize_text_field($table_name);
|
897 |
+
$table_found = $this->db->get_var( "SHOW TABLES LIKE '$table_name'" ) == $table_name;
|
898 |
+
if ( $table_found ) {
|
899 |
+
$this->tables_exist[] = $table_name;
|
900 |
+
}
|
901 |
+
return $table_found;
|
902 |
+
}
|
903 |
+
|
904 |
}
|
includes/class-settings.php
CHANGED
@@ -292,35 +292,6 @@ class TRP_Settings{
|
|
292 |
'url-slugs' => array( 'en_US' => 'en', '' ),
|
293 |
);
|
294 |
|
295 |
-
|
296 |
-
|
297 |
-
/* BEGIN Upgrade settings from TP version 1.5.8 or earlier to 1.6.1+*/
|
298 |
-
$machine_translation_settings = get_option( 'trp_machine_translation_settings', false );
|
299 |
-
|
300 |
-
// move the old API key option
|
301 |
-
if( !empty( $settings_option['g-translate-key'] ) && empty( $machine_translation_settings['google-translate-key'] ) ){
|
302 |
-
$machine_translation_settings['google-translate-key'] = $settings_option['g-translate-key'];
|
303 |
-
|
304 |
-
update_option( 'trp_machine_translation_settings', $machine_translation_settings );
|
305 |
-
}
|
306 |
-
|
307 |
-
// enable machine translation if it was activated before
|
308 |
-
if( !empty( $settings_option['g-translate'] ) && $settings_option['g-translate'] == 'yes' && ( isset( $machine_translation_settings['machine-translation'] ) && $machine_translation_settings['machine-translation'] != 'yes' ) ){
|
309 |
-
$machine_translation_settings['machine-translation'] = 'yes';
|
310 |
-
|
311 |
-
update_option( 'trp_machine_translation_settings', $machine_translation_settings );
|
312 |
-
}
|
313 |
-
|
314 |
-
// set date if missing because of migration of machine translation settings from trp_settings option to trp_machine_translation_settings option
|
315 |
-
if ( !empty($machine_translation_settings) && empty( $machine_translation_settings['machine_translation_counter_date'] ) ){
|
316 |
-
$machine_translation_settings['machine_translation_counter_date'] = date ("Y-m-d" );
|
317 |
-
$machine_translation_settings['machine_translation_counter'] = 0;
|
318 |
-
update_option( 'trp_machine_translation_settings', $machine_translation_settings );
|
319 |
-
}
|
320 |
-
/* END Upgrade settings */
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
if ( 'not_set' == $settings_option ){
|
325 |
update_option ( 'trp_settings', $default_settings );
|
326 |
$settings_option = $default_settings;
|
@@ -333,14 +304,17 @@ class TRP_Settings{
|
|
333 |
}
|
334 |
}
|
335 |
|
336 |
-
|
|
|
|
|
|
|
|
|
337 |
$settings_option['trp_advanced_settings'] = get_option('trp_advanced_settings', array() );
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
) );
|
344 |
|
345 |
/* @deprecated Setting only used for compatibility with Deepl Add-on 1.0.0 */
|
346 |
if ( $settings_option['trp_machine_translation_settings']['translation-engine'] === 'deepl' && defined( 'TRP_DL_PLUGIN_VERSION' ) && TRP_DL_PLUGIN_VERSION === '1.0.0' ) {
|
@@ -354,6 +328,18 @@ class TRP_Settings{
|
|
354 |
$this->settings = $settings_option;
|
355 |
}
|
356 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
/**
|
358 |
* Enqueue scripts and styles for settings page.
|
359 |
*
|
292 |
'url-slugs' => array( 'en_US' => 'en', '' ),
|
293 |
);
|
294 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
295 |
if ( 'not_set' == $settings_option ){
|
296 |
update_option ( 'trp_settings', $default_settings );
|
297 |
$settings_option = $default_settings;
|
304 |
}
|
305 |
}
|
306 |
|
307 |
+
|
308 |
+
/**
|
309 |
+
* These options (trp_advanced_settings,trp_machine_translation_settings) are not part of the actual trp_settings DB option.
|
310 |
+
* But they are included in $settings variable across TP
|
311 |
+
*/
|
312 |
$settings_option['trp_advanced_settings'] = get_option('trp_advanced_settings', array() );
|
313 |
+
|
314 |
+
// Add any missing default option for trp_machine_translation_settings
|
315 |
+
$default_trp_machine_translation_settings = $this->get_default_trp_machine_translation_settings();
|
316 |
+
$settings_option['trp_machine_translation_settings'] = array_merge( $default_trp_machine_translation_settings, get_option( 'trp_machine_translation_settings', $default_trp_machine_translation_settings ) );
|
317 |
+
|
|
|
318 |
|
319 |
/* @deprecated Setting only used for compatibility with Deepl Add-on 1.0.0 */
|
320 |
if ( $settings_option['trp_machine_translation_settings']['translation-engine'] === 'deepl' && defined( 'TRP_DL_PLUGIN_VERSION' ) && TRP_DL_PLUGIN_VERSION === '1.0.0' ) {
|
328 |
$this->settings = $settings_option;
|
329 |
}
|
330 |
|
331 |
+
public function get_default_trp_machine_translation_settings(){
|
332 |
+
return apply_filters( 'trp_get_default_trp_machine_translation_settings', array(
|
333 |
+
// default settings for trp_machine_translation_settings
|
334 |
+
'machine-translation' => 'no',
|
335 |
+
'translation-engine' => 'google_translate_v2',
|
336 |
+
'block-crawlers' => 'yes',
|
337 |
+
'machine_translation_counter_date' => date ("Y-m-d" ),
|
338 |
+
'machine_translation_counter' => 0,
|
339 |
+
'machine_translation_limit' => 1000000
|
340 |
+
));
|
341 |
+
}
|
342 |
+
|
343 |
/**
|
344 |
* Enqueue scripts and styles for settings page.
|
345 |
*
|
includes/class-translation-render.php
CHANGED
@@ -854,6 +854,11 @@ class TRP_Translation_Render{
|
|
854 |
function remove_trp_html_tags( $string ){
|
855 |
$string = preg_replace( '/(<|<)trp-gettext (.*?)(>|>)/', '', $string );
|
856 |
$string = preg_replace( '/(<|<)(\\\\)*\/trp-gettext(>|>)/', '', $string );
|
|
|
|
|
|
|
|
|
|
|
857 |
if (!isset($_REQUEST['trp-edit-translation']) || $_REQUEST['trp-edit-translation'] != 'preview') {
|
858 |
$string = preg_replace('/(<|<)trp-wrap (.*?)(>|>)/', '', $string);
|
859 |
$string = preg_replace('/(<|<)(\\\\)*\/trp-wrap(>|>)/', '', $string);
|
854 |
function remove_trp_html_tags( $string ){
|
855 |
$string = preg_replace( '/(<|<)trp-gettext (.*?)(>|>)/', '', $string );
|
856 |
$string = preg_replace( '/(<|<)(\\\\)*\/trp-gettext(>|>)/', '', $string );
|
857 |
+
|
858 |
+
// In case we have a gettext string which was run through rawurlencode(). See more details on iss6563
|
859 |
+
$string = preg_replace( '/%23%21trpst%23trp-gettext(.*?)%23%21trpen%23/', '', $string );
|
860 |
+
$string = preg_replace( '/%23%21trpst%23%2Ftrp-gettext%23%21trpen%23/', '', $string );
|
861 |
+
|
862 |
if (!isset($_REQUEST['trp-edit-translation']) || $_REQUEST['trp-edit-translation'] != 'preview') {
|
863 |
$string = preg_replace('/(<|<)trp-wrap (.*?)(>|>)/', '', $string);
|
864 |
$string = preg_replace('/(<|<)(\\\\)*\/trp-wrap(>|>)/', '', $string);
|
includes/class-upgrade.php
CHANGED
@@ -41,21 +41,29 @@ class TRP_Upgrade {
|
|
41 |
$this->trp_query = $trp->get_component( 'query' );
|
42 |
}
|
43 |
$stored_database_version = get_option('trp_plugin_version');
|
44 |
-
if( empty($stored_database_version)
|
45 |
$this->check_if_gettext_tables_exist();
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
}
|
60 |
|
61 |
// don't update the db version unless they are different. Otherwise the query is run on every page load.
|
@@ -462,4 +470,36 @@ class TRP_Upgrade {
|
|
462 |
$this->db->query( $sql_index );
|
463 |
}
|
464 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
465 |
}
|
41 |
$this->trp_query = $trp->get_component( 'query' );
|
42 |
}
|
43 |
$stored_database_version = get_option('trp_plugin_version');
|
44 |
+
if( empty($stored_database_version) ){
|
45 |
$this->check_if_gettext_tables_exist();
|
46 |
+
}else{
|
47 |
+
|
48 |
+
// Updates that require admins to trigger manual update of db because of long duration. Set an option in DB if this is the case.
|
49 |
+
$updates = $this->get_updates_details();
|
50 |
+
foreach ($updates as $update) {
|
51 |
+
if (version_compare($update['version'], $stored_database_version, '>')) {
|
52 |
+
update_option($update['option_name'], 'no');
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
// Updates that can be done right way. They should take very little time.
|
57 |
+
if ( version_compare( $stored_database_version, '1.3.0', '<=' ) ) {
|
58 |
+
$this->trp_query->check_for_block_type_column();
|
59 |
+
$this->check_if_gettext_tables_exist();
|
60 |
+
}
|
61 |
+
if ( version_compare($stored_database_version, '1.5.3', '<=')) {
|
62 |
+
$this->add_full_text_index_to_tables();
|
63 |
+
}
|
64 |
+
if ( version_compare($stored_database_version, '1.6.1', '<=')) {
|
65 |
+
$this->upgrade_machine_translation_settings();
|
66 |
+
}
|
67 |
}
|
68 |
|
69 |
// don't update the db version unless they are different. Otherwise the query is run on every page load.
|
470 |
$this->db->query( $sql_index );
|
471 |
}
|
472 |
}
|
473 |
+
|
474 |
+
/**
|
475 |
+
* Moving some settings from trp_settings option to trp_machine_translation_settings
|
476 |
+
*
|
477 |
+
* Upgrade settings from TP version 1.5.8 or earlier to 1.6.2
|
478 |
+
*/
|
479 |
+
private function upgrade_machine_translation_settings(){
|
480 |
+
$trp = TRP_Translate_Press::get_trp_instance();
|
481 |
+
$trp_settings = $trp->get_component('settings' );
|
482 |
+
$machine_translation_settings = get_option( 'trp_machine_translation_settings', false );
|
483 |
+
|
484 |
+
$default_machine_translation_settings = $trp_settings->get_default_trp_machine_translation_settings();
|
485 |
+
|
486 |
+
if ( $machine_translation_settings == false ) {
|
487 |
+
// 1.5.8 did not have any machine_settings so port g-translate-key and g-translate settings if exists
|
488 |
+
$machine_translation_settings = $default_machine_translation_settings;
|
489 |
+
// move the old API key option
|
490 |
+
if (!empty($this->settings['g-translate-key'] ) ) {
|
491 |
+
$machine_translation_settings['google-translate-key'] = $this->settings['g-translate-key'];
|
492 |
+
}
|
493 |
+
|
494 |
+
// enable machine translation if it was activated before
|
495 |
+
if (!empty($this->settings['g-translate']) && $this->settings['g-translate'] == 'yes'){
|
496 |
+
$machine_translation_settings['machine-translation'] = 'yes';
|
497 |
+
}
|
498 |
+
update_option('trp_machine_translation_settings', $machine_translation_settings);
|
499 |
+
}else{
|
500 |
+
// targeting 1.5.9 to 1.6.1 where incomplete machine-translation settings may have resulted
|
501 |
+
$machine_translation_settings = array_merge( $default_machine_translation_settings, $machine_translation_settings );
|
502 |
+
update_option('trp_machine_translation_settings', $machine_translation_settings);
|
503 |
+
}
|
504 |
+
}
|
505 |
}
|
includes/compatibility-functions.php
CHANGED
@@ -363,22 +363,34 @@ function trp_strip_request_metadata_keys( $metadata ){
|
|
363 |
* They start an output buffer at init -1 (before ours at init 0). They print footer scripts after we run translate_page,
|
364 |
* resulting in outputting scripts that won't be stripped of trpst trp-gettext wrappings.
|
365 |
* This includes WooCommerce Checkout scripts, resulting in trpst wrappings around form fields like Street Address.
|
|
|
366 |
*
|
367 |
-
*
|
|
|
368 |
*
|
369 |
-
*
|
370 |
-
* it needs to be after plugins_loaded (because TP is loading this file later)
|
371 |
-
* and before init (because the we need to unregister the NextGen Gallery plugin's function hooked on init with priority -1 )
|
372 |
*/
|
373 |
-
|
374 |
-
function trp_nextgen_compatibility(){
|
375 |
if ( class_exists( 'C_Photocrati_Resource_Manager' ) ) {
|
376 |
-
|
|
|
|
|
|
|
377 |
|
378 |
-
|
379 |
-
|
380 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
381 |
}
|
|
|
382 |
}
|
383 |
|
384 |
/**
|
363 |
* They start an output buffer at init -1 (before ours at init 0). They print footer scripts after we run translate_page,
|
364 |
* resulting in outputting scripts that won't be stripped of trpst trp-gettext wrappings.
|
365 |
* This includes WooCommerce Checkout scripts, resulting in trpst wrappings around form fields like Street Address.
|
366 |
+
* Another issue is that translation editor is a blank page.
|
367 |
*
|
368 |
+
* We cannot move their hook to priority 1 because we do not have access to the object that gets hooked is not retrievable so we can't call remove_filter()
|
369 |
+
* Also we cannot simply disable ngg using run_ngg_resource_manager hook because we would be disabling features of their plugin.
|
370 |
*
|
371 |
+
* So the only solution that works is to move our hook to -2.
|
|
|
|
|
372 |
*/
|
373 |
+
add_filter( 'trp_start_output_buffer_priority', 'trp_nextgen_compatibility' );
|
374 |
+
function trp_nextgen_compatibility( $priority ){
|
375 |
if ( class_exists( 'C_Photocrati_Resource_Manager' ) ) {
|
376 |
+
return '-2';
|
377 |
+
}
|
378 |
+
return $priority;
|
379 |
+
}
|
380 |
|
381 |
+
/**
|
382 |
+
* Compatibility with NextGEN Gallery
|
383 |
+
*
|
384 |
+
* This plugin is adding wp_footer forcefully in a shutdown hook and appends it to "</body>" which bring up admin bar in translation editor.
|
385 |
+
*
|
386 |
+
* This filter prevents ngg from hooking the filters to alter the html.
|
387 |
+
*/
|
388 |
+
add_filter( 'run_ngg_resource_manager', 'trp_nextgen_disable_nextgen_in_translation_editor');
|
389 |
+
function trp_nextgen_disable_nextgen_in_translation_editor( $bool ){
|
390 |
+
if ( isset( $_REQUEST['trp-edit-translation'] ) && esc_attr( $_REQUEST['trp-edit-translation'] ) === 'true' ) {
|
391 |
+
return false;
|
392 |
}
|
393 |
+
return $bool;
|
394 |
}
|
395 |
|
396 |
/**
|
includes/google-translate/class-google-translate-v2-machine-translator.php
CHANGED
@@ -104,10 +104,14 @@ class TRP_Google_Translate_V2_Machine_Translator extends TRP_Machine_Translator
|
|
104 |
* Send a test request to verify if the functionality is working
|
105 |
*/
|
106 |
public function test_request(){
|
|
|
107 |
return $this->send_request( 'en', 'es', array( 'about' ) );
|
|
|
108 |
}
|
109 |
|
110 |
public function get_api_key(){
|
111 |
-
|
|
|
|
|
112 |
}
|
113 |
}
|
104 |
* Send a test request to verify if the functionality is working
|
105 |
*/
|
106 |
public function test_request(){
|
107 |
+
|
108 |
return $this->send_request( 'en', 'es', array( 'about' ) );
|
109 |
+
|
110 |
}
|
111 |
|
112 |
public function get_api_key(){
|
113 |
+
|
114 |
+
return isset( $this->settings['trp_machine_translation_settings'], $this->settings['trp_machine_translation_settings']['google-translate-key'] ) ? $this->settings['trp_machine_translation_settings']['google-translate-key'] : false;
|
115 |
+
|
116 |
}
|
117 |
}
|
index.php
CHANGED
@@ -3,14 +3,14 @@
|
|
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
|
10 |
Domain Path: /languages
|
11 |
License: GPL2
|
12 |
WC requires at least: 2.5.0
|
13 |
-
WC tested up to: 3.
|
14 |
|
15 |
== Copyright ==
|
16 |
Copyright 2017 Cozmoslabs (www.cozmoslabs.com)
|
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.2
|
7 |
Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
|
8 |
Author URI: https://cozmoslabs.com/
|
9 |
Text Domain: translatepress-multilingual
|
10 |
Domain Path: /languages
|
11 |
License: GPL2
|
12 |
WC requires at least: 2.5.0
|
13 |
+
WC tested up to: 3.8
|
14 |
|
15 |
== Copyright ==
|
16 |
Copyright 2017 Cozmoslabs (www.cozmoslabs.com)
|
languages/translatepress-multilingual.catalog.php
CHANGED
@@ -38,10 +38,12 @@
|
|
38 |
<?php __("Your license key has reached its activation limit.", "translatepress-multilingual"); ?>
|
39 |
<?php __("You have successfully activated your license", "translatepress-multilingual"); ?>
|
40 |
<?php __("Others", "translatepress-multilingual"); ?>
|
|
|
|
|
|
|
41 |
<?php __("Automatic Translation", "translatepress-multilingual"); ?>
|
42 |
<?php __("DeepL", "translatepress-multilingual"); ?>
|
43 |
<?php __("You are not using a permalink structure! Please <a href=\"%s\">enable</a> one or install our <a href=\"%s\">\"Language by GET parameter\"</a> addon, so that TranslatePress can function properly.", "translatepress-multilingual"); ?>
|
44 |
-
<?php __("Dismiss this notice.", "translatepress-multilingual"); ?>
|
45 |
<?php __("Your <strong>TranslatePress</strong> serial number is invalid or missing. <br/>Please %1$sregister your copy%2$s to receive access to automatic updates and support. Need a license key? %3$sPurchase one now%4$s", "translatepress-multilingual"); ?>
|
46 |
<?php __("Your <strong>TranslatePress</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s", "translatepress-multilingual"); ?>
|
47 |
<?php __("Something went wrong, please try again.", "translatepress-multilingual"); ?>
|
@@ -170,13 +172,15 @@
|
|
170 |
<?php __("Use GET parameter to encode language in the url, replacing the language directory. </br> Your urls will look like this: www.example.com?lang=en", "translatepress-multilingual"); ?>
|
171 |
<?php __("TranslatePress Advanced Settings", "translatepress-multilingual"); ?>
|
172 |
<?php __("Save Changes", "translatepress-multilingual"); ?>
|
|
|
|
|
173 |
<?php __("Active on this site", "translatepress-multilingual"); ?>
|
174 |
<?php __("Your license is invalid", "translatepress-multilingual"); ?>
|
175 |
-
<?php __("If you
|
176 |
<?php __("TranslatePress Automatic Translation", "translatepress-multilingual"); ?>
|
177 |
<?php __("Enable Automatic Translation", "translatepress-multilingual"); ?>
|
178 |
<?php __("No", "translatepress-multilingual"); ?>
|
179 |
-
<?php __("Enable or disable the automatic translation of the site.
|
180 |
<?php __("Translation Engine", "translatepress-multilingual"); ?>
|
181 |
<?php __("Choose which engine you want to use in order to automatically translate your website.", "translatepress-multilingual"); ?>
|
182 |
<?php __("<strong>DeepL</strong> automatic translation is available as a premium add-on in <a href=\"%s\" class=\"button button-primary\" target=\"_blank\" title=\"TranslatePress Pro\">TranslatePress PRO</a>", "translatepress-multilingual"); ?>
|
38 |
<?php __("Your license key has reached its activation limit.", "translatepress-multilingual"); ?>
|
39 |
<?php __("You have successfully activated your license", "translatepress-multilingual"); ?>
|
40 |
<?php __("Others", "translatepress-multilingual"); ?>
|
41 |
+
<?php __("<strong>TranslatePress</strong> encountered SQL errors. <a href=\"%s\" title=\"View TranslatePress SQL Errors\">Check out the errors</a>.", "translatepress-multilingual"); ?>
|
42 |
+
<?php __("Automatic translation has been disabled.", "translatepress-multilingual"); ?>
|
43 |
+
<?php __("Dismiss this notice.", "translatepress-multilingual"); ?>
|
44 |
<?php __("Automatic Translation", "translatepress-multilingual"); ?>
|
45 |
<?php __("DeepL", "translatepress-multilingual"); ?>
|
46 |
<?php __("You are not using a permalink structure! Please <a href=\"%s\">enable</a> one or install our <a href=\"%s\">\"Language by GET parameter\"</a> addon, so that TranslatePress can function properly.", "translatepress-multilingual"); ?>
|
|
|
47 |
<?php __("Your <strong>TranslatePress</strong> serial number is invalid or missing. <br/>Please %1$sregister your copy%2$s to receive access to automatic updates and support. Need a license key? %3$sPurchase one now%4$s", "translatepress-multilingual"); ?>
|
48 |
<?php __("Your <strong>TranslatePress</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s", "translatepress-multilingual"); ?>
|
49 |
<?php __("Something went wrong, please try again.", "translatepress-multilingual"); ?>
|
172 |
<?php __("Use GET parameter to encode language in the url, replacing the language directory. </br> Your urls will look like this: www.example.com?lang=en", "translatepress-multilingual"); ?>
|
173 |
<?php __("TranslatePress Advanced Settings", "translatepress-multilingual"); ?>
|
174 |
<?php __("Save Changes", "translatepress-multilingual"); ?>
|
175 |
+
<?php __("TranslatePress Errors", "translatepress-multilingual"); ?>
|
176 |
+
<?php __("There are no logged errors.", "translatepress-multilingual"); ?>
|
177 |
<?php __("Active on this site", "translatepress-multilingual"); ?>
|
178 |
<?php __("Your license is invalid", "translatepress-multilingual"); ?>
|
179 |
+
<?php __("If you purchased a premium version, first install and activate any of the <a href=\"%s\">Advanced or Pro Addons</a>. After this you will be prompted with an input to enter your license key.", "translatepress-multilingual"); ?>
|
180 |
<?php __("TranslatePress Automatic Translation", "translatepress-multilingual"); ?>
|
181 |
<?php __("Enable Automatic Translation", "translatepress-multilingual"); ?>
|
182 |
<?php __("No", "translatepress-multilingual"); ?>
|
183 |
+
<?php __("Enable or disable the automatic translation of the site. To minimize translation costs, each untranslated string is automatically translated only once, then stored in the database.", "translatepress-multilingual"); ?>
|
184 |
<?php __("Translation Engine", "translatepress-multilingual"); ?>
|
185 |
<?php __("Choose which engine you want to use in order to automatically translate your website.", "translatepress-multilingual"); ?>
|
186 |
<?php __("<strong>DeepL</strong> automatic translation is available as a premium add-on in <a href=\"%s\" class=\"button button-primary\" target=\"_blank\" title=\"TranslatePress Pro\">TranslatePress PRO</a>", "translatepress-multilingual"); ?>
|
languages/translatepress-multilingual.pot
CHANGED
@@ -13,7 +13,7 @@ msgstr ""
|
|
13 |
"X-Poedit-SourceCharset: UTF-8\n"
|
14 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
15 |
|
16 |
-
#: ../tp-add-on-extra-languages/class-extra-languages.php:57, ../translatepress/includes/class-settings.php:
|
17 |
msgid "Error! Duplicate URL slug values."
|
18 |
msgstr ""
|
19 |
|
@@ -169,43 +169,51 @@ msgstr ""
|
|
169 |
msgid "Others"
|
170 |
msgstr ""
|
171 |
|
172 |
-
#: ../translatepress/includes/class-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
msgid "Automatic Translation"
|
174 |
msgstr ""
|
175 |
|
176 |
-
#: ../translatepress/includes/class-machine-translation-tab.php:
|
177 |
msgid "DeepL"
|
178 |
msgstr ""
|
179 |
|
180 |
-
#: ../translatepress/includes/class-plugin-notices.php:
|
181 |
msgid "You are not using a permalink structure! Please <a href=\"%s\">enable</a> one or install our <a href=\"%s\">\"Language by GET parameter\"</a> addon, so that TranslatePress can function properly."
|
182 |
msgstr ""
|
183 |
|
184 |
-
#: ../translatepress/includes/class-plugin-notices.php:
|
185 |
-
msgid "Dismiss this notice."
|
186 |
-
msgstr ""
|
187 |
-
|
188 |
-
#: ../translatepress/includes/class-plugin-notices.php:353
|
189 |
msgid "Your <strong>TranslatePress</strong> serial number is invalid or missing. <br/>Please %1$sregister your copy%2$s to receive access to automatic updates and support. Need a license key? %3$sPurchase one now%4$s"
|
190 |
msgstr ""
|
191 |
|
192 |
-
#: ../translatepress/includes/class-plugin-notices.php:
|
193 |
msgid "Your <strong>TranslatePress</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s"
|
194 |
msgstr ""
|
195 |
|
196 |
-
#: ../translatepress/includes/class-plugin-notices.php:
|
197 |
msgid "Something went wrong, please try again."
|
198 |
msgstr ""
|
199 |
|
200 |
-
#: ../translatepress/includes/class-plugin-notices.php:
|
201 |
msgid "Your <strong>TranslatePress</strong> license will expire on %1$s. Please %2$sRenew Your Licence%3$s to continue receiving access to product downloads, automatic updates and support."
|
202 |
msgstr ""
|
203 |
|
204 |
-
#: ../translatepress/includes/class-plugin-notices.php:
|
205 |
msgid "NEW: Display different images based on language. Find out <a href=\"https://translatepress.com/docs/image-translation/\" >how to translate images, sliders and more</a> from the TranslatePress editor."
|
206 |
msgstr ""
|
207 |
|
208 |
-
#: ../translatepress/includes/class-plugin-notices.php:
|
209 |
msgid "The daily quota for machine translation characters exceeded. Please check the <strong>TranslatePress -> <a href=\"%s\">Automatic Translation</a></strong> page for more information."
|
210 |
msgstr ""
|
211 |
|
@@ -245,31 +253,31 @@ msgstr ""
|
|
245 |
msgid "Top Left"
|
246 |
msgstr ""
|
247 |
|
248 |
-
#: ../translatepress/includes/class-settings.php:
|
249 |
msgid "Current Language"
|
250 |
msgstr ""
|
251 |
|
252 |
-
#: ../translatepress/includes/class-settings.php:
|
253 |
msgid "General"
|
254 |
msgstr ""
|
255 |
|
256 |
-
#: ../translatepress/includes/class-settings.php:
|
257 |
msgid "Translate Site"
|
258 |
msgstr ""
|
259 |
|
260 |
-
#: ../translatepress/includes/class-settings.php:
|
261 |
msgid "Addons"
|
262 |
msgstr ""
|
263 |
|
264 |
-
#: ../translatepress/includes/class-settings.php:
|
265 |
msgid "License"
|
266 |
msgstr ""
|
267 |
|
268 |
-
#: ../translatepress/includes/class-settings.php:
|
269 |
msgid "Settings"
|
270 |
msgstr ""
|
271 |
|
272 |
-
#: ../translatepress/includes/class-settings.php:
|
273 |
msgid "Pro Features"
|
274 |
msgstr ""
|
275 |
|
@@ -553,79 +561,79 @@ msgstr ""
|
|
553 |
msgid "Page Title"
|
554 |
msgstr ""
|
555 |
|
556 |
-
#: ../translatepress/includes/class-upgrade.php:
|
557 |
msgid "TranslatePress data update"
|
558 |
msgstr ""
|
559 |
|
560 |
-
#: ../translatepress/includes/class-upgrade.php:
|
561 |
msgid "We need to update your translations database to the latest version."
|
562 |
msgstr ""
|
563 |
|
564 |
-
#: ../translatepress/includes/class-upgrade.php:
|
565 |
msgid "IMPORTANT: It is strongly recommended to first backup the database!\nAre you sure you want to continue?"
|
566 |
msgstr ""
|
567 |
|
568 |
-
#: ../translatepress/includes/class-upgrade.php:
|
569 |
msgid "Run the updater"
|
570 |
msgstr ""
|
571 |
|
572 |
-
#: ../translatepress/includes/class-upgrade.php:
|
573 |
msgid "Update aborted! Your user account doesn't have the capability to perform database updates."
|
574 |
msgstr ""
|
575 |
|
576 |
-
#: ../translatepress/includes/class-upgrade.php:
|
577 |
msgid "Update aborted! Invalid nonce."
|
578 |
msgstr ""
|
579 |
|
580 |
-
#: ../translatepress/includes/class-upgrade.php:
|
581 |
msgid "Back to TranslatePress Settings"
|
582 |
msgstr ""
|
583 |
|
584 |
-
#: ../translatepress/includes/class-upgrade.php:
|
585 |
msgid "Successfully updated database!"
|
586 |
msgstr ""
|
587 |
|
588 |
-
#: ../translatepress/includes/class-upgrade.php:
|
589 |
msgid "Updating database to version %s+"
|
590 |
msgstr ""
|
591 |
|
592 |
-
#: ../translatepress/includes/class-upgrade.php:
|
593 |
msgid "Processing table for language %s..."
|
594 |
msgstr ""
|
595 |
|
596 |
-
#: ../translatepress/includes/class-upgrade.php:
|
597 |
msgid "Update aborted! Incorrect action."
|
598 |
msgstr ""
|
599 |
|
600 |
-
#: ../translatepress/includes/class-upgrade.php:
|
601 |
msgid "Update aborted! Incorrect language code."
|
602 |
msgstr ""
|
603 |
|
604 |
-
#: ../translatepress/includes/class-upgrade.php:
|
605 |
msgid " done."
|
606 |
msgstr ""
|
607 |
|
608 |
-
#: ../translatepress/includes/class-upgrade.php:
|
609 |
msgid "Done."
|
610 |
msgstr ""
|
611 |
|
612 |
-
#: ../translatepress/includes/class-upgrade.php:
|
613 |
msgid "Invalid nonce."
|
614 |
msgstr ""
|
615 |
|
616 |
-
#: ../translatepress/includes/class-upgrade.php:
|
617 |
msgid "Querying table <strong>%s</strong>"
|
618 |
msgstr ""
|
619 |
|
620 |
-
#: ../translatepress/includes/class-upgrade.php:
|
621 |
msgid "%s duplicates removed"
|
622 |
msgstr ""
|
623 |
|
624 |
-
#: ../translatepress/includes/class-upgrade.php:
|
625 |
msgid "If the page does not redirect automatically"
|
626 |
msgstr ""
|
627 |
|
628 |
-
#: ../translatepress/includes/class-upgrade.php:
|
629 |
msgid "click here"
|
630 |
msgstr ""
|
631 |
|
@@ -697,6 +705,14 @@ msgstr ""
|
|
697 |
msgid "Save Changes"
|
698 |
msgstr ""
|
699 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
700 |
#: ../translatepress/partials/license-settings-page.php:25
|
701 |
msgid "Active on this site"
|
702 |
msgstr ""
|
@@ -706,7 +722,7 @@ msgid "Your license is invalid"
|
|
706 |
msgstr ""
|
707 |
|
708 |
#: ../translatepress/partials/license-settings-page.php:48
|
709 |
-
msgid "If you
|
710 |
msgstr ""
|
711 |
|
712 |
#: ../translatepress/partials/machine-translation-settings-page.php:4
|
@@ -722,7 +738,7 @@ msgid "No"
|
|
722 |
msgstr ""
|
723 |
|
724 |
#: ../translatepress/partials/machine-translation-settings-page.php:17
|
725 |
-
msgid "Enable or disable the automatic translation of the site.
|
726 |
msgstr ""
|
727 |
|
728 |
#: ../translatepress/partials/machine-translation-settings-page.php:23
|
13 |
"X-Poedit-SourceCharset: UTF-8\n"
|
14 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
15 |
|
16 |
+
#: ../tp-add-on-extra-languages/class-extra-languages.php:57, ../translatepress/includes/class-settings.php:369
|
17 |
msgid "Error! Duplicate URL slug values."
|
18 |
msgstr ""
|
19 |
|
169 |
msgid "Others"
|
170 |
msgstr ""
|
171 |
|
172 |
+
#: ../translatepress/includes/class-error-manager.php:42
|
173 |
+
msgid "<strong>TranslatePress</strong> encountered SQL errors. <a href=\"%s\" title=\"View TranslatePress SQL Errors\">Check out the errors</a>."
|
174 |
+
msgstr ""
|
175 |
+
|
176 |
+
#: ../translatepress/includes/class-error-manager.php:51
|
177 |
+
msgid "Automatic translation has been disabled."
|
178 |
+
msgstr ""
|
179 |
+
|
180 |
+
#: ../translatepress/includes/class-error-manager.php:118, ../translatepress/includes/class-plugin-notices.php:340, ../translatepress/includes/class-plugin-notices.php:371, ../translatepress/includes/class-plugin-notices.php:390, ../translatepress/includes/class-plugin-notices.php:404, ../translatepress/includes/class-plugin-notices.php:429
|
181 |
+
msgid "Dismiss this notice."
|
182 |
+
msgstr ""
|
183 |
+
|
184 |
+
#: ../translatepress/includes/class-machine-translation-tab.php:22
|
185 |
msgid "Automatic Translation"
|
186 |
msgstr ""
|
187 |
|
188 |
+
#: ../translatepress/includes/class-machine-translation-tab.php:119
|
189 |
msgid "DeepL"
|
190 |
msgstr ""
|
191 |
|
192 |
+
#: ../translatepress/includes/class-plugin-notices.php:338
|
193 |
msgid "You are not using a permalink structure! Please <a href=\"%s\">enable</a> one or install our <a href=\"%s\">\"Language by GET parameter\"</a> addon, so that TranslatePress can function properly."
|
194 |
msgstr ""
|
195 |
|
196 |
+
#: ../translatepress/includes/class-plugin-notices.php:361
|
|
|
|
|
|
|
|
|
197 |
msgid "Your <strong>TranslatePress</strong> serial number is invalid or missing. <br/>Please %1$sregister your copy%2$s to receive access to automatic updates and support. Need a license key? %3$sPurchase one now%4$s"
|
198 |
msgstr ""
|
199 |
|
200 |
+
#: ../translatepress/includes/class-plugin-notices.php:363
|
201 |
msgid "Your <strong>TranslatePress</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s"
|
202 |
msgstr ""
|
203 |
|
204 |
+
#: ../translatepress/includes/class-plugin-notices.php:365
|
205 |
msgid "Something went wrong, please try again."
|
206 |
msgstr ""
|
207 |
|
208 |
+
#: ../translatepress/includes/class-plugin-notices.php:386
|
209 |
msgid "Your <strong>TranslatePress</strong> license will expire on %1$s. Please %2$sRenew Your Licence%3$s to continue receiving access to product downloads, automatic updates and support."
|
210 |
msgstr ""
|
211 |
|
212 |
+
#: ../translatepress/includes/class-plugin-notices.php:402
|
213 |
msgid "NEW: Display different images based on language. Find out <a href=\"https://translatepress.com/docs/image-translation/\" >how to translate images, sliders and more</a> from the TranslatePress editor."
|
214 |
msgstr ""
|
215 |
|
216 |
+
#: ../translatepress/includes/class-plugin-notices.php:426
|
217 |
msgid "The daily quota for machine translation characters exceeded. Please check the <strong>TranslatePress -> <a href=\"%s\">Automatic Translation</a></strong> page for more information."
|
218 |
msgstr ""
|
219 |
|
253 |
msgid "Top Left"
|
254 |
msgstr ""
|
255 |
|
256 |
+
#: ../translatepress/includes/class-settings.php:405
|
257 |
msgid "Current Language"
|
258 |
msgstr ""
|
259 |
|
260 |
+
#: ../translatepress/includes/class-settings.php:446
|
261 |
msgid "General"
|
262 |
msgstr ""
|
263 |
|
264 |
+
#: ../translatepress/includes/class-settings.php:451, ../translatepress/includes/class-translation-manager.php:244
|
265 |
msgid "Translate Site"
|
266 |
msgstr ""
|
267 |
|
268 |
+
#: ../translatepress/includes/class-settings.php:456
|
269 |
msgid "Addons"
|
270 |
msgstr ""
|
271 |
|
272 |
+
#: ../translatepress/includes/class-settings.php:464
|
273 |
msgid "License"
|
274 |
msgstr ""
|
275 |
|
276 |
+
#: ../translatepress/includes/class-settings.php:492, ../translatepress/includes/class-translation-manager.php:276
|
277 |
msgid "Settings"
|
278 |
msgstr ""
|
279 |
|
280 |
+
#: ../translatepress/includes/class-settings.php:496
|
281 |
msgid "Pro Features"
|
282 |
msgstr ""
|
283 |
|
561 |
msgid "Page Title"
|
562 |
msgstr ""
|
563 |
|
564 |
+
#: ../translatepress/includes/class-upgrade.php:137
|
565 |
msgid "TranslatePress data update"
|
566 |
msgstr ""
|
567 |
|
568 |
+
#: ../translatepress/includes/class-upgrade.php:137
|
569 |
msgid "We need to update your translations database to the latest version."
|
570 |
msgstr ""
|
571 |
|
572 |
+
#: ../translatepress/includes/class-upgrade.php:138
|
573 |
msgid "IMPORTANT: It is strongly recommended to first backup the database!\nAre you sure you want to continue?"
|
574 |
msgstr ""
|
575 |
|
576 |
+
#: ../translatepress/includes/class-upgrade.php:138
|
577 |
msgid "Run the updater"
|
578 |
msgstr ""
|
579 |
|
580 |
+
#: ../translatepress/includes/class-upgrade.php:154
|
581 |
msgid "Update aborted! Your user account doesn't have the capability to perform database updates."
|
582 |
msgstr ""
|
583 |
|
584 |
+
#: ../translatepress/includes/class-upgrade.php:159
|
585 |
msgid "Update aborted! Invalid nonce."
|
586 |
msgstr ""
|
587 |
|
588 |
+
#: ../translatepress/includes/class-upgrade.php:174, ../translatepress/includes/class-upgrade.php:267, ../translatepress/includes/class-upgrade.php:353, ../translatepress/includes/class-upgrade.php:358
|
589 |
msgid "Back to TranslatePress Settings"
|
590 |
msgstr ""
|
591 |
|
592 |
+
#: ../translatepress/includes/class-upgrade.php:178
|
593 |
msgid "Successfully updated database!"
|
594 |
msgstr ""
|
595 |
|
596 |
+
#: ../translatepress/includes/class-upgrade.php:184
|
597 |
msgid "Updating database to version %s+"
|
598 |
msgstr ""
|
599 |
|
600 |
+
#: ../translatepress/includes/class-upgrade.php:185, ../translatepress/includes/class-upgrade.php:240
|
601 |
msgid "Processing table for language %s..."
|
602 |
msgstr ""
|
603 |
|
604 |
+
#: ../translatepress/includes/class-upgrade.php:189
|
605 |
msgid "Update aborted! Incorrect action."
|
606 |
msgstr ""
|
607 |
|
608 |
+
#: ../translatepress/includes/class-upgrade.php:192
|
609 |
msgid "Update aborted! Incorrect language code."
|
610 |
msgstr ""
|
611 |
|
612 |
+
#: ../translatepress/includes/class-upgrade.php:239, ../translatepress/includes/class-upgrade.php:243
|
613 |
msgid " done."
|
614 |
msgstr ""
|
615 |
|
616 |
+
#: ../translatepress/includes/class-upgrade.php:353
|
617 |
msgid "Done."
|
618 |
msgstr ""
|
619 |
|
620 |
+
#: ../translatepress/includes/class-upgrade.php:358
|
621 |
msgid "Invalid nonce."
|
622 |
msgstr ""
|
623 |
|
624 |
+
#: ../translatepress/includes/class-upgrade.php:378
|
625 |
msgid "Querying table <strong>%s</strong>"
|
626 |
msgstr ""
|
627 |
|
628 |
+
#: ../translatepress/includes/class-upgrade.php:408
|
629 |
msgid "%s duplicates removed"
|
630 |
msgstr ""
|
631 |
|
632 |
+
#: ../translatepress/includes/class-upgrade.php:438
|
633 |
msgid "If the page does not redirect automatically"
|
634 |
msgstr ""
|
635 |
|
636 |
+
#: ../translatepress/includes/class-upgrade.php:438
|
637 |
msgid "click here"
|
638 |
msgstr ""
|
639 |
|
705 |
msgid "Save Changes"
|
706 |
msgstr ""
|
707 |
|
708 |
+
#: ../translatepress/partials/error-manager-page.php:3
|
709 |
+
msgid "TranslatePress Errors"
|
710 |
+
msgstr ""
|
711 |
+
|
712 |
+
#: ../translatepress/partials/error-manager-page.php:6
|
713 |
+
msgid "There are no logged errors."
|
714 |
+
msgstr ""
|
715 |
+
|
716 |
#: ../translatepress/partials/license-settings-page.php:25
|
717 |
msgid "Active on this site"
|
718 |
msgstr ""
|
722 |
msgstr ""
|
723 |
|
724 |
#: ../translatepress/partials/license-settings-page.php:48
|
725 |
+
msgid "If you purchased a premium version, first install and activate any of the <a href=\"%s\">Advanced or Pro Addons</a>. After this you will be prompted with an input to enter your license key."
|
726 |
msgstr ""
|
727 |
|
728 |
#: ../translatepress/partials/machine-translation-settings-page.php:4
|
738 |
msgstr ""
|
739 |
|
740 |
#: ../translatepress/partials/machine-translation-settings-page.php:17
|
741 |
+
msgid "Enable or disable the automatic translation of the site. To minimize translation costs, each untranslated string is automatically translated only once, then stored in the database."
|
742 |
msgstr ""
|
743 |
|
744 |
#: ../translatepress/partials/machine-translation-settings-page.php:23
|
partials/error-manager-page.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="trp-errors-page" class="wrap">
|
2 |
+
|
3 |
+
<h1> <?php esc_html_e( 'TranslatePress Errors', 'translatepress-multilingual' );?></h1>
|
4 |
+
<?php $page_output = apply_filters( 'trp_error_manager_page_output', '' );
|
5 |
+
if ( $page_output === '' ){
|
6 |
+
$page_output = esc_html__('There are no logged errors.', 'translatepress-multilingual');
|
7 |
+
}
|
8 |
+
echo $page_output;
|
9 |
+
|
10 |
+
?>
|
11 |
+
|
12 |
+
</div>
|
partials/license-settings-page.php
CHANGED
@@ -45,5 +45,5 @@ if( !empty( $trp->active_pro_addons ) ){//if we have any Advanced or Pro addons
|
|
45 |
<?php } else{ ?>
|
46 |
<h1> <?php _e( 'TranslatePress Settings', 'translatepress-multilingual' );?></h1>
|
47 |
<?php do_action ( 'trp_settings_navigation_tabs' ); ?>
|
48 |
-
<h4><?php printf( __( 'If you
|
49 |
<?php } ?>
|
45 |
<?php } else{ ?>
|
46 |
<h1> <?php _e( 'TranslatePress Settings', 'translatepress-multilingual' );?></h1>
|
47 |
<?php do_action ( 'trp_settings_navigation_tabs' ); ?>
|
48 |
+
<h4><?php printf( __( 'If you purchased a premium version, first install and activate any of the <a href="%s">Advanced or Pro Addons</a>. After this you will be prompted with an input to enter your license key.', 'translatepress-multilingual' ), admin_url('/admin.php?page=trp_addons_page') ); ?></h4>
|
49 |
<?php } ?>
|
partials/machine-translation-settings-page.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
</select>
|
15 |
|
16 |
<p class="description">
|
17 |
-
<?php _e( 'Enable or disable the automatic translation of the site.
|
18 |
</p>
|
19 |
</td>
|
20 |
</tr>
|
14 |
</select>
|
15 |
|
16 |
<p class="description">
|
17 |
+
<?php _e( 'Enable or disable the automatic translation of the site. To minimize translation costs, each untranslated string is automatically translated only once, then stored in the database.', 'translatepress-multilingual' ) ?>
|
18 |
</p>
|
19 |
</td>
|
20 |
</tr>
|
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.
|
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,16 @@ For more information please check out [TranslatePress - Multilingual plugin docu
|
|
143 |
|
144 |
|
145 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
= 1.6.1 =
|
147 |
* Added support for hreflang x-default in Advanced Settings
|
148 |
* Improved checking if quota exceeded on google machine translation for each batch
|
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.2
|
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.2 =
|
147 |
+
* Fixed admin-bar appearing in translation editor
|
148 |
+
* Nextgen plugin compatibility fix
|
149 |
+
* Fixed a notice index translation-engine not set.
|
150 |
+
* Refactored upgrading settings.
|
151 |
+
* Solved issue with notifications shown in all backend that couldn't be dismissed
|
152 |
+
* Added ability to detect if table is missing during requests. Show admin notice on all pages.
|
153 |
+
* Updated License message and Automatic Translation description
|
154 |
+
* Created notifications and error page. Disabled machine translations upon error.
|
155 |
+
|
156 |
= 1.6.1 =
|
157 |
* Added support for hreflang x-default in Advanced Settings
|
158 |
* Improved checking if quota exceeded on google machine translation for each batch
|