TranslatePress – Translate Multilingual sites - Version 2.4.2

Version Description

  • Fixed issues with changing language on websites with persistent object caching
  • Added filter on absolute home url
Download this release

Release Info

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

Code changes from version 2.4.1 to 2.4.2

class-translate-press.php CHANGED
@@ -64,7 +64,7 @@ class TRP_Translate_Press{
64
  define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
65
  define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
66
  define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
67
- define( 'TRP_PLUGIN_VERSION', '2.4.1' );
68
 
69
  wp_cache_add_non_persistent_groups(array('trp'));
70
 
@@ -395,7 +395,9 @@ class TRP_Translate_Press{
395
 
396
  /* handle dynamic texts with gettext */
397
  $this->loader->add_filter( 'locale', $this->languages, 'change_locale', 99999 );
 
398
  $this->loader->add_filter( 'plugin_locale', $this->languages, 'change_locale', 99999 );
 
399
 
400
  $this->loader->add_action( 'init', $this->gettext_manager, 'create_gettext_translated_global' );
401
  $this->loader->add_action( 'init', $this->gettext_manager, 'initialize_gettext_processing' );
64
  define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
65
  define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
66
  define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
67
+ define( 'TRP_PLUGIN_VERSION', '2.4.2' );
68
 
69
  wp_cache_add_non_persistent_groups(array('trp'));
70
 
395
 
396
  /* handle dynamic texts with gettext */
397
  $this->loader->add_filter( 'locale', $this->languages, 'change_locale', 99999 );
398
+ $this->loader->add_filter( 'locale', $this->languages, 'clear_cache_locale', 99998 );
399
  $this->loader->add_filter( 'plugin_locale', $this->languages, 'change_locale', 99999 );
400
+ $this->loader->add_filter( 'plugin_locale', $this->languages, 'clear_cache_locale', 99998 );
401
 
402
  $this->loader->add_action( 'init', $this->gettext_manager, 'create_gettext_translated_global' );
403
  $this->loader->add_action( 'init', $this->gettext_manager, 'initialize_gettext_processing' );
includes/class-languages.php CHANGED
@@ -31,6 +31,20 @@ class TRP_Languages{
31
  return apply_filters( 'trp_languages', $this->languages[$english_or_native_name], $english_or_native_name );
32
  }
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  /** Set proper locale when changing languages with translatepress
35
  *
36
  * @param $locale
@@ -38,6 +52,7 @@ class TRP_Languages{
38
  */
39
  public function change_locale( $locale ){
40
  $cache_key = 'trp_locale';
 
41
  $locale_cache = wp_cache_get( $cache_key );
42
  if (false !== $locale_cache){
43
  return $locale_cache;
31
  return apply_filters( 'trp_languages', $this->languages[$english_or_native_name], $english_or_native_name );
32
  }
33
 
34
+ /**Function that clear cache from the key trp_locale because it was retained over page reloads.
35
+ * @param $locale
36
+ * @return void
37
+ */
38
+ public function clear_cache_locale( $locale ){
39
+
40
+ wp_cache_delete( 'trp_locale' );
41
+
42
+ remove_filter('locale', array($this, 'clear_cache_locale'), 99998);
43
+ remove_filter('plugin_locale', array($this, 'clear_cache_locale'), 99998);
44
+
45
+ return $locale;
46
+ }
47
+
48
  /** Set proper locale when changing languages with translatepress
49
  *
50
  * @param $locale
52
  */
53
  public function change_locale( $locale ){
54
  $cache_key = 'trp_locale';
55
+
56
  $locale_cache = wp_cache_get( $cache_key );
57
  if (false !== $locale_cache){
58
  return $locale_cache;
includes/class-url-converter.php CHANGED
@@ -683,7 +683,9 @@ class TRP_Url_Converter {
683
  }
684
  }
685
 
686
- wp_cache_set( 'get_abs_home', $this->absolute_home, 'trp' );
 
 
687
 
688
  return $this->absolute_home;
689
  }
683
  }
684
  }
685
 
686
+ $this->absolute_home = apply_filters('trp_filter_absolute_home_result', $this->absolute_home);
687
+
688
+ wp_cache_set( 'get_abs_home', $this->absolute_home, 'trp' );
689
 
690
  return $this->absolute_home;
691
  }
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: 2.4.1
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: 2.4.2
7
  Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
8
  Author URI: https://cozmoslabs.com/
9
  Text Domain: translatepress-multilingual
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: 6.1
7
  Requires PHP: 5.6.20
8
- Stable tag: 2.4.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -140,6 +140,10 @@ For more information please check out our [documentation](https://translatepress
140
 
141
 
142
  == Changelog ==
 
 
 
 
143
  = 2.4.1 =
144
  * Added preferred language field in WP edit user profile form, to be used in emails
145
  * Improved updating and optimizing database tool by communicating possible errors if they occur
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: 6.1.1
7
  Requires PHP: 5.6.20
8
+ Stable tag: 2.4.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
140
 
141
 
142
  == Changelog ==
143
+ = 2.4.2 =
144
+ * Fixed issues with changing language on websites with persistent object caching
145
+ * Added filter on absolute home url
146
+
147
  = 2.4.1 =
148
  * Added preferred language field in WP edit user profile form, to be used in emails
149
  * Improved updating and optimizing database tool by communicating possible errors if they occur