TranslatePress – Translate Multilingual sites - Version 1.9.8

Version Description

  • Added compatibility with Google Site Kit plugin
  • Added compatibility with Ivory Search plugin and possibly others
  • Added visual feedback for inserting correct Automatic Translation API key
  • Added hooks when saving translations in Editor
  • Fixed notice in trp-ajax file
Download this release

Release Info

Developer razvan.mo
Plugin Icon 128x128 TranslatePress – Translate Multilingual sites
Version 1.9.8
Comparing to
See all releases

Code changes from version 1.9.7 to 1.9.8

assets/css/trp-back-end-style.css CHANGED
@@ -42,7 +42,25 @@ ul.trp-unsupported-languages{
42
  list-style: inside;
43
  }
44
 
 
 
 
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  /**************************************************/
47
  /* Extra styling for admin notices
48
  /**************************************************/
@@ -135,6 +153,15 @@ input.trp-translation-published{
135
  margin-top: 10px;
136
  }
137
 
 
 
 
 
 
 
 
 
 
138
  .warning,
139
  .trp-upsell-multiple-languages{
140
  border: 1px solid #a00;
42
  list-style: inside;
43
  }
44
 
45
+ input.trp-text-input-error {
46
+ border: 1px solid #a00;
47
+ }
48
 
49
+ /**************************************************/
50
+ /* SVG Styling
51
+ /**************************************************/
52
+ .trp-svg-icon {
53
+ height: 20px;
54
+ width: 20px;
55
+ line-height: 0;
56
+ vertical-align: middle;
57
+ }
58
+ .trp-svg-icon.fas-times-circle {
59
+ color: #a00;
60
+ }
61
+ .trp-svg-icon.fas-check-circle {
62
+ color: #14aa00;
63
+ }
64
  /**************************************************/
65
  /* Extra styling for admin notices
66
  /**************************************************/
153
  margin-top: 10px;
154
  }
155
 
156
+ .form-table td p.trp-error-inline, /* WP style */
157
+ .trp-error-inline {
158
+ color: #a00;
159
+ font-weight: 500;
160
+ margin-bottom: 1em;
161
+ box-sizing: border-box;
162
+ }
163
+
164
+
165
  .warning,
