TranslatePress – Translate Multilingual sites - Version 2.2.5

Version Description

  • Fixed span tag appearing in WooCommerce Orders in WP Dashboard
  • Fixed warnings from The Event Calendar about SQL commands
  • Fixed errors appearing in logs when using custom integration code
Download this release

Release Info

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

Code changes from version 2.2.4 to 2.2.5

class-translate-press.php CHANGED
@@ -60,7 +60,7 @@ class TRP_Translate_Press{
60
  define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
61
  define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
62
  define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
63
- define( 'TRP_PLUGIN_VERSION', '2.2.4' );
64
 
65
  wp_cache_add_non_persistent_groups(array('trp'));
66
 
60
  define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
61
  define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
62
  define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
63
+ define( 'TRP_PLUGIN_VERSION', '2.2.5' );
64
 
65
  wp_cache_add_non_persistent_groups(array('trp'));
66
 
includes/class-translation-render.php CHANGED
@@ -1362,7 +1362,7 @@ class TRP_Translation_Render{
1362
  }
1363
 
1364
  $translated_strings = array();
1365
- $machine_translation_available = $this->machine_translator->is_available( array( $this->settings['default-language'], $language_code ));
1366
 
1367
  if ( ! $this->trp_query ) {
1368
  $trp = TRP_Translate_Press::get_trp_instance();
1362
  }
1363
 
1364
  $translated_strings = array();
1365
+ $machine_translation_available = $this->machine_translator ? $this->machine_translator->is_available( array( $this->settings['default-language'], $language_code )) : false;
1366
 
1367
  if ( ! $this->trp_query ) {
1368
  $trp = TRP_Translate_Press::get_trp_instance();
includes/compatibility-functions.php CHANGED
@@ -250,13 +250,14 @@ function trp_woo_skip_dynamic_translation( $skip_selectors ){
250
  /**
251
  * Prevent translation of names and addresses in WooCommerce emails.
252
  */
253
- if( class_exists( 'WooCommerce' ) ){
 
254
  add_filter( 'woocommerce_order_get_formatted_shipping_address', 'trp_woo_address_no_translate', 10, 3 );
255
  add_filter( 'woocommerce_order_get_formatted_billing_address', 'trp_woo_address_no_translate', 10, 3 );
 
256
 
257
- function trp_woo_address_no_translate( $address, $raw_address, $order ){
258
- return empty( $address ) ? $address : '<span data-no-translation>' . $address . '</span>';
259
- }
260
  }
261
 
262
  /**
@@ -1249,6 +1250,8 @@ function trp_add_current_menu_item_css_class( $items ){
1249
  $trp_settings = $trp->get_component( 'settings' );
1250
  $settings = $trp_settings->get_settings();
1251
 
 
 
1252
  foreach( $items as $item ){
1253
  if ( !( $TRP_LANGUAGE === $settings['default-language'] && isset( $settings['add-subdirectory-to-default-language']) && $settings['add-subdirectory-to-default-language'] !== 'yes' ) &&
1254
  !in_array( 'current-menu-item', $item->classes ) && !in_array( 'menu-item-object-language_switcher', $item->classes ) && ( !empty($item->url) && $item->url !== '#')
@@ -1273,9 +1276,22 @@ function trp_add_current_menu_item_css_class( $items ){
1273
  }
1274
  }
1275
  }
 
 
1276
  return $items;
1277
  }
1278
 
 
 
 
 
 
 
 
 
 
 
 
1279
 
1280
  /**
1281
  * Compatibility with xstore theme ajax search on other languages than english and when automatic translation was on
250
  /**
251
  * Prevent translation of names and addresses in WooCommerce emails.
252
  */
253
+ add_action( 'woocommerce_email_customer_details', 'trp_woo_prevent_address_from_translation_in_emails' );
254
+ function trp_woo_prevent_address_from_translation_in_emails(){
255
  add_filter( 'woocommerce_order_get_formatted_shipping_address', 'trp_woo_address_no_translate', 10, 3 );
256
  add_filter( 'woocommerce_order_get_formatted_billing_address', 'trp_woo_address_no_translate', 10, 3 );
257
+ }
258
 
259
+ function trp_woo_address_no_translate( $address, $raw_address, $order ){
260
+ return empty( $address ) ? $address : '<span data-no-translation>' . $address . '</span>';
 
261
  }
262
 
263
  /**
1250
  $trp_settings = $trp->get_component( 'settings' );
1251
  $settings = $trp_settings->get_settings();
1252
 
1253
+ add_filter('pre_get_posts', 'trp_the_event_calendar_set_query_to_true', 2, 1);
1254
+
1255
  foreach( $items as $item ){
1256
  if ( !( $TRP_LANGUAGE === $settings['default-language'] && isset( $settings['add-subdirectory-to-default-language']) && $settings['add-subdirectory-to-default-language'] !== 'yes' ) &&
1257
  !in_array( 'current-menu-item', $item->classes ) && !in_array( 'menu-item-object-language_switcher', $item->classes ) && ( !empty($item->url) && $item->url !== '#')
1276
  }
1277
  }
1278
  }
1279
+
1280
+ remove_filter('pre_get_posts', 'trp_the_event_calendar_set_query_to_true', 2);
1281
  return $items;
1282
  }
1283
 
1284
+ /**
1285
+ * Function needed to set tribe_suppress_query_filters to false in query in order to avoid errors with The Event Calendar
1286
+ *
1287
+ * @param $query
1288
+ * @return mixed
1289
+ */
1290
+ function trp_the_event_calendar_set_query_to_true($query){
1291
+ $query->set('tribe_suppress_query_filters', false);
1292
+
1293
+ return $query;
1294
+ }
1295
 
1296
  /**
1297
  * Compatibility with xstore theme ajax search on other languages than english and when automatic translation was on
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: 2.2.4
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: 6.3.1
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: 2.2.5
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: 6.4.1
14
 
15
  == Copyright ==
16
  Copyright 2017 Cozmoslabs (www.cozmoslabs.com)
languages/translatepress-multilingual.pot CHANGED
@@ -905,7 +905,7 @@ msgstr ""
905
  msgid "<strong>TranslatePress</strong> requires <strong><a href=\"http://php.net/manual/en/book.mbstring.php\">Multibyte String PHP library</a></strong>. Please contact your server administrator to install it on your server."
906
  msgstr ""
907
 
908
- #: includes/compatibility-functions.php:1507
909
  msgid "Detected long query limitation on WPEngine hosting. Some large pages may appear untranslated. You can remove limitation by adding the following to your site’s wp-config.php: define( 'WPE_GOVERNOR', false ); "
910
  msgstr ""
911
 
905
  msgid "<strong>TranslatePress</strong> requires <strong><a href=\"http://php.net/manual/en/book.mbstring.php\">Multibyte String PHP library</a></strong>. Please contact your server administrator to install it on your server."
906
  msgstr ""
907
 
908
+ #: includes/compatibility-functions.php:1523
909
  msgid "Detected long query limitation on WPEngine hosting. Some large pages may appear untranslated. You can remove limitation by adding the following to your site’s wp-config.php: define( 'WPE_GOVERNOR', false ); "
910
  msgstr ""
911
 
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: cozmoslabs, razvan.mo, madalin.ungureanu, sareiodata, 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.9.2
7
  Requires PHP: 5.6.20
8
- Stable tag: 2.2.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -140,6 +140,11 @@ For more information please check out our [documentation](https://translatepress
140
 
141
 
142
  == Changelog ==
 
 
 
 
 
143
  = 2.2.4 =
144
  * Prevent automatic translation of names and addresses in WooCommerce emails
145
  * Added external function for devs to easily create custom language switchers: trp_custom_language_switcher
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.9.3
7
  Requires PHP: 5.6.20
8
+ Stable tag: 2.2.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
140
 
141
 
142
  == Changelog ==
143
+ = 2.2.5 =
144
+ * Fixed span tag appearing in WooCommerce Orders in WP Dashboard
145
+ * Fixed warnings from The Event Calendar about SQL commands
146
+ * Fixed errors appearing in logs when using custom integration code
147
+
148
  = 2.2.4 =
149
  * Prevent automatic translation of names and addresses in WooCommerce emails
150
  * Added external function for devs to easily create custom language switchers: trp_custom_language_switcher