TranslatePress – Translate Multilingual sites - Version 1.2.6

Version Description

  • Refactored determining language, redirecting and cookie adding
  • Removed leftover trp-gettext tags when WooCommerce is active on some pages
  • Fixed get_url_for_language function that was having problems in some cases.
Download this release

Release Info

Developer madalin.ungureanu
Plugin Icon 128x128 TranslatePress – Translate Multilingual sites
Version 1.2.6
Comparing to
See all releases

Code changes from version 1.2.5 to 1.2.6

class-translate-press.php CHANGED
@@ -39,7 +39,7 @@ class TRP_Translate_Press{
39
  define( 'TRP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
40
  define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
41
  define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
42
- define( 'TRP_PLUGIN_VERSION', '1.2.5' );
43
 
44
  $this->load_dependencies();
45
  $this->initialize_components();
@@ -87,7 +87,7 @@ class TRP_Translate_Press{
87
  $this->settings = new TRP_Settings();
88
  $this->translation_render = new TRP_Translation_Render( $this->settings->get_settings() );
89
  $this->url_converter = new TRP_Url_Converter( $this->settings->get_settings() );
90
- $this->language_switcher = new TRP_Language_Switcher( $this->settings->get_settings(), $this->url_converter );
91
  $this->query = new TRP_Query( $this->settings->get_settings() );
92
  $this->machine_translator = new TRP_Machine_Translator( $this->settings->get_settings() );
93
  $this->translation_manager = new TRP_Translation_Manager( $this->settings->get_settings() );
@@ -156,7 +156,6 @@ class TRP_Translate_Press{
156
 
157
 
158
 
159
- $this->loader->add_action( 'template_redirect', $this->url_converter, 'redirect_to_default_language' );
160
  $this->loader->add_filter( 'home_url', $this->url_converter, 'add_language_to_home_url', 1, 4 );
161
  $this->loader->add_action( 'wp_head', $this->url_converter, 'add_hreflang_to_head' );
162
  $this->loader->add_filter( 'language_attributes', $this->url_converter, 'change_lang_attr_in_html_tag', 10, 1 );
39
  define( 'TRP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
40
  define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
41
  define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
42
+ define( 'TRP_PLUGIN_VERSION', '1.2.6' );
43
 
44
  $this->load_dependencies();
45
  $this->initialize_components();
87
  $this->settings = new TRP_Settings();
88
  $this->translation_render = new TRP_Translation_Render( $this->settings->get_settings() );
89
  $this->url_converter = new TRP_Url_Converter( $this->settings->get_settings() );
90
+ $this->language_switcher = new TRP_Language_Switcher( $this->settings->get_settings(), $this );
91
  $this->query = new TRP_Query( $this->settings->get_settings() );
92
  $this->machine_translator = new TRP_Machine_Translator( $this->settings->get_settings() );
93
  $this->translation_manager = new TRP_Translation_Manager( $this->settings->get_settings() );
156
 
157
 
158
 
 
159
  $this->loader->add_filter( 'home_url', $this->url_converter, 'add_language_to_home_url', 1, 4 );
160
  $this->loader->add_action( 'wp_head', $this->url_converter, 'add_hreflang_to_head' );
161
  $this->loader->add_filter( 'language_attributes', $this->url_converter, 'change_lang_attr_in_html_tag', 10, 1 );
includes/class-language-switcher.php CHANGED
@@ -8,9 +8,13 @@
8
  class TRP_Language_Switcher{
9
 
10
  protected $settings;
 
11
  protected $url_converter;
12
  protected $trp_settings_object;
 
13
  protected $trp_languages;
 
 
14
 
15
  /**
16
  * TRP_Language_Switcher constructor.
@@ -18,80 +22,140 @@ class TRP_Language_Switcher{
18
  * @param array $settings Settings option.
19
  * @param $url_converter $TRP_Url_Converter object.
20
  */
21
- public function __construct( $settings, $url_converter ){
22
  $this->settings = $settings;
23
- $this->url_converter = $url_converter;
24
- $language = $this->get_current_language();
 
25
  global $TRP_LANGUAGE;
26
  $TRP_LANGUAGE = $language;
27
- $this->add_cookie( $TRP_LANGUAGE );
28
  add_filter( 'get_user_option_metaboxhidden_nav-menus', array( $this, 'cpt_always_visible_in_menus' ), 10, 3 );
29
  }
30
 
31
- /**
32
- * Returns HTML for shortcode language switcher.
33
  *
34
- * Only shows published languages.
35
- * Takes into account shortcode flags and name options.
36
- * Runs an output buffer on 'partials/language-switcher-shortcode.php'.
37
  *
38
- * @return string HTML for shortcode language switcher
39
- */
40
- public function language_switcher(){
41
- ob_start();
42
-
43
- global $TRP_LANGUAGE;
44
-
45
- if ( ! $this->trp_languages ){
46
- $trp = TRP_Translate_Press::get_trp_instance();
47
- $this->trp_languages = $trp->get_component( 'languages' );
 
 
 
 
 
 
 
 
 
 
48
  }
49
- $published_languages = $this->trp_languages->get_language_names( $this->settings['publish-languages'] );
50
 
51
- $current_language = array();
52
- $other_languages = array();
 
53
 
54
- foreach( $published_languages as $code => $name ) {
55
- if( $code == $TRP_LANGUAGE ) {
56
- $current_language['code'] = $code;
57
- $current_language['name'] = $name;
58
- } else {
59
- $other_languages[$code] = $name;
60
- }
61
- }
62
-
63
- if( ! $this->trp_settings_object ) {
64
- $trp = TRP_Translate_Press::get_trp_instance();
65
- $this->trp_settings_object = $trp->get_component( 'settings' );
66
- }
67
- $ls_options = $this->trp_settings_object->get_language_switcher_options();
68
- $shortcode_settings = $ls_options[$this->settings['shortcode-options']];
69
-
70
- require TRP_PLUGIN_DIR . 'partials/language-switcher-shortcode.php';
71
-
72
- return ob_get_clean();
73
  }
74
 
75
- /**
76
- * Returns a valid current language code.
77
- *
78
- * $_REQUEST['lang'] is prioritized over current url encoding.
79
- * Returns default language if nothing is found.
80
- *
81
- * @return string Current language code.
82
- */
83
- private function get_current_language(){
84
- $lang_from_url = $this->url_converter->get_lang_from_url_string();
85
- if ( $lang_from_url != null ){
86
- return $lang_from_url;
87
- }
88
- if ( $this->settings['add-subdirectory-to-default-language'] == 'yes' && isset( $this->settings['translation-languages'][0] ) ) {
89
- return $this->settings['translation-languages'][0];
90
- }else{
91
- return $this->settings['default-language'];
92
- }
93
  }
94
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  /**
96
  * Enqueue language switcher scripts and styles.
97
  *
@@ -378,15 +442,5 @@ class TRP_Language_Switcher{
378
  return $items;
379
  }
380
 
381
- /**
382
- * Adds cookie with language
383
- *
384
- * @param string $current_language Current language code.
385
- */
386
- public function add_cookie( $current_language ) {
387
-
388
- setcookie( 'trp_current_language', $current_language, strtotime( '+30 days' ), "/" );
389
-
390
- }
391
 
392
  }
8
  class TRP_Language_Switcher{
9
 
10
  protected $settings;
11
+ /** @var TRP_Url_Converter */
12
  protected $url_converter;
13
  protected $trp_settings_object;
14
+ /** @var TRP_Languages */
15
  protected $trp_languages;
16
+ /** @var TRP_Translate_Press */
17
+ protected $trp;
18
 
19
  /**
20
  * TRP_Language_Switcher constructor.
22
  * @param array $settings Settings option.
23
  * @param $url_converter $TRP_Url_Converter object.
24
  */
25
+ public function __construct( $settings, $trp ){
26
  $this->settings = $settings;
27
+ $this->trp = $trp;
28
+ $this->url_converter = $this->trp->get_component( 'url_converter' );
29
+ $language = $this->get_current_language($trp);
30
  global $TRP_LANGUAGE;
31
  $TRP_LANGUAGE = $language;
 
32
  add_filter( 'get_user_option_metaboxhidden_nav-menus', array( $this, 'cpt_always_visible_in_menus' ), 10, 3 );
33
  }
34
 
35
+ /**
36
+ * Returns a valid current language code.
37
  *
38
+ * Adds cookie, adds filter for redirect if necessary
 
 
39
  *
40
+ * @param $trp TRP_Translate_Press TRP singleton object
41
+ *
42
+ * @return string Language code
43
+ */
44
+ private function get_current_language( $trp ){
45
+ $language_from_url = $this->url_converter->get_lang_from_url_string();
46
+
47
+ $needed_language = $this->determine_needed_language( $language_from_url, $trp );
48
+
49
+ if ( ( $language_from_url == null && isset( $this->settings['add-subdirectory-to-default-language'] ) && $this->settings['add-subdirectory-to-default-language'] == 'yes' ) ||
50
+ ( $language_from_url == null && $needed_language != $this->settings['default-language'] ) ||
51
+ ( $language_from_url != null && $needed_language != $language_from_url )
52
+ ){
53
+ // compatibility with Elementor preview. Do not redirect to subdir language when elementor preview is present.
54
+ // TODO: move to compatibility file in the future.
55
+ if ( ! isset( $_GET['elementor-preview'] ) ) {
56
+ global $TRP_NEEDED_LANGUAGE;
57
+ $TRP_NEEDED_LANGUAGE = $needed_language;
58
+ add_filter( 'template_redirect', array( $this, 'redirect_to_correct_language' ) );
59
+ }
60
  }
 
61
 
62
+ $this->add_cookie( $needed_language );
63
+ return $needed_language;
64
+ }
65
 
66
+ /**
67
+ * Determine the language needed.
68
+ *
69
+ * @param string $lang_from_url Language code from url
70
+ * @param TRP_Translate_Press $trp TRP singleton object
71
+ *
72
+ * @return string Language code
73
+ */
74
+ public function determine_needed_language( $lang_from_url, $trp ){
75
+ if ( $lang_from_url == null ){
76
+ if ( isset( $this->settings['add-subdirectory-to-default-language'] ) && $this->settings['add-subdirectory-to-default-language'] == 'yes' && isset( $this->settings['publish-languages'][0] ) ) {
77
+ $needed_language = $this->settings['publish-languages'][0];
78
+ }else{
79
+ $needed_language = $this->settings['default-language'];
80
+ }
81
+ }else{
82
+ $needed_language = $lang_from_url;
83
+ }
84
+ return apply_filters( 'trp_needed_language', $needed_language, $lang_from_url, $this->settings, $trp );
85
  }
86
 
87
+ /**
88
+ * Redirects to language stored in global $TRP_NEEDED_LANGUAGE
89
+ */
90
+ public function redirect_to_correct_language(){
91
+ if ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
92
+ return;
93
+ }
94
+ global $TRP_NEEDED_LANGUAGE;
95
+ if ( ! $this->url_converter ){
96
+ $trp = TRP_Translate_Press::get_trp_instance();
97
+ $this->trp_languages = $trp->get_component( 'url_converter' );
98
+ }
99
+ header( 'Location: ' . $this->url_converter->get_url_for_language( $TRP_NEEDED_LANGUAGE, null, '' ) );
100
+ exit;
 
 
 
 
101
  }
102
 
103
+ /**
104
+ * Adds cookie with language
105
+ *
106
+ * @param string $language_code Language code to add cookie for
107
+ */
108
+ public function add_cookie( $language_code ) {
109
+ if ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
110
+ return;
111
+ }
112
+ setcookie( 'trp_language', $language_code, strtotime( '+30 days' ), "/" );
113
+ }
114
+
115
+ /**
116
+ * Returns HTML for shortcode language switcher.
117
+ *
118
+ * Only shows published languages.
119
+ * Takes into account shortcode flags and name options.
120
+ * Runs an output buffer on 'partials/language-switcher-shortcode.php'.
121
+ *
122
+ * @return string HTML for shortcode language switcher
123
+ */
124
+ public function language_switcher(){
125
+ ob_start();
126
+
127
+ global $TRP_LANGUAGE;
128
+
129
+ if ( ! $this->trp_languages ){
130
+ $trp = TRP_Translate_Press::get_trp_instance();
131
+ $this->trp_languages = $trp->get_component( 'languages' );
132
+ }
133
+ $published_languages = $this->trp_languages->get_language_names( $this->settings['publish-languages'] );
134
+
135
+ $current_language = array();
136
+ $other_languages = array();
137
+
138
+ foreach( $published_languages as $code => $name ) {
139
+ if( $code == $TRP_LANGUAGE ) {
140
+ $current_language['code'] = $code;
141
+ $current_language['name'] = $name;
142
+ } else {
143
+ $other_languages[$code] = $name;
144
+ }
145
+ }
146
+
147
+ if( ! $this->trp_settings_object ) {
148
+ $trp = TRP_Translate_Press::get_trp_instance();
149
+ $this->trp_settings_object = $trp->get_component( 'settings' );
150
+ }
151
+ $ls_options = $this->trp_settings_object->get_language_switcher_options();
152
+ $shortcode_settings = $ls_options[$this->settings['shortcode-options']];
153
+
154
+ require TRP_PLUGIN_DIR . 'partials/language-switcher-shortcode.php';
155
+
156
+ return ob_get_clean();
157
+ }
158
+
159
  /**
160
  * Enqueue language switcher scripts and styles.
161
  *
442
  return $items;
443
  }
444
 
 
 
 
 
 
 
 
 
 
 
445
 
446
  }
includes/class-translation-manager.php CHANGED
@@ -728,6 +728,7 @@ class TRP_Translation_Manager{
728
  add_action( 'wp_loaded', array( $this, 'apply_gettext_filter' ) );
729
  }
730
  elseif( class_exists( 'WooCommerce' ) ){
 
731
  add_action( 'wp_loaded', array( $this, 'apply_gettext_filter' ), 19 );
732
  }//otherwise start from the wp_head hook
733
  else{
@@ -737,7 +738,9 @@ class TRP_Translation_Manager{
737
 
738
  /* apply the gettext filter here */
739
  public function apply_gettext_filter(){
740
- if( !is_admin() || $this::is_ajax_on_frontend() ) {
 
 
741
  add_filter('gettext', array($this, 'process_gettext_strings'), 100, 3);
742
  add_filter('gettext_with_context', array($this, 'process_gettext_strings_with_context'), 100, 4);
743
  add_filter('ngettext', array($this, 'process_ngettext_strings'), 100, 5);
728
  add_action( 'wp_loaded', array( $this, 'apply_gettext_filter' ) );
729
  }
730
  elseif( class_exists( 'WooCommerce' ) ){
731
+ // WooCommerce launches some ajax calls before wp_head, so we need to apply_gettext_filter earlier to catch them
732
  add_action( 'wp_loaded', array( $this, 'apply_gettext_filter' ), 19 );
733
  }//otherwise start from the wp_head hook
734
  else{
738
 
739
  /* apply the gettext filter here */
740
  public function apply_gettext_filter(){
741
+ global $pagenow;
742
+ // Do not process gettext strings on wp-login pages. Do not process strings in admin area except for when when is_ajax_on_frontend.
743
+ if( ( $pagenow != 'wp-login.php' ) && ( !is_admin() || $this::is_ajax_on_frontend() ) ) {
744
  add_filter('gettext', array($this, 'process_gettext_strings'), 100, 3);
745
  add_filter('gettext_with_context', array($this, 'process_gettext_strings_with_context'), 100, 4);
746
  add_filter('ngettext', array($this, 'process_ngettext_strings'), 100, 5);
includes/class-translation-render.php CHANGED
@@ -458,9 +458,8 @@ class TRP_Translation_Render{
458
  /* save it as a string */
459
  $trpremoved = $html->save();
460
  /* perform preg replace on the remaining trp-gettext tags */
461
- $trpremoved = preg_replace( '/(<|&lt;)trp-gettext (.*?)(>|&gt;)/', '', $trpremoved );
462
- $trpremoved = preg_replace( '/(<|&lt;)(.?)\/trp-gettext(>|&gt;)/', '', $trpremoved );
463
-
464
  $html = trp_str_get_html($trpremoved, true, true, TRP_DEFAULT_TARGET_CHARSET, false, TRP_DEFAULT_BR_TEXT, TRP_DEFAULT_SPAN_TEXT);
465
 
466
  $no_translate_selectors = apply_filters( 'trp_no_translate_selectors', array( '#wpadminbar' ), $TRP_LANGUAGE );
458
  /* save it as a string */
459
  $trpremoved = $html->save();
460
  /* perform preg replace on the remaining trp-gettext tags */
461
+ $trpremoved = preg_replace( '/(<|&lt;)trp-gettext (.*?)(>|&gt;)/', '', $trpremoved );
462
+ $trpremoved = preg_replace( '/(<|&lt;)(\\\\)*\/trp-gettext(>|&gt;)/', '', $trpremoved );
 
463
  $html = trp_str_get_html($trpremoved, true, true, TRP_DEFAULT_TARGET_CHARSET, false, TRP_DEFAULT_BR_TEXT, TRP_DEFAULT_SPAN_TEXT);
464
 
465
  $no_translate_selectors = apply_filters( 'trp_no_translate_selectors', array( '#wpadminbar' ), $TRP_LANGUAGE );
includes/class-url-converter.php CHANGED
@@ -19,37 +19,6 @@ class TRP_Url_Converter {
19
  $this->settings = $settings;
20
  }
21
 
22
- /**
23
- * Redirects to default page for default language.
24
- *
25
- * Only if settings option add-subdirectory-to-default-language is set to no.
26
- *
27
- * Hooked to template redirect.
28
- */
29
- public function redirect_to_default_language() {
30
- global $TRP_LANGUAGE;
31
- if ( isset( $this->settings['add-subdirectory-to-default-language'] ) && $this->settings['add-subdirectory-to-default-language'] == 'no' && $TRP_LANGUAGE == $this->settings['default-language'] ) {
32
- return;
33
- }
34
- $lang_from_url = $this->get_lang_from_url_string( $this->cur_page_url() );
35
-
36
- // compatibility with Elementor preview. Do not redirect to subdir language when elementor preview is present.
37
- // TODO: move to compatibility file in the future.
38
- if( isset( $_GET['elementor-preview'] ) ){
39
- return;
40
- }
41
-
42
- if ( $lang_from_url == null ) {
43
- $language_to_redirect = $this->settings['default-language'];
44
- if ( isset( $this->settings['translation-languages'][0] ) ) {
45
- $language_to_redirect = $this->settings['translation-languages'][0];
46
- }
47
- $TRP_LANGUAGE = $this->settings['default-language'];
48
- header( 'Location: ' . $this->get_url_for_language( $language_to_redirect ) );
49
- exit;
50
- }
51
- }
52
-
53
  /**
54
  * Add language code as a subdirectory after home url.
55
  *
@@ -222,8 +191,8 @@ class TRP_Url_Converter {
222
  // If no $post_id is set we simply replace the current language root with the new language root.
223
  // we can't assume the URL's have / at the end so we need to untrailingslashit both $abs_home and $new_language_root
224
  $abs_home = trailingslashit( $this->get_abs_home() );
225
-
226
- $current_lang_root = untrailingslashit($abs_home . $this->get_url_slug( $TRP_LANGUAGE ));
227
  $new_language_root = untrailingslashit($abs_home . $this->get_url_slug( $language ) );
228
 
229
  if( $this->get_lang_from_url_string($url) === null ){
@@ -232,7 +201,7 @@ class TRP_Url_Converter {
232
  } else {
233
  $new_url = str_replace($current_lang_root, $new_language_root, $url);
234
  }
235
- $new_url =apply_filters( 'trp_get_url_for_language', $new_url, $url, $language, $abs_home, $current_lang_root, $new_language_root );
236
  }
237
 
238
 
@@ -439,6 +408,5 @@ class TRP_Url_Converter {
439
  else
440
  return $rewrite_rules;
441
  }
442
-
443
 
444
  }
19
  $this->settings = $settings;
20
  }
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  /**
23
  * Add language code as a subdirectory after home url.
24
  *
191
  // If no $post_id is set we simply replace the current language root with the new language root.
192
  // we can't assume the URL's have / at the end so we need to untrailingslashit both $abs_home and $new_language_root
193
  $abs_home = trailingslashit( $this->get_abs_home() );
194
+ $current_url_language = $this->get_lang_from_url_string( $url );
195
+ $current_lang_root = untrailingslashit($abs_home . $this->get_url_slug( $current_url_language ));
196
  $new_language_root = untrailingslashit($abs_home . $this->get_url_slug( $language ) );
197
 
198
  if( $this->get_lang_from_url_string($url) === null ){
201
  } else {
202
  $new_url = str_replace($current_lang_root, $new_language_root, $url);
203
  }
204
+ $new_url = apply_filters( 'trp_get_url_for_language', $new_url, $url, $language, $abs_home, $current_lang_root, $new_language_root );
205
  }
206
 
207
 
408
  else
409
  return $rewrite_rules;
410
  }
 
411
 
412
  }
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, with full support for WooCommerce and site builders.
6
- Version: 1.2.5
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, with full support for WooCommerce and site builders.
6
+ Version: 1.2.6
7
  Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
8
  Author URI: https://cozmoslabs.com/
9
  Text Domain: translatepress-multilingual
languages/translatepress-multilingual.pot CHANGED
@@ -17,27 +17,27 @@ msgstr ""
17
  msgid "Error! Duplicate Url slug values."
18
  msgstr ""
19
 
20
- #: ../tp-add-on-navigation-based-on-language/class-navigation-based-on-language.php:85
21
  msgid "Limit this menu item to the following languages"
22
  msgstr ""
23
 
24
- #: ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:4, ../tp-add-on-extra-languages/partials/license-settings-page.php:4, ../tp-add-on-navigation-based-on-language/partials/license-settings-page.php:4, ../tp-add-on-seo-pack/partials/license-settings-page.php:4, ../translatepress/partials/addons-settings-page.php:3, ../translatepress/partials/main-settings-page.php:5, ../translatepress/partials/test-google-key-settings-page.php:17, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:4
25
  msgid "TranslatePress Settings"
26
  msgstr ""
27
 
28
- #: ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:10, ../tp-add-on-extra-languages/partials/license-settings-page.php:10, ../tp-add-on-navigation-based-on-language/partials/license-settings-page.php:10, ../tp-add-on-seo-pack/partials/license-settings-page.php:10, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:10
29
  msgid "License Key"
30
  msgstr ""
31
 
32
- #: ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:15, ../tp-add-on-extra-languages/partials/license-settings-page.php:15, ../tp-add-on-navigation-based-on-language/partials/license-settings-page.php:15, ../tp-add-on-seo-pack/partials/license-settings-page.php:15, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:15
33
  msgid "Enter your license key."
34
  msgstr ""
35
 
36
- #: ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:22, ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:31, ../tp-add-on-extra-languages/partials/license-settings-page.php:22, ../tp-add-on-extra-languages/partials/license-settings-page.php:31, ../tp-add-on-navigation-based-on-language/partials/license-settings-page.php:22, ../tp-add-on-navigation-based-on-language/partials/license-settings-page.php:31, ../tp-add-on-seo-pack/partials/license-settings-page.php:22, ../tp-add-on-seo-pack/partials/license-settings-page.php:31, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:22, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:31
37
  msgid "Activate License"
38
  msgstr ""
39
 
40
- #: ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:28, ../tp-add-on-extra-languages/partials/license-settings-page.php:28, ../tp-add-on-navigation-based-on-language/partials/license-settings-page.php:28, ../tp-add-on-seo-pack/partials/license-settings-page.php:28, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:28
41
  msgid "Deactivate License"
42
  msgstr ""
43
 
@@ -172,7 +172,7 @@ msgstr ""
172
  msgid "Settings"
173
  msgstr ""
174
 
175
- #: ../translatepress/includes/class-translation-manager.php:1114
176
  msgid "Security check"
177
  msgstr ""
178
 
17
  msgid "Error! Duplicate Url slug values."
18
  msgstr ""
19
 
20
+ #: class-navigation-based-on-language.php:85
21
  msgid "Limit this menu item to the following languages"
22
  msgstr ""
23
 
24
+ #: ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:4, ../tp-add-on-extra-languages/partials/license-settings-page.php:4, partials/license-settings-page.php:4, ../tp-add-on-seo-pack/partials/license-settings-page.php:4, ../translatepress/partials/addons-settings-page.php:3, ../translatepress/partials/main-settings-page.php:5, ../translatepress/partials/test-google-key-settings-page.php:17, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:4
25
  msgid "TranslatePress Settings"
26
  msgstr ""
27
 
28
+ #: ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:10, ../tp-add-on-extra-languages/partials/license-settings-page.php:10, partials/license-settings-page.php:10, ../tp-add-on-seo-pack/partials/license-settings-page.php:10, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:10
29
  msgid "License Key"
30
  msgstr ""
31
 
32
+ #: ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:15, ../tp-add-on-extra-languages/partials/license-settings-page.php:15, partials/license-settings-page.php:15, ../tp-add-on-seo-pack/partials/license-settings-page.php:15, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:15
33
  msgid "Enter your license key."
34
  msgstr ""
35
 
36
+ #: ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:22, ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:31, ../tp-add-on-extra-languages/partials/license-settings-page.php:22, ../tp-add-on-extra-languages/partials/license-settings-page.php:31, partials/license-settings-page.php:22, partials/license-settings-page.php:31, ../tp-add-on-seo-pack/partials/license-settings-page.php:22, ../tp-add-on-seo-pack/partials/license-settings-page.php:31, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:22, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:31
37
  msgid "Activate License"
38
  msgstr ""
39
 
40
+ #: ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:28, ../tp-add-on-extra-languages/partials/license-settings-page.php:28, partials/license-settings-page.php:28, ../tp-add-on-seo-pack/partials/license-settings-page.php:28, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:28
41
  msgid "Deactivate License"
42
  msgstr ""
43
 
172
  msgid "Settings"
173
  msgstr ""
174
 
175
+ #: ../translatepress/includes/class-translation-manager.php:1117
176
  msgid "Security check"
177
  msgstr ""
178
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: cozmoslabs, razvan.mo, madalin.ungureanu, cristophor
3
  Donate link: https://www.cozmoslabs.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: 4.9.6
7
- Stable tag: 1.2.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -117,6 +117,11 @@ For more information please check out [TranslatePress documentation](https://tra
117
  6. Menu Language Switcher
118
 
119
  == Changelog ==
 
 
 
 
 
120
  = 1.2.5 =
121
  * Fixed DOM changes script not being enqueued anymore
122
 
3
  Donate link: https://www.cozmoslabs.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: 4.9.7
7
+ Stable tag: 1.2.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
117
  6. Menu Language Switcher
118
 
119
  == Changelog ==
120
+ = 1.2.6 =
121
+ * Refactored determining language, redirecting and cookie adding
122
+ * Removed leftover trp-gettext tags when WooCommerce is active on some pages
123
+ * Fixed get_url_for_language function that was having problems in some cases.
124
+
125
  = 1.2.5 =
126
  * Fixed DOM changes script not being enqueued anymore
127