166
  .trp-upsell-multiple-languages{
167
  border: 1px solid #a00;
class-translate-press.php CHANGED
@@ -32,6 +32,7 @@ class TRP_Translate_Press{
32
  protected $notifications;
33
  protected $search;
34
  protected $install_plugins;
 
35
 
36
  public $active_pro_addons = array();
37
  public static $translate_press = null;
@@ -57,7 +58,7 @@ class TRP_Translate_Press{
57
  define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
58
  define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
59
  define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
60
- define( 'TRP_PLUGIN_VERSION', '1.9.7' );
61
 
62
  wp_cache_add_non_persistent_groups(array('trp'));
63
 
@@ -114,6 +115,7 @@ class TRP_Translate_Press{
114
  require_once TRP_PLUGIN_DIR . 'includes/string-translation/class-string-translation-helper.php';
115
  require_once TRP_PLUGIN_DIR . 'includes/class-search.php';
116
  require_once TRP_PLUGIN_DIR . 'includes/class-install-plugins.php';
 
117
  if ( did_action( 'elementor/loaded' ) )
118
  require_once TRP_PLUGIN_DIR . 'includes/class-elementor-language-for-blocks.php';
119
  if ( defined( 'WPB_VC_VERSION' ) ) {
@@ -152,6 +154,7 @@ class TRP_Translate_Press{
152
  $this->string_translation = new TRP_String_Translation( $this->settings->get_settings(), $this->loader );
153
  $this->search = new TRP_Search( $this->settings->get_settings() );
154
  $this->install_plugins = new TRP_Install_Plugins();
 
155
  }
156
 
157
  /**
@@ -193,6 +196,7 @@ class TRP_Translate_Press{
193
  $this->loader->add_action( 'admin_enqueue_scripts', $this->settings, 'enqueue_scripts_and_styles', 10, 1 );
194
  $this->loader->add_filter( 'plugin_action_links_' . TRP_PLUGIN_BASE , $this->settings, 'plugin_action_links', 10, 1 );
195
  $this->loader->add_action( 'trp_settings_navigation_tabs', $this->settings, 'add_navigation_tabs' );
 
196
  $this->loader->add_action( 'trp_language_selector', $this->settings, 'languages_selector', 10, 1 );
197
 
198
  $this->loader->add_action( 'trp_settings_tabs', $this->advanced_tab, 'add_advanced_tab_to_settings', 10, 1 );
@@ -262,6 +266,9 @@ class TRP_Translate_Press{
262
  $this->loader->add_action('admin_menu', $this->license_page, 'license_menu');
263
  }
264
 
 
 
 
265
  }
266
 
267
  /**
@@ -379,7 +386,7 @@ class TRP_Translate_Press{
379
  $this->loader->add_action( 'plugins_loaded', $this, 'init_machine_translation', 10 );
380
 
381
  //search
382
- $this->loader->add_filter( 'pre_get_posts', $this->search, 'trp_search_filter', 100 );
383
  $this->loader->add_filter( 'get_search_query', $this->search, 'trp_search_query', 10 );
384
  }
385
 
32
  protected $notifications;
33
  protected $search;
34
  protected $install_plugins;
35
+ protected $reviews;
36
 
37
  public $active_pro_addons = array();
38
  public static $translate_press = null;
58
  define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
59
  define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
60
  define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
61
+ define( 'TRP_PLUGIN_VERSION', '1.9.8' );
62
 
63
  wp_cache_add_non_persistent_groups(array('trp'));
64
 
115
  require_once TRP_PLUGIN_DIR . 'includes/string-translation/class-string-translation-helper.php';
116
  require_once TRP_PLUGIN_DIR . 'includes/class-search.php';
117
  require_once TRP_PLUGIN_DIR . 'includes/class-install-plugins.php';
118
+ require_once TRP_PLUGIN_DIR . 'includes/class-reviews.php';
119
  if ( did_action( 'elementor/loaded' ) )
120
  require_once TRP_PLUGIN_DIR . 'includes/class-elementor-language-for-blocks.php';
121
  if ( defined( 'WPB_VC_VERSION' ) ) {
154
  $this->string_translation = new TRP_String_Translation( $this->settings->get_settings(), $this->loader );
155
  $this->search = new TRP_Search( $this->settings->get_settings() );
156
  $this->install_plugins = new TRP_Install_Plugins();
157
+ $this->reviews = new TRP_Reviews( $this->settings->get_settings() );
158
  }
159
 
160
  /**
196
  $this->loader->add_action( 'admin_enqueue_scripts', $this->settings, 'enqueue_scripts_and_styles', 10, 1 );
197
  $this->loader->add_filter( 'plugin_action_links_' . TRP_PLUGIN_BASE , $this->settings, 'plugin_action_links', 10, 1 );
198
  $this->loader->add_action( 'trp_settings_navigation_tabs', $this->settings, 'add_navigation_tabs' );
199
+ $this->loader->add_action( 'trp_settings_navigation_tabs', $this->settings, 'add_svg_icons' );
200
  $this->loader->add_action( 'trp_language_selector', $this->settings, 'languages_selector', 10, 1 );
201
 
202
  $this->loader->add_action( 'trp_settings_tabs', $this->advanced_tab, 'add_advanced_tab_to_settings', 10, 1 );
266
  $this->loader->add_action('admin_menu', $this->license_page, 'license_menu');
267
  }
268
 
269
+ $this->loader->add_action( 'admin_init', $this->reviews, 'display_review_notice' );
270
+ $this->loader->add_action( 'trp_dismiss_notification', $this->reviews, 'dismiss_notification', 10, 2 );
271
+
272
  }
273
 
274
  /**
386
  $this->loader->add_action( 'plugins_loaded', $this, 'init_machine_translation', 10 );
387
 
388
  //search
389
+ $this->loader->add_filter( 'pre_get_posts', $this->search, 'trp_search_filter', 99999999 );
390
  $this->loader->add_filter( 'get_search_query', $this->search, 'trp_search_query', 10 );
391
  }
392
 
includes/class-editor-api-gettext-strings.php CHANGED
@@ -158,6 +158,8 @@ class TRP_Editor_Api_Gettext_Strings {
158
  $this->trp_query->update_gettext_strings( $update_string_array, $language, array('id','translated', 'status') );
159
  $this->trp_query->remove_possible_duplicates($update_string_array, $language, 'gettext');
160
  }
 
 
161
  }
162
  }
163
  echo trp_safe_json_encode( array() );
158
  $this->trp_query->update_gettext_strings( $update_string_array, $language, array('id','translated', 'status') );
159
  $this->trp_query->remove_possible_duplicates($update_string_array, $language, 'gettext');
160
  }
161
+
162
+ do_action('trp_save_editor_translations_gettext_strings', $update_strings, $this->settings);
163
  }
164
  }
165
  echo trp_safe_json_encode( array() );
includes/class-editor-api-regular-strings.php CHANGED
@@ -235,6 +235,8 @@ class TRP_Editor_Api_Regular_Strings {
235
  $this->trp_query->update_strings( $update_string_array, $language, array('id','translated', 'status', 'block_type'));
236
  $this->trp_query->remove_possible_duplicates($update_string_array, $language, 'regular');
237
  }
 
 
238
 
239
  }
240
 
235
  $this->trp_query->update_strings( $update_string_array, $language, array('id','translated', 'status', 'block_type'));
236
  $this->trp_query->remove_possible_duplicates($update_string_array, $language, 'regular');
237
  }
238
+
239
+ do_action('trp_save_editor_translations_regular_strings', $update_strings, $this->settings);
240
 
241
  }
242
 
includes/class-machine-translator.php CHANGED
@@ -93,6 +93,75 @@ class TRP_Machine_Translator {
93
  return $data['trp_mt_supported_languages'][$this->settings['trp_machine_translation_settings']['translation-engine']]['last-checked'];
94
  }
95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  /**
97
  * Return site referer
98
  *
93
  return $data['trp_mt_supported_languages'][$this->settings['trp_machine_translation_settings']['translation-engine']]['last-checked'];
94
  }
95
 
96
+ /**
97
+ * Output an SVG based on translation engine and error flag.
98
+ *
99
+ * @param bool $show_errors true to show an error SVG, false if not.
100
+ */
101
+ public function automatic_translation_svg_output( $show_errors ) {
102
+ if ( method_exists( $this, 'automatic_translate_error_check' ) ) {
103
+ if ( $show_errors ) {
104
+ trp_output_svg( 'error' );
105
+ } else {
106
+ trp_output_svg( 'check' );
107
+ }
108
+ }
109
+
110
+ }
111
+
112
+ /**
113
+ * Check the automatic translation API keys for Google Translate and DeepL.
114
+ *
115
+ * @param TRP_Translate_Press $machine_translator Machine translator instance.
116
+ * @param string $translation_engine The translation engine (can be google_translate_v2 and deepl).
117
+ * @param string $api_key The API key to check.
118
+ *
119
+ * @return array [ (string) $message, (bool) $error ].
120
+ */
121
+ public function automatic_translate_error_check( $machine_translator, $translation_engine, $api_key ) {
122
+ $is_error = false;
123
+ $return_message = '';
124
+
125
+ switch ( $translation_engine ) {
126
+ case 'google_translate_v2':
127
+ if ( empty( $api_key ) ) {
128
+ $is_error = true;
129
+ $return_message = __( 'Please enter your Google Translate key.', 'translatepress-multilingual' );
130
+ } else {
131
+ // Perform test.
132
+ $response = $machine_translator->test_request();
133
+ $code = wp_remote_retrieve_response_code( $response );
134
+ if ( 200 !== $code ) {
135
+ $is_error = true;
136
+ $translate_response = trp_gt_response_codes( $code );
137
+ $return_message = $translate_response['message'];
138
+ }
139
+ }
140
+ break;
141
+ case 'deepl':
142
+ if ( empty( $api_key ) ) {
143
+ $is_error = true;
144
+ $return_message = __( 'Please enter your DeepL API key.', 'translatepress-multilingual' );
145
+ } else {
146
+ // Perform test.
147
+ $response = $machine_translator->test_request();
148
+ $code = wp_remote_retrieve_response_code( $response );
149
+ if ( 200 !== $code && method_exists( 'TRP_DeepL', 'deepl_response_codes' ) ) {
150
+ $is_error = true;
151
+ $translate_response = TRP_DeepL::deepl_response_codes( $code );
152
+ $return_message = $translate_response['message'];
153
+ }
154
+ }
155
+ break;
156
+ default:
157
+ break;
158
+ }
159
+ return array(
160
+ 'message' => $return_message,
161
+ 'error' => $is_error,
162
+ );
163
+ }
164
+
165
  /**
166
  * Return site referer
167
  *
includes/class-plugin-notices.php CHANGED
@@ -43,7 +43,7 @@ class TRP_Add_General_Notices{
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 );
@@ -53,6 +53,7 @@ class TRP_Add_General_Notices{
53
 
54
  function allow_z_index_in_wp_kses( $styles ) {
55
  $styles[] = 'z-index';
 
56
  return $styles;
57
  }
58
 
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 .'" style="position:relative;' . ((strpos($this->notificationClass, 'trp-narrow')!==false ) ? 'max-width: 825px;' : '') . '" >'.$this->notificationMessage.'</div>', $this->notificationMessage), [ 'div' => [ 'class' => [],'style' => [] ], 'p' => ['style' => [], 'class' => []], 'a' => ['href' => [], 'type'=> [], 'class'=> [], 'style'=>[], 'title'=>[],'target'=>[]], '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 );
53
 
54
  function allow_z_index_in_wp_kses( $styles ) {
55
  $styles[] = 'z-index';
56
+ $styles[] = 'position';
57
  return $styles;
58
  }
59
 
includes/class-query.php CHANGED
@@ -1449,6 +1449,23 @@ class TRP_Query{
1449
  $return = false;
1450
  }
1451
  }
1452
- return $return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1453
  }
1454
  }
1449
  $return = false;
1450
  }
1451
  }
1452
+ return apply_filters('trp_is_sql_values_accepted', $return );
1453
+ }
1454
+
1455
+ /**
1456
+ * Return true if the dictionary table of $language has at least $minimum_rows with $status
1457
+ *
1458
+ * @param $language
1459
+ * @param $minimum_rows
1460
+ * @param $status
1461
+ *
1462
+ * @return bool
1463
+ */
1464
+ public function minimum_rows_with_status( $language, $minimum_rows, $status ) {
1465
+ $minimum_rows = (int) $minimum_rows;
1466
+ $status = (int) $status;
1467
+
1468
+ $sql = "SELECT (COUNT(*) > " . $minimum_rows . ") FROM `" . sanitize_text_field( $this->get_table_name( $language ) ). "` WHERE status = " . $status;
1469
+ return $this->db->get_var( $sql );
1470
  }
1471
  }
includes/class-reviews.php ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class TRP_Reviews
5
+ */
6
+ class TRP_Reviews{
7
+ protected $settings;
8
+ /* @var TRP_Settings */
9
+ protected $trp_settings;
10
+ protected $date_of_install;
11
+
12
+ public function __construct( $settings){
13
+ $this->settings = $settings;
14
+ $this->maybe_set_date_of_install();
15
+ }
16
+
17
+ /**
18
+ * Marks timestamp TP install if not already set
19
+ *
20
+ * Started tracking timestamp of installation since version 1.9.8
21
+ */
22
+ public function maybe_set_date_of_install(){
23
+ $trp_db_stored_data = get_option( 'trp_db_stored_data', array() );
24
+ if ( !isset( $trp_db_stored_data['install_timestamp'] ) ){
25
+ $trp_db_stored_data['install_timestamp'] = time();
26
+ update_option('trp_db_stored_data', $trp_db_stored_data );
27
+ }
28
+ $this->date_of_install = $trp_db_stored_data['install_timestamp'];
29
+ }
30
+
31
+ public function get_date_of_install(){
32
+ return $this->date_of_install;
33
+ }
34
+
35
+ public function should_it_show_review_notice(){
36
+
37
+ // conditions
38
+ $time_to_wait_condition = WEEK_IN_SECONDS;
39
+ $number_of_translations_condition = 25;
40
+ $how_often_to_check = DAY_IN_SECONDS;
41
+
42
+
43
+ $trp_db_stored_data = get_option( 'trp_db_stored_data', array() );
44
+ $notification_dismissed = isset( $trp_db_stored_data['trp_review_notification_dismiss_notification'] ) && $trp_db_stored_data['trp_review_notification_dismiss_notification'] === true;
45
+ $site_meets_conditions_for_review = isset( $trp_db_stored_data['trp_site_meets_conditions_for_review'] ) && $trp_db_stored_data['trp_site_meets_conditions_for_review'] === true;
46
+
47
+ if ( !$notification_dismissed && !$site_meets_conditions_for_review ) {
48
+ $trp = TRP_Translate_Press::get_trp_instance();
49
+ $machine_translator = $trp->get_component( 'machine_translator' );
50
+ $trp_query = $trp->get_component( 'query' );
51
+
52
+ $transient = get_transient( 'trp_checked_if_site_meets_conditions_for_review' );
53
+ if ( $transient === false ) {
54
+ // Do sql checks because transient has expired. Transient is used to ensure checking is not made on every page load.
55
+
56
+ if ( time() - $this->get_date_of_install() > $time_to_wait_condition ) {
57
+
58
+ foreach ( $this->settings['translation-languages'] as $language ) {
59
+ if ( $language === $this->settings['default-language']){
60
+ continue;
61
+ }
62
+ if ( $trp_query->minimum_rows_with_status( $language, $number_of_translations_condition, 2 ) ) {
63
+ $site_meets_conditions_for_review = true;
64
+ break;
65
+ }
66
+
67
+ if ( $machine_translator->is_available( array() ) && $trp_query->minimum_rows_with_status( $language, $number_of_translations_condition, 1 ) ) {
68
+ $site_meets_conditions_for_review = true;
69
+ break;
70
+ }
71
+ }
72
+ }
73
+ set_transient( 'trp_checked_if_site_meets_conditions_for_review', 'yes', $how_often_to_check );
74
+ }
75
+ }
76
+
77
+ if ( !isset( $trp_db_stored_data['trp_site_meets_conditions_for_review'] ) && $site_meets_conditions_for_review ){
78
+ // once a site meets the conditions, remember so that we don't check anymore
79
+ $trp_db_stored_data['trp_site_meets_conditions_for_review'] = true;
80
+ update_option( 'trp_db_stored_data', $trp_db_stored_data );
81
+ }
82
+
83
+ // actual logic for showing reviews or not
84
+ $show_review_notice = ( !$notification_dismissed && $site_meets_conditions_for_review );
85
+
86
+ return apply_filters( 'trp_show_notification_about_review', $show_review_notice, $notification_dismissed, $site_meets_conditions_for_review );
87
+ }
88
+
89
+ /**
90
+ * Show an admin notice inviting the user to review TP
91
+ *
92
+ * hooked to admin_init
93
+ */
94
+ public function display_review_notice(){
95
+
96
+ if ( !$this->should_it_show_review_notice() ){
97
+ return;
98
+ }
99
+ $notifications = TRP_Plugin_Notifications::get_instance();
100
+ /* this must be unique */
101
+ $notification_id = 'trp_review_notification';
102
+ $url = 'https://wordpress.org/support/plugin/translatepress-multilingual/reviews/?filter=5#new-post';
103
+
104
+ $message = '<p style="margin-top: 16px;font-size: 14px;padding-right:20px">';
105
+ $message .= wp_kses( __( "Hello! Seems like you've been using <strong>TranslatePress</strong> for a while now to translate your website. That's awesome! ", 'translatepress-multilingual' ), array('strong' => array() ) );
106
+ $message .= '</p>';
107
+
108
+ $message .= '<p style="font-size: 14px">';
109
+ $message .= esc_html__( "If you can spare a few moments to rate it on WordPress.org it would help us a lot (and boost my motivation).", 'translatepress-multilingual' );
110
+ $message .= '</p>';
111
+
112
+ $message .= '<p>';
113
+ $message .= esc_html__( "~ Razvan, developer of TranslatePress", 'translatepress-multilingual' ) ;
114
+ $message .= '</p>';
115
+
116
+ // buttons for OK / No, thanks
117
+ $message .= '<p>';
118
+ $message .= '<a href="' . esc_url( $url ) . '" title="' . esc_attr__( 'Rate TranslatePress on WordPress.org plugin page', 'translatepress-multilingual' ) . '" class="button-primary" style="margin-right: 20px">' . esc_html__( "Ok, I will gladly help!", 'translatepress-multilingual' ) . '</a>';
119
+ $message .= '<a href="' . add_query_arg( array( 'trp_dismiss_admin_notification' => $notification_id ) ) . '" title="' . esc_attr__( 'Dismiss this notice.', 'translatepress-multilingual' ) . '" class="button-secondary" >' . esc_html__( "No, thanks.", 'translatepress-multilingual' ) . '</a>';
120
+ $message .= '</p>';
121
+ //make sure to use the trp_dismiss_admin_notification arg
122
+ $message .= '<a href="' . add_query_arg( array( 'trp_dismiss_admin_notification' => $notification_id ) ) . '" style="text-decoration:none" type="button" class="notice-dismiss"><span class="screen-reader-text">' . __( 'Dismiss this notice.', 'translatepress-multilingual' ) . '</span></a>';
123
+
124
+ $notifications->add_notification( $notification_id, $message, 'trp-notice trp-narrow notice notice-info', true, array( 'translate-press' ), true );
125
+
126
+ }
127
+
128
+ /**
129
+ * Set option to not display notification
130
+ *
131
+ * Necessary because the plugin notification system is originally user meta based.
132
+ * Change this behaviour so that dismissing the notification is known site-wide
133
+ *
134
+ * hooked to trp_dismiss_notification
135
+ *
136
+ * @param $notification_id
137
+ * @param $current_user
138
+ */
139
+ public function dismiss_notification($notification_id, $current_user){
140
+ if ( $notification_id === 'trp_review_notification' ) {
141
+ $trp_db_stored_data = get_option( 'trp_db_stored_data', array() );
142
+ $trp_db_stored_data['trp_review_notification_dismiss_notification'] = true;
143
+ update_option('trp_db_stored_data', $trp_db_stored_data );
144
+ }
145
+ }
146
+ }
includes/class-settings.php CHANGED
@@ -548,6 +548,22 @@ class TRP_Settings{
548
  require TRP_PLUGIN_DIR . 'partials/settings-navigation-tabs.php';
549
  }
550
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
551
  /**
552
  * Plugin action links.
553
  *
548
  require TRP_PLUGIN_DIR . 'partials/settings-navigation-tabs.php';
549
  }
550
 
551
+ /**
552
+ * Add SVG icon symbols to use throughout the admin.
553
+ */
554
+ public function add_svg_icons() {
555
+ ?>
556
+ <svg width="0" height="0" class="hidden">
557
+ <symbol aria-hidden="true" data-prefix="fas" data-icon="check-circle" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" id="check-circle">
558
+ <path fill="currentColor" d="M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z"></path>
559
+ </symbol>
560
+ <symbol aria-hidden="true" data-prefix="fas" data-icon="times-circle" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" id="times-circle">
561
+ <path fill="currentColor" d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm121.6 313.1c4.7 4.7 4.7 12.3 0 17L338 377.6c-4.7 4.7-12.3 4.7-17 0L256 312l-65.1 65.6c-4.7 4.7-12.3 4.7-17 0L134.4 338c-4.7-4.7-4.7-12.3 0-17l65.6-65-65.6-65.1c-4.7-4.7-4.7-12.3 0-17l39.6-39.6c4.7-4.7 12.3-4.7 17 0l65 65.7 65.1-65.6c4.7-4.7 12.3-4.7 17 0l39.6 39.6c4.7 4.7 4.7 12.3 0 17L312 256l65.6 65.1z"></path>
562
+ </symbol>
563
+ </svg>
564
+ <?php
565
+ }
566
+
567
  /**
568
  * Plugin action links.
569
  *
includes/compatibility-functions.php CHANGED
@@ -1460,3 +1460,19 @@ if( class_exists('WooCommerce_Product_Search_Service') ) {
1460
  return $translation;
1461
 
1462
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1460
  return $translation;
1461
 
1462
  }
1463
+
1464
+
1465
+ /**
1466
+ * Compatibility with Google Site Kit plugin
1467
+ *
1468
+ * Problem was that Site Kit dashboard kept disconnecting, thinking the url must have changed.
1469
+ *
1470
+ * To replicate, set TP option "Add language to subdirectory" Yes and use Complianz plugin, wizard step 2,
1471
+ * to perform re-scan of cookies. This triggered the disconnect.
1472
+ */
1473
+ add_filter('googlesitekit_canonical_home_url', 'trp_googlesitekit_compatibility_home_url' );
1474
+ function trp_googlesitekit_compatibility_home_url( $url ) {
1475
+ $trp = TRP_Translate_Press::get_trp_instance();
1476
+ $url_converter = $trp->get_component('url_converter');
1477
+ return $url_converter->get_abs_home();
1478
+ }
includes/external-functions.php CHANGED
@@ -117,7 +117,7 @@ function trp_sort_dictionary_by_original( $dictionaries, $type, $group, $languag
117
 
118
  function trp_is_valid_language_code( $language_code ){
119
  // allowed characters A-Z a-z 0-9 - _
120
- if ( preg_match('/[^A-Za-z0-9\-_]/i', $language_code ) ) {
121
  return false;
122
  }else{
123
  return true;
117
 
118
  function trp_is_valid_language_code( $language_code ){
119
  // allowed characters A-Z a-z 0-9 - _
120
+ if ( empty($language_code) || preg_match('/[^A-Za-z0-9\-_]/i', $language_code ) ) {
121
  return false;
122
  }else{
123
  return true;
includes/functions.php CHANGED
@@ -128,17 +128,17 @@ function trp_add_affiliate_id_to_link( $link ){
128
  //Avangate Affiliate Network
129
  $avg_affiliate_id = get_option('translatepress_avg_affiliate_id');
130
  if ( !empty( $avg_affiliate_id ) ) {
131
- return esc_url( add_query_arg( 'avgref', $avg_affiliate_id, $link ) );
132
  }
133
  else{
134
  // AffiliateWP
135
  $affiliate_id = get_option('translatepress_affiliate_id');
136
  if ( !empty( $affiliate_id ) ) {
137
- return esc_url( add_query_arg( 'ref', $affiliate_id, $link ) );
138
  }
139
  }
140
 
141
- return esc_url( $link );
142
  }
143
 
144
  /**
@@ -432,6 +432,28 @@ function trp_remove_accents( $string ){
432
  return $string;
433
  };
434
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
435
  /**
436
  * Debuger function. Mainly designed for the get_url_for_language() function
437
  *
128
  //Avangate Affiliate Network
129
  $avg_affiliate_id = get_option('translatepress_avg_affiliate_id');
130
  if ( !empty( $avg_affiliate_id ) ) {
131
+ $link = add_query_arg( 'avgref', $avg_affiliate_id, $link );
132
  }
133
  else{
134
  // AffiliateWP
135
  $affiliate_id = get_option('translatepress_affiliate_id');
136
  if ( !empty( $affiliate_id ) ) {
137
+ $link = add_query_arg( 'ref', $affiliate_id, $link );
138
  }
139
  }
140
 
141
+ return esc_url( apply_filters( 'trp_affiliate_link', $link ) );
142
  }
143
 
144
  /**
432
  return $string;
433
  };
434
 
435
+ /**
436
+ * Output an SVG depending on case.
437
+ *
438
+ * @param string $icon The icon to output. Default no icon.
439
+ */
440
+ function trp_output_svg( $icon = '' ) {
441
+ switch ( $icon ) {
442
+ case 'check':
443
+ ?>
444
+ <svg class="trp-svg-icon fas-check-circle"><use xlink:href="#check-circle"></use></svg>
445
+ <?php
446
+ break;
447
+ case 'error':
448
+ ?>
449
+ <svg class="trp-svg-icon fas-times-circle"><use xlink:href="#times-circle"></use></svg>
450
+ <?php
451
+ break;
452
+ default:
453
+ break;
454
+ }
455
+ }
456
+
457
  /**
458
  * Debuger function. Mainly designed for the get_url_for_language() function
459
  *
includes/google-translate/functions.php CHANGED
@@ -11,12 +11,49 @@ add_action( 'trp_machine_translation_extra_settings_middle', 'trp_gt_add_setting
11
  function trp_gt_add_settings( $mt_settings ){
12
  $trp = TRP_Translate_Press::get_trp_instance();
13
  $machine_translator = $trp->get_component( 'machine_translator' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  ?>
15
 
16
  <tr>
17
  <th scope="row"><?php esc_html_e( 'Google Translate API Key', 'translatepress-multilingual' ); ?> </th>
18
  <td>
19
- <input type="text" id="trp-g-translate-key" class="trp-text-input" name="trp_machine_translation_settings[google-translate-key]" value="<?php if( !empty( $mt_settings['google-translate-key'] ) ) echo esc_attr( $mt_settings['google-translate-key']);?>"/>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  <p class="description">
21
  <?php echo wp_kses( __( 'Visit <a href="https://cloud.google.com/docs/authentication/api-keys" target="_blank">this link</a> to see how you can set up an API key, <strong>control API costs</strong> and set HTTP referrer restrictions.', 'translatepress-multilingual' ), [ 'a' => [ 'href' => [], 'title' => [], 'target' => [] ], 'strong' => [] ] ); ?>
22
  <br><?php echo sprintf( esc_html__( 'Your HTTP referrer is: %s', 'translatepress-multilingual' ), $machine_translator->get_referer() ); ?>
@@ -35,3 +72,34 @@ function trp_gt_sanitize_settings( $mt_settings ){
35
 
36
  return $mt_settings;
37
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  function trp_gt_add_settings( $mt_settings ){
12
  $trp = TRP_Translate_Press::get_trp_instance();
13
  $machine_translator = $trp->get_component( 'machine_translator' );
14
+
15
+ $translation_engine = isset( $mt_settings['translation-engine'] ) ? $mt_settings['translation-engine'] : '';
16
+ $api_key = isset( $mt_settings['google-translate-key'] ) ? $mt_settings['google-translate-key'] : '';
17
+
18
+ // Check for API errors.
19
+ $api_check = $machine_translator->automatic_translate_error_check( $machine_translator, $translation_engine, $api_key );
20
+
21
+ // Check for errors.
22
+ $error_message = '';
23
+ $show_errors = false;
24
+ if ( true === $api_check['error'] ) {
25
+ $error_message = $api_check['message'];
26
+ $show_errors = true;
27
+ }
28
+
29
+ $text_input_classes = array(
30
+ 'trp-text-input',
31
+ );
32
+ if ( $show_errors && 'google_translate_v2' === $translation_engine ) {
33
+ $text_input_classes[] = 'trp-text-input-error';
34
+ }
35
  ?>
36
 
37
  <tr>
38
  <th scope="row"><?php esc_html_e( 'Google Translate API Key', 'translatepress-multilingual' ); ?> </th>
39
  <td>
40
+ <?php
41
+ // Display an error message above the input.
42
+ if ( $show_errors && 'google_translate_v2' === $translation_engine ) {
43
+ ?>
44
+ <p class="trp-error-inline">
45
+ <?php echo wp_kses_post( $error_message ); ?>
46
+ </p>
47
+ <?php
48
+ }
49
+ ?>
50
+ <input type="text" id="trp-g-translate-key" class="<?php echo esc_html( implode( $text_input_classes, ' ' ) ); ?>" name="trp_machine_translation_settings[google-translate-key]" value="<?php if( !empty( $mt_settings['google-translate-key'] ) ) echo esc_attr( $mt_settings['google-translate-key']);?>"/>
51
+ <?php
52
+ // Only show errors if Google Translate is active.
53
+ if ( 'google_translate_v2' === $translation_engine && function_exists( 'trp_output_svg' ) ) {
54
+ $machine_translator->automatic_translation_svg_output( $show_errors );
55
+ }
56
+ ?>
57
  <p class="description">
58
  <?php echo wp_kses( __( 'Visit <a href="https://cloud.google.com/docs/authentication/api-keys" target="_blank">this link</a> to see how you can set up an API key, <strong>control API costs</strong> and set HTTP referrer restrictions.', 'translatepress-multilingual' ), [ 'a' => [ 'href' => [], 'title' => [], 'target' => [] ], 'strong' => [] ] ); ?>
59
  <br><?php echo sprintf( esc_html__( 'Your HTTP referrer is: %s', 'translatepress-multilingual' ), $machine_translator->get_referer() ); ?>
72
 
73
  return $mt_settings;
74
  }
75
+
76
+ /**
77
+ * Returns an appropriate error/success message for the Google Translate access.
78
+ *
79
+ * @param int $code The code returned by Google Translate access.
80
+ *
81
+ * @return array [ (string) $message, (bool) $error ].
82
+ */
83
+ function trp_gt_response_codes( $code ) {
84
+ $is_error = false;
85
+ $code = intval( $code );
86
+ $return_message = '';
87
+
88
+ /**
89
+ * Determine if we have a 4xx or 5xx error.
90
+ *
91
+ * @see https://cloud.google.com/apis/design/errors
92
+ */
93
+ if ( preg_match( '/4\d\d/', $code ) ) {
94
+ $is_error = true;
95
+ $return_message = esc_html__( 'There was an error with your Google Translate key.', 'translatepress-multilingual' );
96
+ } elseif ( preg_match( '/5\d\d/', $code ) ) {
97
+ $is_error = true;
98
+ $return_message = esc_html__( 'There was an error on the server processing your Google Translate key.', 'translatepress-multilingual' );
99
+ }
100
+
101
+ return array(
102
+ 'message' => $return_message,
103
+ 'error' => $is_error,
104
+ );
105
+ }
includes/trp-ajax.php CHANGED
@@ -22,7 +22,7 @@ class TRP_Ajax{
22
  }
23
 
24
  include './external-functions.php';
25
- if ( !trp_is_valid_language_code( $_POST['language'] ) || !trp_is_valid_language_code( $_POST['$original_language'] ) ) {
26
  echo json_encode( 'TranslatePress Error: Invalid language code' );
27
  exit;
28
  }
22
  }
23
 
24
  include './external-functions.php';
25
+ if ( !trp_is_valid_language_code( $_POST['language'] ) || !trp_is_valid_language_code( $_POST['original_language'] ) ) {
26
  echo json_encode( 'TranslatePress Error: Invalid language code' );
27
  exit;
28
  }
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.9.7
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.9.8
7
  Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
8
  Author URI: https://cozmoslabs.com/
9
  Text Domain: translatepress-multilingual
languages/translatepress-multilingual.catalog.php CHANGED
@@ -69,6 +69,8 @@
69
  <?php __("Recheck supported languages", "translatepress-multilingual"); ?>
70
  <?php __("(last checked on %s)", "translatepress-multilingual"); ?>
71
  <?php __("The selected automatic translation engine does not provide support for these languages.<br>You can still manually translate pages in these languages using the Translation Editor.", "translatepress-multilingual"); ?>
 
 
72
  <?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"); ?>
73
  <?php __("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.", "translatepress-multilingual"); ?>
74
  <?php __("Something went wrong, please try again.", "translatepress-multilingual"); ?>
@@ -77,6 +79,12 @@
77
  <?php __("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.", "translatepress-multilingual"); ?>
78
  <?php __("The daily quota for machine translation characters exceeded. Please check the <strong>TranslatePress -> <a href=\"%s\">Automatic Translation</a></strong> page for more information.", "translatepress-multilingual"); ?>
79
  <?php __("One or more languages are unsupported by the automatic translation provider. Please check the <strong>TranslatePress -> <a href=\"%s\">Automatic Translation</a></strong> page for more information.", "translatepress-multilingual"); ?>
 
 
 
 
 
 
80
  <?php __("Full Language Names", "translatepress-multilingual"); ?>
81
  <?php __("Short Language Names", "translatepress-multilingual"); ?>
82
  <?php __("Flags with Full Language Names", "translatepress-multilingual"); ?>
@@ -372,6 +380,8 @@
372
  <?php __("Google Translate API Key", "translatepress-multilingual"); ?>
373
  <?php __("Visit <a href=\"https://cloud.google.com/docs/authentication/api-keys\" target=\"_blank\">this link</a> to see how you can set up an API key, <strong>control API costs</strong> and set HTTP referrer restrictions.", "translatepress-multilingual"); ?>
374
  <?php __("Your HTTP referrer is: %s", "translatepress-multilingual"); ?>
 
 
375
  <?php __("Human reviewed", "translatepress-multilingual"); ?>
376
  <?php __("Automatically translated", "translatepress-multilingual"); ?>
377
  <?php __("Not translated", "translatepress-multilingual"); ?>
69
  <?php __("Recheck supported languages", "translatepress-multilingual"); ?>
70
  <?php __("(last checked on %s)", "translatepress-multilingual"); ?>
71
  <?php __("The selected automatic translation engine does not provide support for these languages.<br>You can still manually translate pages in these languages using the Translation Editor.", "translatepress-multilingual"); ?>
72
+ <?php __("Please enter your Google Translate key.", "translatepress-multilingual"); ?>
73
+ <?php __("Please enter your DeepL API key.", "translatepress-multilingual"); ?>
74
  <?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"); ?>
75
  <?php __("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.", "translatepress-multilingual"); ?>
76
  <?php __("Something went wrong, please try again.", "translatepress-multilingual"); ?>
79
  <?php __("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.", "translatepress-multilingual"); ?>
80
  <?php __("The daily quota for machine translation characters exceeded. Please check the <strong>TranslatePress -> <a href=\"%s\">Automatic Translation</a></strong> page for more information.", "translatepress-multilingual"); ?>
81
  <?php __("One or more languages are unsupported by the automatic translation provider. Please check the <strong>TranslatePress -> <a href=\"%s\">Automatic Translation</a></strong> page for more information.", "translatepress-multilingual"); ?>
82
+ <?php __("Hello! Seems like you've been using <strong>TranslatePress</strong> for a while now to translate your website. That's awesome! ", "translatepress-multilingual"); ?>
83
+ <?php __("If you can spare a few moments to rate it on WordPress.org it would help us a lot (and boost my motivation).", "translatepress-multilingual"); ?>
84
+ <?php __("~ Razvan, developer of TranslatePress", "translatepress-multilingual"); ?>
85
+ <?php __("Rate TranslatePress on WordPress.org plugin page", "translatepress-multilingual"); ?>
86
+ <?php __("Ok, I will gladly help!", "translatepress-multilingual"); ?>
87
+ <?php __("No, thanks.", "translatepress-multilingual"); ?>
88
  <?php __("Full Language Names", "translatepress-multilingual"); ?>
89
  <?php __("Short Language Names", "translatepress-multilingual"); ?>
90
  <?php __("Flags with Full Language Names", "translatepress-multilingual"); ?>
380
  <?php __("Google Translate API Key", "translatepress-multilingual"); ?>
381
  <?php __("Visit <a href=\"https://cloud.google.com/docs/authentication/api-keys\" target=\"_blank\">this link</a> to see how you can set up an API key, <strong>control API costs</strong> and set HTTP referrer restrictions.", "translatepress-multilingual"); ?>
382
  <?php __("Your HTTP referrer is: %s", "translatepress-multilingual"); ?>
383
+ <?php __("There was an error on the server processing your Google Translate key.", "translatepress-multilingual"); ?>
384
+ <?php __("There was an error with your Google Translate key.", "translatepress-multilingual"); ?>
385
  <?php __("Human reviewed", "translatepress-multilingual"); ?>
386
  <?php __("Automatically translated", "translatepress-multilingual"); ?>
387
  <?php __("Not translated", "translatepress-multilingual"); ?>
languages/translatepress-multilingual.pot CHANGED
@@ -189,7 +189,7 @@ msgstr ""
189
  msgid "Automatic translation has been disabled."
190
  msgstr ""
191
 
192
- #: includes/class-error-manager.php:129, includes/class-plugin-notices.php:340, includes/class-plugin-notices.php:391, includes/class-plugin-notices.php:372, includes/class-plugin-notices.php:405, includes/class-plugin-notices.php:430, includes/class-plugin-notices.php:454
193
  msgid "Dismiss this notice."
194
  msgstr ""
195
 
@@ -293,38 +293,70 @@ msgstr ""
293
  msgid "The selected automatic translation engine does not provide support for these languages.<br>You can still manually translate pages in these languages using the Translation Editor."
294
  msgstr ""
295
 
296
- #: includes/class-plugin-notices.php:338
 
 
 
 
 
 
 
 
297
  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."
298
  msgstr ""
299
 
300
- #: includes/class-plugin-notices.php:387
301
  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."
302
  msgstr ""
303
 
304
- #: includes/class-plugin-notices.php:366
305
  msgid "Something went wrong, please try again."
306
  msgstr ""
307
 
308
- #: includes/class-plugin-notices.php:364
309
  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"
310
  msgstr ""
311
 
312
- #: includes/class-plugin-notices.php:362
313
  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"
314
  msgstr ""
315
 
316
- #: includes/class-plugin-notices.php:403
317
  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."
318
  msgstr ""
319
 
320
- #: includes/class-plugin-notices.php:427
321
  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."
322
  msgstr ""
323
 
324
- #: includes/class-plugin-notices.php:451
325
  msgid "One or more languages are unsupported by the automatic translation provider. Please check the <strong>TranslatePress -> <a href=\"%s\">Automatic Translation</a></strong> page for more information."
326
  msgstr ""
327
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
  #: includes/class-settings.php:26
329
  msgid "Full Language Names"
330
  msgstr ""
@@ -397,11 +429,11 @@ msgstr ""
397
  msgid "License"
398
  msgstr ""
399
 
400
- #: includes/class-settings.php:563, includes/class-translation-manager.php:470
401
  msgid "Settings"
402
  msgstr ""
403
 
404
- #: includes/class-settings.php:567
405
  msgid "Pro Features"
406
  msgstr ""
407
 
@@ -1498,18 +1530,26 @@ msgstr ""
1498
  msgid "Google Translate v2"
1499
  msgstr ""
1500
 
1501
- #: includes/google-translate/functions.php:17
1502
  msgid "Google Translate API Key"
1503
  msgstr ""
1504
 
1505
- #: includes/google-translate/functions.php:21
1506
  msgid "Visit <a href=\"https://cloud.google.com/docs/authentication/api-keys\" target=\"_blank\">this link</a> to see how you can set up an API key, <strong>control API costs</strong> and set HTTP referrer restrictions."
1507
  msgstr ""
1508
 
1509
- #: includes/google-translate/functions.php:22
1510
  msgid "Your HTTP referrer is: %s"
1511
  msgstr ""
1512
 
 
 
 
 
 
 
 
 
1513
  #: includes/string-translation/class-string-translation.php:155
1514
  msgid "Human reviewed"
1515
  msgstr ""
189
  msgid "Automatic translation has been disabled."
190
  msgstr ""
191
 
192
+ #: includes/class-error-manager.php:129, includes/class-plugin-notices.php:341, includes/class-plugin-notices.php:392, includes/class-plugin-notices.php:373, includes/class-plugin-notices.php:406, includes/class-plugin-notices.php:431, includes/class-plugin-notices.php:455, includes/class-reviews.php:119, includes/class-reviews.php:122
193
  msgid "Dismiss this notice."
194
  msgstr ""
195
 
293
  msgid "The selected automatic translation engine does not provide support for these languages.<br>You can still manually translate pages in these languages using the Translation Editor."
294
  msgstr ""
295
 
296
+ #: includes/class-machine-translator.php:129
297
+ msgid "Please enter your Google Translate key."
298
+ msgstr ""
299
+
300
+ #: includes/class-machine-translator.php:144
301
+ msgid "Please enter your DeepL API key."
302
+ msgstr ""
303
+
304
+ #: includes/class-plugin-notices.php:339
305
  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."
306
  msgstr ""
307
 
308
+ #: includes/class-plugin-notices.php:388
309
  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."
310
  msgstr ""
311
 
312
+ #: includes/class-plugin-notices.php:367
313
  msgid "Something went wrong, please try again."
314
  msgstr ""
315
 
316
+ #: includes/class-plugin-notices.php:365
317
  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"
318
  msgstr ""
319
 
320
+ #: includes/class-plugin-notices.php:363
321
  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"
322
  msgstr ""
323
 
324
+ #: includes/class-plugin-notices.php:404
325
  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."
326
  msgstr ""
327
 
328
+ #: includes/class-plugin-notices.php:428
329
  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."
330
  msgstr ""
331
 
332
+ #: includes/class-plugin-notices.php:452
333
  msgid "One or more languages are unsupported by the automatic translation provider. Please check the <strong>TranslatePress -> <a href=\"%s\">Automatic Translation</a></strong> page for more information."
334
  msgstr ""
335
 
336
+ #: includes/class-reviews.php:105
337
+ msgid "Hello! Seems like you've been using <strong>TranslatePress</strong> for a while now to translate your website. That's awesome! "
338
+ msgstr ""
339
+
340
+ #: includes/class-reviews.php:109
341
+ msgid "If you can spare a few moments to rate it on WordPress.org it would help us a lot (and boost my motivation)."
342
+ msgstr ""
343
+
344
+ #: includes/class-reviews.php:113
345
+ msgid "~ Razvan, developer of TranslatePress"
346
+ msgstr ""
347
+
348
+ #: includes/class-reviews.php:118
349
+ msgid "Rate TranslatePress on WordPress.org plugin page"
350
+ msgstr ""
351
+
352
+ #: includes/class-reviews.php:118
353
+ msgid "Ok, I will gladly help!"
354
+ msgstr ""
355
+
356
+ #: includes/class-reviews.php:119
357
+ msgid "No, thanks."
358
+ msgstr ""
359
+
360
  #: includes/class-settings.php:26
361
  msgid "Full Language Names"
362
  msgstr ""
429
  msgid "License"
430
  msgstr ""
431
 
432
+ #: includes/class-settings.php:579, includes/class-translation-manager.php:470
433
  msgid "Settings"
434
  msgstr ""
435
 
436
+ #: includes/class-settings.php:583
437
  msgid "Pro Features"
438
  msgstr ""
439
 
1530
  msgid "Google Translate v2"
1531
  msgstr ""
1532
 
1533
+ #: includes/google-translate/functions.php:38
1534
  msgid "Google Translate API Key"
1535
  msgstr ""
1536
 
1537
+ #: includes/google-translate/functions.php:58
1538
  msgid "Visit <a href=\"https://cloud.google.com/docs/authentication/api-keys\" target=\"_blank\">this link</a> to see how you can set up an API key, <strong>control API costs</strong> and set HTTP referrer restrictions."
1539
  msgstr ""
1540
 
1541
+ #: includes/google-translate/functions.php:59
1542
  msgid "Your HTTP referrer is: %s"
1543
  msgstr ""
1544
 
1545
+ #: includes/google-translate/functions.php:98
1546
+ msgid "There was an error on the server processing your Google Translate key."
1547
+ msgstr ""
1548
+
1549
+ #: includes/google-translate/functions.php:95
1550
+ msgid "There was an error with your Google Translate key."
1551
+ msgstr ""
1552
+
1553
  #: includes/string-translation/class-string-translation.php:155
1554
  msgid "Human reviewed"
1555
  msgstr ""
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: translate, translation, multilingual, automatic translation, bilingual, fr
5
  Requires at least: 3.1.0
6
  Tested up to: 5.7
7
  Requires PHP: 5.6.20
8
- Stable tag: 1.9.7
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -138,6 +138,13 @@ For more information please check out our [documentation](https://translatepress
138
 
139
 
140
  == Changelog ==
 
 
 
 
 
 
 
141
  = 1.9.7 =
142
  * Compatibility with Woocommerce Product Search plugin
143
  * Fixed some cases where JSON was broken in translated pages
5
  Requires at least: 3.1.0
6
  Tested up to: 5.7
7
  Requires PHP: 5.6.20
8
+ Stable tag: 1.9.8
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
138
 
139
 
140
  == Changelog ==
141
+ = 1.9.8 =
142
+ * Added compatibility with Google Site Kit plugin
143
+ * Added compatibility with Ivory Search plugin and possibly others
144
+ * Added visual feedback for inserting correct Automatic Translation API key
145
+ * Added hooks when saving translations in Editor
146
+ * Fixed notice in trp-ajax file
147
+
148
  = 1.9.7 =
149
  * Compatibility with Woocommerce Product Search plugin
150
  * Fixed some cases where JSON was broken in translated pages