TranslatePress – Translate Multilingual sites - Version 1.3.7

Version Description

  • Fixed an issue with Woocommerce and redirects when the default language is not English
  • Speed improvements
  • Fix relative url without a trailingslash not getting a proper link back
  • Add ?trp=edit-translation=preview to ajax loaded content. Also add it to all dynamic content.
  • Added language code column in settings
  • Removed async false from JS translate-dom-changes
Download this release

Release Info

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

Code changes from version 1.3.6 to 1.3.7

assets/css/trp-back-end-style.css CHANGED
@@ -90,8 +90,8 @@ input.trp-translation-published{
90
  margin-top: 1px;
91
  }
92
 
93
- .trp-language-slug{
94
- width: 80px;
95
  }
96
 
97
  .trp-sortable-handle{
90
  margin-top: 1px;
91
  }
92
 
93
+ .trp-code-slug{
94
+ width: 65px;
95
  }
96
 
97
  .trp-sortable-handle{
assets/js/trp-back-end-script.js CHANGED
@@ -68,6 +68,9 @@ jQuery( function() {
68
  url_slug.val( _this.get_default_url_slug( new_language ) );
69
  url_slug.attr('name', 'trp_settings[url-slugs][' + new_language + ']' );
70
 
 
 
 
71
  var remove = new_option.find( '.trp-remove-language' ).toggle();
72
 
73
  new_option = jQuery( '#trp-sortable-languages' ).append( new_option );
@@ -122,6 +125,7 @@ jQuery( function() {
122
  var new_language = select.val();
123
  var row = jQuery( select ).parents( '.trp-language' ) ;
124
  row.find( '.trp-language-slug' ).attr( 'name', 'trp_settings[url-slugs][' + new_language + ']').val( '' ).val( _this.get_default_url_slug( new_language ) );
 
125
  row.find( '.trp-translation-published' ).val( new_language );
126
  };
127
 
68
  url_slug.val( _this.get_default_url_slug( new_language ) );
69
  url_slug.attr('name', 'trp_settings[url-slugs][' + new_language + ']' );
70
 
71
+ var language_code = new_option.find( 'input.trp-language-code' );
72
+ language_code.val( new_language);
73
+
74
  var remove = new_option.find( '.trp-remove-language' ).toggle();
75
 
76
  new_option = jQuery( '#trp-sortable-languages' ).append( new_option );
125
  var new_language = select.val();
126
  var row = jQuery( select ).parents( '.trp-language' ) ;
127
  row.find( '.trp-language-slug' ).attr( 'name', 'trp_settings[url-slugs][' + new_language + ']').val( '' ).val( _this.get_default_url_slug( new_language ) );
128
+ row.find( '.trp-language-code' ).val( '' ).val( new_language );
129
  row.find( '.trp-translation-published' ).val( new_language );
130
  };
131
 
assets/js/trp-iframe-preview-script.js CHANGED
@@ -94,6 +94,9 @@ var trp_preview_iframe;
94
 
95
  jQuery( function(){
96
  trp_preview_iframe = new TRP_Iframe_Preview();
 
 
 
97
  });
98
 
99
  /**
94
 
95
  jQuery( function(){
96
  trp_preview_iframe = new TRP_Iframe_Preview();
97
+ jQuery( window ).on( 'trp_page_loaded' , function(){
98
+ trp_preview_iframe.initialize();
99
+ } );
100
  });
101
 
102
  /**
assets/js/trp-translate-dom-changes.js CHANGED
@@ -23,7 +23,6 @@ function TRP_Translator(){
23
  dataType: 'json',
24
  data: {
25
  action: 'trp_get_translations',
26
- async: false,
27
  security: trp_localized_text['gettranslationsnonce'],
28
  language: language_to_query,
29
  original_language: original_language,
@@ -131,6 +130,11 @@ function TRP_Translator(){
131
  if ( mutation.addedNodes[i].textContent && _this.trim( mutation.addedNodes[i].textContent.trim(), except_characters ) != '' ) {
132
  var node = jQuery( mutation.addedNodes[i] );
133
 
 
 
 
 
 
134
  // skip nodes containing these attributes
135
  var attr_array = ['data-no-translation', 'data-no-dynamic-translation', 'data-trpgettextoriginal', 'data-trp-translate-id'];
136
  var skip_string = false;
@@ -145,10 +149,6 @@ function TRP_Translator(){
145
  continue;
146
  }
147
 
148
- /* if it is an anchor add the trp-edit-translation=preview parameter to it */
149
- if ( typeof parent.trpEditor !== 'undefined' ) {
150
- jQuery(mutation.addedNodes[i]).find('a').context.href = _this.update_query_string('trp-edit-translation', 'preview', jQuery(mutation.addedNodes[i]).find('a').context.href);
151
- }
152
  var direct_string = get_string_from_node( mutation.addedNodes[i] );
153
  if ( direct_string ) {
154
  if ( _this.trim( direct_string.textContent, except_characters ) != '' ) {
@@ -269,6 +269,7 @@ function TRP_Translator(){
269
  var settingsdata = "" + settings.data;
270
  if( typeof settings.data == 'undefined' || jQuery.isEmptyObject( settings.data ) || settingsdata.indexOf('action=trp_') === -1 ) {
271
  window.parent.jQuery('#trp-preview-iframe').trigger('load');
 
272
  }
273
  }
274
  });
23
  dataType: 'json',
24
  data: {
25
  action: 'trp_get_translations',
 
26
  security: trp_localized_text['gettranslationsnonce'],
27
  language: language_to_query,
28
  original_language: original_language,
130
  if ( mutation.addedNodes[i].textContent && _this.trim( mutation.addedNodes[i].textContent.trim(), except_characters ) != '' ) {
131
  var node = jQuery( mutation.addedNodes[i] );
132
 
133
+ /* if it is an anchor add the trp-edit-translation=preview parameter to it */
134
+ if ( typeof parent.trpEditor !== 'undefined' ) {
135
+ jQuery(mutation.addedNodes[i]).find('a').context.href = _this.update_query_string('trp-edit-translation', 'preview', jQuery(mutation.addedNodes[i]).find('a').context.href);
136
+ }
137
+
138
  // skip nodes containing these attributes
139
  var attr_array = ['data-no-translation', 'data-no-dynamic-translation', 'data-trpgettextoriginal', 'data-trp-translate-id'];
140
  var skip_string = false;
149
  continue;
150
  }
151
 
 
 
 
 
152
  var direct_string = get_string_from_node( mutation.addedNodes[i] );
153
  if ( direct_string ) {
154
  if ( _this.trim( direct_string.textContent, except_characters ) != '' ) {
269
  var settingsdata = "" + settings.data;
270
  if( typeof settings.data == 'undefined' || jQuery.isEmptyObject( settings.data ) || settingsdata.indexOf('action=trp_') === -1 ) {
271
  window.parent.jQuery('#trp-preview-iframe').trigger('load');
272
+ jQuery( window ).trigger('trp_page_loaded');
273
  }
274
  }
275
  });
class-translate-press.php CHANGED
@@ -40,7 +40,7 @@ class TRP_Translate_Press{
40
  define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
41
  define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
42
  define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
43
- define( 'TRP_PLUGIN_VERSION', '1.3.6' );
44
 
45
  $this->load_dependencies();
46
  $this->initialize_components();
40
  define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
41
  define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
42
  define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
43
+ define( 'TRP_PLUGIN_VERSION', '1.3.7' );
44
 
45
  $this->load_dependencies();
46
  $this->initialize_components();
includes/class-settings.php CHANGED
@@ -413,7 +413,7 @@ class TRP_Settings{
413
  }
414
  $all_language_codes = $this->trp_languages->get_all_language_codes();
415
  $iso_codes = $this->trp_languages->get_iso_codes( $all_language_codes, false );
416
- wp_localize_script( 'trp-settings-script', 'trp_url_slugs_info', array( 'iso_codes' => $iso_codes, 'error_message_duplicate_slugs' => __( 'Error! Duplicate Url slug values.', TRP_PLUGIN_SLUG ) ) );
417
 
418
  wp_enqueue_script( 'trp-select2-lib-js', TRP_PLUGIN_URL . 'assets/lib/select2-lib/dist/js/select2.min.js', array( 'jquery' ), TRP_PLUGIN_VERSION );
419
  wp_enqueue_style( 'trp-select2-lib-css', TRP_PLUGIN_URL . 'assets/lib/select2-lib/dist/css/select2.min.css', array(), TRP_PLUGIN_VERSION );
413
  }
414
  $all_language_codes = $this->trp_languages->get_all_language_codes();
415
  $iso_codes = $this->trp_languages->get_iso_codes( $all_language_codes, false );
416
+ wp_localize_script( 'trp-settings-script', 'trp_url_slugs_info', array( 'iso_codes' => $iso_codes, 'error_message_duplicate_slugs' => __( 'Error! Duplicate Url slug values.', 'translatepress-multilingual' ) ) );
417
 
418
  wp_enqueue_script( 'trp-select2-lib-js', TRP_PLUGIN_URL . 'assets/lib/select2-lib/dist/js/select2.min.js', array( 'jquery' ), TRP_PLUGIN_VERSION );
419
  wp_enqueue_style( 'trp-select2-lib-css', TRP_PLUGIN_URL . 'assets/lib/select2-lib/dist/css/select2.min.css', array(), TRP_PLUGIN_VERSION );
includes/class-translation-manager.php CHANGED
@@ -695,10 +695,10 @@ class TRP_Translation_Manager{
695
  * Create a global with the gettext strings that exist in the database
696
  */
697
  public function create_gettext_translated_global(){
 
698
  if( !is_admin() || $this::is_ajax_on_frontend() ) {
699
  global $TRP_LANGUAGE;
700
 
701
- global $trp_translated_gettext_texts;
702
  if (!$this->trp_query) {
703
  $trp = TRP_Translate_Press::get_trp_instance();
704
  $this->trp_query = $trp->get_component('query');
@@ -707,6 +707,11 @@ class TRP_Translation_Manager{
707
  $strings = $this->trp_query->get_all_gettext_strings($TRP_LANGUAGE);
708
  if (!empty($strings))
709
  $trp_translated_gettext_texts = $strings;
 
 
 
 
 
710
  }
711
  }
712
 
@@ -832,7 +837,6 @@ class TRP_Translation_Manager{
832
  */
833
  public function process_gettext_strings( $translation, $text, $domain ){
834
  global $TRP_LANGUAGE;
835
-
836
  /* don't do anything if we don't have extra languages on the site */
837
  if( count( $this->settings['publish-languages'] ) < 1 )
838
  return $translation;
@@ -848,6 +852,7 @@ class TRP_Translation_Manager{
848
  if ( !defined( 'DOING_AJAX' ) || $this::is_ajax_on_frontend() ) {
849
 
850
  global $trp_translated_gettext_texts, $trp_all_gettext_texts;
 
851
  $found_in_db = false;
852
  $db_id = '';
853
 
@@ -861,19 +866,17 @@ class TRP_Translation_Manager{
861
  $trp_all_gettext_texts = array();
862
 
863
  if( !empty( $trp_translated_gettext_texts ) ){
864
- foreach( $trp_translated_gettext_texts as $trp_translated_gettext_text ){
865
- if( $text == $trp_translated_gettext_text['original'] && $domain == $trp_translated_gettext_text['domain'] ){
866
- if( !empty( $trp_translated_gettext_text['translated'] ) && $translation != $trp_translated_gettext_text['translated'] ) {
867
- $translation = $trp_translated_gettext_text['translated'];
868
- }
869
- $db_id = $trp_translated_gettext_text['id'];
870
- $found_in_db = true;
871
- /* update the db if a translation appeared in the po file later */
872
- if( empty( $trp_translated_gettext_text['translated'] ) && $translation != $text ) {
873
- $this->trp_query->update_gettext_strings( array( array( 'id' => $db_id, 'original' => $text, 'translated' => $translation, 'domain' => $domain), 'status' => $this->trp_query->get_constant_human_reviewed() ), get_locale() );
874
- }
875
 
876
- break;
 
 
 
 
 
 
 
877
  }
878
  }
879
  }
@@ -883,7 +886,7 @@ class TRP_Translation_Manager{
883
  $trp_all_gettext_texts[] = array('original' => $text, 'translated' => $translation, 'domain' => $domain);
884
  $db_id = $this->trp_query->insert_gettext_strings( array( array('original' => $text, 'translated' => $translation, 'domain' => $domain) ), get_locale() );
885
  /* insert it in the global of translated because now it is in the database */
886
- $trp_translated_gettext_texts[] = array( 'id' => $db_id, 'original' => $text, 'translated' => ( $translation != $text ) ? $translation : '', 'domain' => $domain );
887
  }
888
  }
889
 
@@ -1027,7 +1030,6 @@ class TRP_Translation_Manager{
1027
  }
1028
 
1029
  $this->trp_query->update_gettext_strings( $trp_gettext_strings_for_machine_translation, $TRP_LANGUAGE );
1030
-
1031
  }
1032
  }
1033
  }
695
  * Create a global with the gettext strings that exist in the database
696
  */
697
  public function create_gettext_translated_global(){
698
+ global $trp_translated_gettext_texts;
699
  if( !is_admin() || $this::is_ajax_on_frontend() ) {
700
  global $TRP_LANGUAGE;
701
 
 
702
  if (!$this->trp_query) {
703
  $trp = TRP_Translate_Press::get_trp_instance();
704
  $this->trp_query = $trp->get_component('query');
707
  $strings = $this->trp_query->get_all_gettext_strings($TRP_LANGUAGE);
708
  if (!empty($strings))
709
  $trp_translated_gettext_texts = $strings;
710
+
711
+ foreach( $trp_translated_gettext_texts as $key => $value ){
712
+ $trp_strings[$value['domain'] . '::' . $value['original']] = $value;
713
+ }
714
+ $trp_translated_gettext_texts = $trp_strings;
715
  }
716
  }
717
 
837
  */
838
  public function process_gettext_strings( $translation, $text, $domain ){
839
  global $TRP_LANGUAGE;
 
840
  /* don't do anything if we don't have extra languages on the site */
841
  if( count( $this->settings['publish-languages'] ) < 1 )
842
  return $translation;
852
  if ( !defined( 'DOING_AJAX' ) || $this::is_ajax_on_frontend() ) {
853
 
854
  global $trp_translated_gettext_texts, $trp_all_gettext_texts;
855
+
856
  $found_in_db = false;
857
  $db_id = '';
858
 
866
  $trp_all_gettext_texts = array();
867
 
868
  if( !empty( $trp_translated_gettext_texts ) ){
869
+ if (isset($trp_translated_gettext_texts[$domain . '::' . $text])){
870
+ $trp_translated_gettext_text = $trp_translated_gettext_texts[$domain . '::' . $text];
 
 
 
 
 
 
 
 
 
871
 
872
+ if( !empty( $trp_translated_gettext_text['translated'] ) && $translation != $trp_translated_gettext_text['translated'] ) {
873
+ $translation = $trp_translated_gettext_text['translated'];
874
+ }
875
+ $db_id = $trp_translated_gettext_text['id'];
876
+ $found_in_db = true;
877
+ // update the db if a translation appeared in the po file later
878
+ if( empty( $trp_translated_gettext_text['translated'] ) && $translation != $text ) {
879
+ $this->trp_query->update_gettext_strings( array( array( 'id' => $db_id, 'original' => $text, 'translated' => $translation, 'domain' => $domain), 'status' => $this->trp_query->get_constant_human_reviewed() ), get_locale() );
880
  }
881
  }
882
  }
886
  $trp_all_gettext_texts[] = array('original' => $text, 'translated' => $translation, 'domain' => $domain);
887
  $db_id = $this->trp_query->insert_gettext_strings( array( array('original' => $text, 'translated' => $translation, 'domain' => $domain) ), get_locale() );
888
  /* insert it in the global of translated because now it is in the database */
889
+ $trp_translated_gettext_texts[$domain . '::' . $text] = array( 'id' => $db_id, 'original' => $text, 'translated' => ( $translation != $text ) ? $translation : '', 'domain' => $domain );
890
  }
891
  }
892
 
1030
  }
1031
 
1032
  $this->trp_query->update_gettext_strings( $trp_gettext_strings_for_machine_translation, $TRP_LANGUAGE );
 
1033
  }
1034
  }
1035
  }
includes/class-translation-render.php CHANGED
@@ -35,7 +35,7 @@ class TRP_Translation_Render{
35
  else {
36
  mb_http_output("UTF-8");
37
  if ( $TRP_LANGUAGE == $this->settings['default-language'] && !trp_is_translation_editor() ) {
38
- ob_start(array($this, 'clear_trp_tags'));//on default language when we are not in editor we just need to clear any trp tags that could still be present
39
  } else {
40
  ob_start(array($this, 'translate_page'));//everywhere else translate the page
41
  }
35
  else {
36
  mb_http_output("UTF-8");
37
  if ( $TRP_LANGUAGE == $this->settings['default-language'] && !trp_is_translation_editor() ) {
38
+ ob_start(array($this, 'clear_trp_tags'), 4096);//on default language when we are not in editor we just need to clear any trp tags that could still be present
39
  } else {
40
  ob_start(array($this, 'translate_page'));//everywhere else translate the page
41
  }
includes/class-url-converter.php CHANGED
@@ -138,6 +138,12 @@ class TRP_Url_Converter {
138
  $debug = false;
139
  // initializations
140
  global $TRP_LANGUAGE;
 
 
 
 
 
 
141
  $trp_language_copy = $TRP_LANGUAGE;
142
  if ( empty( $language ) ) {
143
  $language = $TRP_LANGUAGE;
@@ -145,8 +151,18 @@ class TRP_Url_Converter {
145
  if ( empty($url) ){
146
  $url = $this->cur_page_url();
147
  }
148
- $url_obj = new \TranslatePress\Uri($url);
149
- $abs_home_url_obj = new \TranslatePress\Uri( $this->get_abs_home() );
 
 
 
 
 
 
 
 
 
 
150
 
151
  if( $TRP_LANGUAGE == $this->settings['default-language'] ){
152
  $trp_link_is_processed = '';
@@ -155,44 +171,50 @@ class TRP_Url_Converter {
155
  // actual logic of the function
156
  if ( $this->url_is_file($url) ){
157
  trp_bulk_debug($debug, array('url' => $url, 'abort' => 'is file'));
 
158
  return $url . $trp_link_is_processed; //abort for files
159
  }
160
 
161
  if ( !$url_obj->isSchemeless() && $url_obj->getScheme() != 'http' && $url_obj->getScheme() != 'https' ){
162
  trp_bulk_debug($debug, array('url' => $url, 'abort' => "is different scheme ".$url_obj->getScheme()));
 
163
  return $url . $trp_link_is_processed; // abort for non-http/https links
164
  }
165
 
166
  if ( $url_obj->isSchemeless() && !$url_obj->getPath() && !$url_obj->getQuery() ){
167
  trp_bulk_debug($debug, array('url' => $url, 'abort' => "is anchor"));
 
168
  return $url; // abort for anchors
169
  }
170
 
171
  if ( $url_obj->getHost() && $abs_home_url_obj->getHost() && $url_obj->getHost() != $abs_home_url_obj->getHost() ){
172
  trp_bulk_debug($debug, array('url' => $url, 'abort' => "is external url "));
 
173
  return $url; // abort for external url's
174
  }
175
 
176
  if( $this->get_lang_from_url_string($url) === null && $this->settings['default-language'] === $language && $this->settings['add-subdirectory-to-default-language'] !== 'yes' ){
177
  trp_bulk_debug($debug, array('url' => $url, 'abort' => "URL already has the correct language added to it and default language has subdir"));
 
178
  return $url;
179
  }
180
 
181
  if( $this->get_lang_from_url_string($url) === $language ){
182
  trp_bulk_debug($debug, array('url' => $url, 'abort' => "URL already has the correct language added to it"));
 
183
  return $url;
184
  }
185
 
186
  // maybe find the post_id for the current URL
187
- $possible_post_id = url_to_postid($url);
188
  if ( $possible_post_id ){
189
  $post_id = $possible_post_id;
190
-
191
  trp_bulk_debug($debug, array('url' => $url, 'found post id' => $post_id, 'for language' => $TRP_LANGUAGE));
192
  } else {
193
  // try again but with the default language home_url
194
  $TRP_LANGUAGE = $this->settings['default-language'];
195
- $post_id = url_to_postid( $url );
 
196
  if($post_id){ trp_bulk_debug($debug, array('url' => $url, 'found post id' => $post_id, 'for default language' => $TRP_LANGUAGE)); }
197
  $TRP_LANGUAGE = $trp_language_copy;
198
  }
@@ -213,10 +235,11 @@ class TRP_Url_Converter {
213
  */
214
 
215
  $TRP_LANGUAGE = $this->get_lang_from_url_string( $url );
 
216
  $processed_permalink = get_permalink($post_id);
217
 
218
  if($url_obj->isSchemeless()){
219
- $arguments = str_replace($processed_permalink, '', trailingslashit( home_url() ) . ltrim($url, '/') );
220
  } else {
221
  $arguments = str_replace($processed_permalink, '', $url );
222
  }
@@ -226,12 +249,12 @@ class TRP_Url_Converter {
226
 
227
  $TRP_LANGUAGE = $language;
228
  $new_url = get_permalink( $post_id ) . $arguments;
229
- trp_bulk_debug($debug, array('url' => $url, 'new url' => $new_url, 'found post id' => $post_id, 'isSchemeless' => 'true', 'url type' => 'based on permalink', 'for language' => $TRP_LANGUAGE));
230
  $TRP_LANGUAGE = $trp_language_copy;
231
 
232
  } else {
233
  // we're just adding the new language to the url
234
- $new_url_obj = new \TranslatePress\Uri( $url );
235
 
236
  if( $this->get_lang_from_url_string($url) === null ){
237
  // these are the custom url. They don't have language
@@ -262,16 +285,15 @@ class TRP_Url_Converter {
262
 
263
  /* fix links for woocommerce on language switcher for product categories and product tags */
264
  if( class_exists( 'WooCommerce' ) ){
265
- $default_woocommerce_slugs = array('product-category', 'product-tag', 'product');
266
- foreach ($default_woocommerce_slugs as $default_woocommerce_slug){
267
- // if $language is provided, like on the language switcher
268
- $current_slug = trp_x( $default_woocommerce_slug, 'slug', 'woocommerce', $TRP_LANGUAGE );
269
- $translated_slug = trp_x( $default_woocommerce_slug, 'slug', 'woocommerce', $language );
270
- $new_url = str_replace( '/'.$current_slug.'/', '/'.$translated_slug.'/', $new_url );
 
271
 
272
- // if $language is initially empty, like the link was found in the menu, manually added
273
- $current_slug = $default_woocommerce_slug;
274
- $translated_slug = trp_x( $default_woocommerce_slug, 'slug', 'woocommerce', $language );
275
  $new_url = str_replace( '/'.$current_slug.'/', '/'.$translated_slug.'/', $new_url );
276
  }
277
  }
@@ -280,6 +302,7 @@ class TRP_Url_Converter {
280
  $new_url = $url;
281
  }
282
 
 
283
  return $new_url . $trp_link_is_processed ;
284
 
285
  }
@@ -329,7 +352,12 @@ class TRP_Url_Converter {
329
  * @return string
330
  */
331
  public function get_abs_home() {
332
- global $wpdb;
 
 
 
 
 
333
 
334
  // returns the unfiltered home_url by directly retrieving it from wp_options.
335
  $this->absolute_home = $this->absolute_home
@@ -352,7 +380,16 @@ class TRP_Url_Converter {
352
  if( empty($this->absolute_home) ){
353
  $this->absolute_home = get_option("siteurl");
354
  }
355
-
 
 
 
 
 
 
 
 
 
356
  return $this->absolute_home;
357
  }
358
 
@@ -368,14 +405,30 @@ class TRP_Url_Converter {
368
  if ( ! $url ){
369
  $url = $this->cur_page_url();
370
  }
371
- $url_obj = new \TranslatePress\Uri($url);
372
- $abs_home_url_obj = new \TranslatePress\Uri( $this->get_abs_home() );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
373
 
374
  if( $url_obj->getPath() ){
375
  $possible_path = str_replace($abs_home_url_obj->getPath(), '', $url_obj->getPath());
376
  $lang = ltrim( $possible_path,'/' );
377
  $lang = explode('/', $lang);
378
  if( $lang == false ){
 
379
  return null;
380
  }
381
  // If we have a language in the URL, the first element of the array should be it.
@@ -385,10 +438,12 @@ class TRP_Url_Converter {
385
 
386
  // the lang slug != actual lang. So we need to do array_search so we don't end up with en instead of en_US
387
  if( isset($this->settings['url-slugs']) && in_array($lang, $this->settings['url-slugs']) ){
388
- return array_search($lang, $this->settings['url-slugs']);
 
 
389
  }
390
  }
391
-
392
  return null;
393
  }
394
 
@@ -399,6 +454,11 @@ class TRP_Url_Converter {
399
  */
400
  public function cur_page_url() {
401
 
 
 
 
 
 
402
  $req_uri = $_SERVER['REQUEST_URI'];
403
 
404
  $home_path = trim( parse_url( $this->get_abs_home(), PHP_URL_PATH ), '/' );
@@ -411,7 +471,7 @@ class TRP_Url_Converter {
411
 
412
 
413
  if ( function_exists('apply_filters') ) $pageURL = apply_filters('trp_curpageurl', $req_uri);
414
-
415
  return $req_uri;
416
  }
417
 
138
  $debug = false;
139
  // initializations
140
  global $TRP_LANGUAGE;
141
+ $hash = hash( 'md4', (string)$language . (string)$url . (string)$trp_link_is_processed . (string)$TRP_LANGUAGE );
142
+ $new_url = wp_cache_get('get_url_for_language_' . $hash, 'trp');
143
+ if ( $new_url !== false ){
144
+ return $new_url;
145
+ }
146
+
147
  $trp_language_copy = $TRP_LANGUAGE;
148
  if ( empty( $language ) ) {
149
  $language = $TRP_LANGUAGE;
151
  if ( empty($url) ){
152
  $url = $this->cur_page_url();
153
  }
154
+
155
+ $url_obj = wp_cache_get('url_obj_' . hash('md4', $url), 'trp');
156
+ if( $url_obj === false ){
157
+ $url_obj = new \TranslatePress\Uri($url);
158
+ wp_cache_set('url_obj_' . hash('md4', $url), $url_obj, 'trp' );
159
+ }
160
+
161
+ $abs_home_url_obj = wp_cache_get('url_obj_' . hash('md4', $this->get_abs_home() ), 'trp');
162
+ if( $abs_home_url_obj === false ){
163
+ $abs_home_url_obj = new \TranslatePress\Uri( $this->get_abs_home() );
164
+ wp_cache_set('url_obj_' . hash('md4', $this->get_abs_home()), $abs_home_url_obj, 'trp' );
165
+ }
166
 
167
  if( $TRP_LANGUAGE == $this->settings['default-language'] ){
168
  $trp_link_is_processed = '';
171
  // actual logic of the function
172
  if ( $this->url_is_file($url) ){
173
  trp_bulk_debug($debug, array('url' => $url, 'abort' => 'is file'));
174
+ wp_cache_set('get_url_for_language_' . $hash, $url . $trp_link_is_processed, 'trp');
175
  return $url . $trp_link_is_processed; //abort for files
176
  }
177
 
178
  if ( !$url_obj->isSchemeless() && $url_obj->getScheme() != 'http' && $url_obj->getScheme() != 'https' ){
179
  trp_bulk_debug($debug, array('url' => $url, 'abort' => "is different scheme ".$url_obj->getScheme()));
180
+ wp_cache_set('get_url_for_language_' . $hash, $url . $trp_link_is_processed, 'trp');
181
  return $url . $trp_link_is_processed; // abort for non-http/https links
182
  }
183
 
184
  if ( $url_obj->isSchemeless() && !$url_obj->getPath() && !$url_obj->getQuery() ){
185
  trp_bulk_debug($debug, array('url' => $url, 'abort' => "is anchor"));
186
+ wp_cache_set('get_url_for_language_' . $hash, $url, 'trp');
187
  return $url; // abort for anchors
188
  }
189
 
190
  if ( $url_obj->getHost() && $abs_home_url_obj->getHost() && $url_obj->getHost() != $abs_home_url_obj->getHost() ){
191
  trp_bulk_debug($debug, array('url' => $url, 'abort' => "is external url "));
192
+ wp_cache_set('get_url_for_language_' . $hash, $url, 'trp');
193
  return $url; // abort for external url's
194
  }
195
 
196
  if( $this->get_lang_from_url_string($url) === null && $this->settings['default-language'] === $language && $this->settings['add-subdirectory-to-default-language'] !== 'yes' ){
197
  trp_bulk_debug($debug, array('url' => $url, 'abort' => "URL already has the correct language added to it and default language has subdir"));
198
+ wp_cache_set('get_url_for_language_' . $hash, $url, 'trp');
199
  return $url;
200
  }
201
 
202
  if( $this->get_lang_from_url_string($url) === $language ){
203
  trp_bulk_debug($debug, array('url' => $url, 'abort' => "URL already has the correct language added to it"));
204
+ wp_cache_set('get_url_for_language_' . $hash, $url, 'trp');
205
  return $url;
206
  }
207
 
208
  // maybe find the post_id for the current URL
209
+ $possible_post_id = wp_cache_get( 'possible_post_id_'. hash('md4', $url ), 'trp' );
210
  if ( $possible_post_id ){
211
  $post_id = $possible_post_id;
 
212
  trp_bulk_debug($debug, array('url' => $url, 'found post id' => $post_id, 'for language' => $TRP_LANGUAGE));
213
  } else {
214
  // try again but with the default language home_url
215
  $TRP_LANGUAGE = $this->settings['default-language'];
216
+ $post_id = url_to_postid( $url );
217
+ wp_cache_set( 'possible_post_id_' . hash('md4', $url ), $post_id, 'trp' );
218
  if($post_id){ trp_bulk_debug($debug, array('url' => $url, 'found post id' => $post_id, 'for default language' => $TRP_LANGUAGE)); }
219
  $TRP_LANGUAGE = $trp_language_copy;
220
  }
235
  */
236
 
237
  $TRP_LANGUAGE = $this->get_lang_from_url_string( $url );
238
+
239
  $processed_permalink = get_permalink($post_id);
240
 
241
  if($url_obj->isSchemeless()){
242
+ $arguments = str_replace(trailingslashit($processed_permalink), '', trailingslashit(trailingslashit( home_url() ) . ltrim($url, '/') ) );
243
  } else {
244
  $arguments = str_replace($processed_permalink, '', $url );
245
  }
249
 
250
  $TRP_LANGUAGE = $language;
251
  $new_url = get_permalink( $post_id ) . $arguments;
252
+ trp_bulk_debug($debug, array('url' => $url, 'new url' => $new_url, 'found post id' => $post_id, 'url type' => 'based on permalink', 'for language' => $TRP_LANGUAGE));
253
  $TRP_LANGUAGE = $trp_language_copy;
254
 
255
  } else {
256
  // we're just adding the new language to the url
257
+ $new_url_obj = $url_obj;
258
 
259
  if( $this->get_lang_from_url_string($url) === null ){
260
  // these are the custom url. They don't have language
285
 
286
  /* fix links for woocommerce on language switcher for product categories and product tags */
287
  if( class_exists( 'WooCommerce' ) ){
288
+ $english_woocommerce_slugs = array('product-category', 'product-tag', 'product');
289
+ foreach ($english_woocommerce_slugs as $english_woocommerce_slug){
290
+ // current woo slugs are based on the localized default language OR the current language
291
+ $current_slug = trp_x( $english_woocommerce_slug, 'slug', 'woocommerce', $this->settings['default-language'] );
292
+ if( strpos($new_url, '/'.$current_slug.'/') === false){
293
+ $current_slug = trp_x( $english_woocommerce_slug, 'slug', 'woocommerce', $TRP_LANGUAGE );
294
+ }
295
 
296
+ $translated_slug = trp_x( $english_woocommerce_slug, 'slug', 'woocommerce', $language );
 
 
297
  $new_url = str_replace( '/'.$current_slug.'/', '/'.$translated_slug.'/', $new_url );
298
  }
299
  }
302
  $new_url = $url;
303
  }
304
 
305
+ wp_cache_set('get_url_for_language_' . $hash, $new_url . $trp_link_is_processed, 'trp');
306
  return $new_url . $trp_link_is_processed ;
307
 
308
  }
352
  * @return string
353
  */
354
  public function get_abs_home() {
355
+ $this->absolute_home = wp_cache_get('get_abs_home', 'trp');
356
+ if ( $this->absolute_home !== false ){
357
+ return $this->absolute_home;
358
+ }
359
+
360
+ global $wpdb;
361
 
362
  // returns the unfiltered home_url by directly retrieving it from wp_options.
363
  $this->absolute_home = $this->absolute_home
380
  if( empty($this->absolute_home) ){
381
  $this->absolute_home = get_option("siteurl");
382
  }
383
+
384
+ // always return absolute_home based on the http or https version of the current page request. This means no more redirects.
385
+ if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
386
+ $this->absolute_home = str_replace( 'http://', 'https://', $this->absolute_home );
387
+ } else {
388
+ $this->absolute_home = str_replace( 'https://', 'http://', $this->absolute_home );
389
+ }
390
+
391
+ wp_cache_set( 'get_abs_home', $this->absolute_home, 'trp' );
392
+
393
  return $this->absolute_home;
394
  }
395
 
405
  if ( ! $url ){
406
  $url = $this->cur_page_url();
407
  }
408
+
409
+ $language = wp_cache_get('url_language_' . hash('md4', $url) , 'trp' );
410
+ if ( $language !== false ){
411
+ return $language;
412
+ }
413
+
414
+ $url_obj = wp_cache_get('url_obj_' . hash('md4', $url), 'trp');
415
+ if( $url_obj === false ){
416
+ $url_obj = new \TranslatePress\Uri($url);
417
+ wp_cache_set('url_obj_' . hash('md4', $url), $url_obj, 'trp' );
418
+ }
419
+
420
+ $abs_home_url_obj = wp_cache_get('url_obj_' . hash('md4', $this->get_abs_home() ), 'trp');
421
+ if( $abs_home_url_obj === false ){
422
+ $abs_home_url_obj = new \TranslatePress\Uri( $this->get_abs_home() );
423
+ wp_cache_set('url_obj_' . hash('md4', $this->get_abs_home()), $abs_home_url_obj, 'trp' );
424
+ }
425
 
426
  if( $url_obj->getPath() ){
427
  $possible_path = str_replace($abs_home_url_obj->getPath(), '', $url_obj->getPath());
428
  $lang = ltrim( $possible_path,'/' );
429
  $lang = explode('/', $lang);
430
  if( $lang == false ){
431
+ wp_cache_set('url_language_' . hash('md4', $url), null, 'trp');
432
  return null;
433
  }
434
  // If we have a language in the URL, the first element of the array should be it.
438
 
439
  // the lang slug != actual lang. So we need to do array_search so we don't end up with en instead of en_US
440
  if( isset($this->settings['url-slugs']) && in_array($lang, $this->settings['url-slugs']) ){
441
+ $language = array_search($lang, $this->settings['url-slugs']);
442
+ wp_cache_set('url_language_' . hash('md4', $url), $language, 'trp');
443
+ return $language;
444
  }
445
  }
446
+ wp_cache_set('url_language_' . hash('md4', $url), null, 'trp');
447
  return null;
448
  }
449
 
454
  */
455
  public function cur_page_url() {
456
 
457
+ $req_uri = wp_cache_get('cur_page_url', 'trp');
458
+ if ( $req_uri ){
459
+ return $req_uri;
460
+ }
461
+
462
  $req_uri = $_SERVER['REQUEST_URI'];
463
 
464
  $home_path = trim( parse_url( $this->get_abs_home(), PHP_URL_PATH ), '/' );
471
 
472
 
473
  if ( function_exists('apply_filters') ) $pageURL = apply_filters('trp_curpageurl', $req_uri);
474
+ wp_cache_set('cur_page_url', $req_uri, 'trp');
475
  return $req_uri;
476
  }
477
 
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.3.6
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.3.7
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
@@ -65,8 +65,9 @@
65
  <?php __("Page Title", "translatepress-multilingual"); ?>
66
  <?php __("<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.", "translatepress-multilingual"); ?>
67
  <?php __("All Languages", "translatepress-multilingual"); ?>
 
68
  <?php __("Select the language you wish to make your website available in.", "translatepress-multilingual"); ?>
69
- <?php __("To add <strong>more then two languages</strong> and support for SEO Title, Description, Slug and more checkout <a href=\"%s\" class=\"button button-primary\" target=\"_blank\" title=\"TranslatePress Pro\">TranslatePress PRO</a>", "translatepress-multilingual"); ?>
70
  <?php __("Not only you are getting extra features and premium support, you also help fund the future development of TranslatePress.", "translatepress-multilingual"); ?>
71
  <?php __("Default Language", "translatepress-multilingual"); ?>
72
  <?php __("Select the original language your website was written in. ", "translatepress-multilingual"); ?>
@@ -138,3 +139,6 @@
138
  <?php __("Batch size", "translatepress-multilingual"); ?>
139
  <?php __("The number of rows to check at once.<br>Choosing a smaller number helps solve the 502 error \"Page took too long to respond\" on large databases.<br>May take several minutes depending on the database size.", "translatepress-multilingual"); ?>
140
  <?php __("Remove duplicate rows", "translatepress-multilingual"); ?>
 
 
 
65
  <?php __("Page Title", "translatepress-multilingual"); ?>
66
  <?php __("<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.", "translatepress-multilingual"); ?>
67
  <?php __("All Languages", "translatepress-multilingual"); ?>
68
+ <?php __("Code", "translatepress-multilingual"); ?>
69
  <?php __("Select the language you wish to make your website available in.", "translatepress-multilingual"); ?>
70
+ <?php __("To add <strong>more then two languages</strong> and support for SEO Title, Description, Slug and more check out <a href=\"%s\" class=\"button button-primary\" target=\"_blank\" title=\"TranslatePress Pro\">TranslatePress PRO</a>", "translatepress-multilingual"); ?>
71
  <?php __("Not only you are getting extra features and premium support, you also help fund the future development of TranslatePress.", "translatepress-multilingual"); ?>
72
  <?php __("Default Language", "translatepress-multilingual"); ?>
73
  <?php __("Select the original language your website was written in. ", "translatepress-multilingual"); ?>
139
  <?php __("Batch size", "translatepress-multilingual"); ?>
140
  <?php __("The number of rows to check at once.<br>Choosing a smaller number helps solve the 502 error \"Page took too long to respond\" on large databases.<br>May take several minutes depending on the database size.", "translatepress-multilingual"); ?>
141
  <?php __("Remove duplicate rows", "translatepress-multilingual"); ?>
142
+ <?php __(" TranslatePress Settings", "translatepress-multilingual"); ?>
143
+ <?php __("Translator", "translatepress-multilingual"); ?>
144
+ <?php __("Allow this user to translate the website.", "translatepress-multilingual"); ?>
languages/translatepress-multilingual.pot CHANGED
@@ -13,11 +13,11 @@ msgstr ""
13
  "X-Poedit-SourceCharset: UTF-8\n"
14
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
 
16
- #: ../tp-add-on-extra-languages/class-extra-languages.php:57
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
 
@@ -25,51 +25,51 @@ msgstr ""
25
  msgid "The Yoast SEO Sitemaps will now contain the default language slug: example.com/en/sitemap_index.xml <br/> This works perfectly, just take it into account when you submit the sitemap to Google."
26
  msgstr ""
27
 
28
- #: includes/class-ald-settings.php:37
29
  msgid "First by browser language, then IP address (recommended)"
30
  msgstr ""
31
 
32
- #: includes/class-ald-settings.php:38
33
  msgid "First by IP address, then browser language"
34
  msgstr ""
35
 
36
- #: includes/class-ald-settings.php:39
37
  msgid "Only by browser language"
38
  msgstr ""
39
 
40
- #: includes/class-ald-settings.php:40
41
  msgid "Only by IP address"
42
  msgstr ""
43
 
44
- #: includes/class-ald-settings.php:110
45
  msgid "<div class=\"warning\">WARNING. Cannot determine your language preference based on your current IP.<br>This is most likely because the website is on a local environment.</div>"
46
  msgstr ""
47
 
48
- #: 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:10, ../translatepress/partials/trp-remove-duplicate-rows.php:3
49
  msgid "TranslatePress Settings"
50
  msgstr ""
51
 
52
- #: 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
53
  msgid "License Key"
54
  msgstr ""
55
 
56
- #: 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
57
  msgid "Enter your license key."
58
  msgstr ""
59
 
60
- #: partials/license-settings-page.php:22, 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
61
  msgid "Activate License"
62
  msgstr ""
63
 
64
- #: 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
65
  msgid "Deactivate License"
66
  msgstr ""
67
 
68
- #: partials/settings-option.php:2
69
  msgid "Method of language detection"
70
  msgstr ""
71
 
72
- #: partials/settings-option.php:14
73
  msgid "Select how the language should be detected for first time visitors.<br>The visitor's last displayed language will be remembered through cookies."
74
  msgstr ""
75
 
@@ -81,7 +81,7 @@ msgstr ""
81
  msgid "Language"
82
  msgstr ""
83
 
84
- #: ../tp-add-on-extra-languages/partials/language-selector-pro.php:8, ../translatepress/partials/main-settings-language-selector.php:8
85
  msgid "Slug"
86
  msgstr ""
87
 
@@ -89,19 +89,19 @@ msgstr ""
89
  msgid "Active"
90
  msgstr ""
91
 
92
- #: ../tp-add-on-extra-languages/partials/language-selector-pro.php:38
93
  msgid "Are you sure you want to remove this language?"
94
  msgstr ""
95
 
96
- #: ../tp-add-on-extra-languages/partials/language-selector-pro.php:38
97
  msgid "Remove"
98
  msgstr ""
99
 
100
- #: ../tp-add-on-extra-languages/partials/language-selector-pro.php:46, ../translatepress/partials/main-settings-language-selector.php:20, ../translatepress/partials/main-settings-language-selector.php:45
101
  msgid "Choose..."
102
  msgstr ""
103
 
104
- #: ../tp-add-on-extra-languages/partials/language-selector-pro.php:53, ../translatepress/partials/main-settings-language-selector.php:52
105
  msgid "Add"
106
  msgstr ""
107
 
@@ -233,7 +233,7 @@ msgstr ""
233
  msgid "Translate Page"
234
  msgstr ""
235
 
236
- #: ../translatepress/includes/class-translation-manager.php:1141
237
  msgid "Security check"
238
  msgstr ""
239
 
@@ -277,15 +277,19 @@ msgstr ""
277
  msgid "All Languages"
278
  msgstr ""
279
 
280
- #: ../translatepress/partials/main-settings-language-selector.php:56
 
 
 
 
281
  msgid "Select the language you wish to make your website available in."
282
  msgstr ""
283
 
284
- #: ../translatepress/partials/main-settings-language-selector.php:62
285
- msgid "To add <strong>more then two languages</strong> and support for SEO Title, Description, Slug and more checkout <a href=\"%s\" class=\"button button-primary\" target=\"_blank\" title=\"TranslatePress Pro\">TranslatePress PRO</a>"
286
  msgstr ""
287
 
288
- #: ../translatepress/partials/main-settings-language-selector.php:63
289
  msgid "Not only you are getting extra features and premium support, you also help fund the future development of TranslatePress."
290
  msgstr ""
291
 
@@ -570,3 +574,15 @@ msgstr ""
570
  #: ../translatepress/partials/trp-remove-duplicate-rows.php:28
571
  msgid "Remove duplicate rows"
572
  msgstr ""
 
 
 
 
 
 
 
 
 
 
 
 
13
  "X-Poedit-SourceCharset: UTF-8\n"
14
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
 
16
+ #: ../tp-add-on-extra-languages/class-extra-languages.php:57, ../translatepress/includes/class-settings.php:416
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
 
25
  msgid "The Yoast SEO Sitemaps will now contain the default language slug: example.com/en/sitemap_index.xml <br/> This works perfectly, just take it into account when you submit the sitemap to Google."
26
  msgstr ""
27
 
28
+ #: ../tp-add-on-automatic-language-detection/includes/class-ald-settings.php:37
29
  msgid "First by browser language, then IP address (recommended)"
30
  msgstr ""
31
 
32
+ #: ../tp-add-on-automatic-language-detection/includes/class-ald-settings.php:38
33
  msgid "First by IP address, then browser language"
34
  msgstr ""
35
 
36
+ #: ../tp-add-on-automatic-language-detection/includes/class-ald-settings.php:39
37
  msgid "Only by browser language"
38
  msgstr ""
39
 
40
+ #: ../tp-add-on-automatic-language-detection/includes/class-ald-settings.php:40
41
  msgid "Only by IP address"
42
  msgstr ""
43
 
44
+ #: ../tp-add-on-automatic-language-detection/includes/class-ald-settings.php:110
45
  msgid "<div class=\"warning\">WARNING. Cannot determine your language preference based on your current IP.<br>This is most likely because the website is on a local environment.</div>"
46
  msgstr ""
47
 
48
+ #: ../tp-add-on-automatic-language-detection/partials/license-settings-page.php:4, ../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:10, ../translatepress/partials/trp-remove-duplicate-rows.php:3, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:4
49
  msgid "TranslatePress Settings"
50
  msgstr ""
51
 
52
+ #: ../tp-add-on-automatic-language-detection/partials/license-settings-page.php:10, ../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
53
  msgid "License Key"
54
  msgstr ""
55
 
56
+ #: ../tp-add-on-automatic-language-detection/partials/license-settings-page.php:15, ../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
57
  msgid "Enter your license key."
58
  msgstr ""
59
 
60
+ #: ../tp-add-on-automatic-language-detection/partials/license-settings-page.php:22, ../tp-add-on-automatic-language-detection/partials/license-settings-page.php:31, ../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
61
  msgid "Activate License"
62
  msgstr ""
63
 
64
+ #: ../tp-add-on-automatic-language-detection/partials/license-settings-page.php:28, ../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
65
  msgid "Deactivate License"
66
  msgstr ""
67
 
68
+ #: ../tp-add-on-automatic-language-detection/partials/settings-option.php:2
69
  msgid "Method of language detection"
70
  msgstr ""
71
 
72
+ #: ../tp-add-on-automatic-language-detection/partials/settings-option.php:14
73
  msgid "Select how the language should be detected for first time visitors.<br>The visitor's last displayed language will be remembered through cookies."
74
  msgstr ""
75
 
81
  msgid "Language"
82
  msgstr ""
83
 
84
+ #: ../tp-add-on-extra-languages/partials/language-selector-pro.php:8, ../translatepress/partials/main-settings-language-selector.php:9
85
  msgid "Slug"
86
  msgstr ""
87
 
89
  msgid "Active"
90
  msgstr ""
91
 
92
+ #: ../tp-add-on-extra-languages/partials/language-selector-pro.php:38, ../translatepress/partials/main-settings-language-selector.php:40
93
  msgid "Are you sure you want to remove this language?"
94
  msgstr ""
95
 
96
+ #: ../tp-add-on-extra-languages/partials/language-selector-pro.php:38, ../translatepress/partials/main-settings-language-selector.php:40
97
  msgid "Remove"
98
  msgstr ""
99
 
100
+ #: ../tp-add-on-extra-languages/partials/language-selector-pro.php:46, ../translatepress/partials/main-settings-language-selector.php:48
101
  msgid "Choose..."
102
  msgstr ""
103
 
104
+ #: ../tp-add-on-extra-languages/partials/language-selector-pro.php:53, ../translatepress/partials/main-settings-language-selector.php:55
105
  msgid "Add"
106
  msgstr ""
107
 
233
  msgid "Translate Page"
234
  msgstr ""
235
 
236
+ #: ../translatepress/includes/class-translation-manager.php:1143
237
  msgid "Security check"
238
  msgstr ""
239
 
277
  msgid "All Languages"
278
  msgstr ""
279
 
280
+ #: ../translatepress/partials/main-settings-language-selector.php:8
281
+ msgid "Code"
282
+ msgstr ""
283
+
284
+ #: ../translatepress/partials/main-settings-language-selector.php:59
285
  msgid "Select the language you wish to make your website available in."
286
  msgstr ""
287
 
288
+ #: ../translatepress/partials/main-settings-language-selector.php:65
289
+ msgid "To add <strong>more then two languages</strong> and support for SEO Title, Description, Slug and more check out <a href=\"%s\" class=\"button button-primary\" target=\"_blank\" title=\"TranslatePress Pro\">TranslatePress PRO</a>"
290
  msgstr ""
291
 
292
+ #: ../translatepress/partials/main-settings-language-selector.php:66
293
  msgid "Not only you are getting extra features and premium support, you also help fund the future development of TranslatePress."
294
  msgstr ""
295
 
574
  #: ../translatepress/partials/trp-remove-duplicate-rows.php:28
575
  msgid "Remove duplicate rows"
576
  msgstr ""
577
+
578
+ #: ../trp-add-on-translator-accounts-add-on/includes/class-translator-accounts.php:119
579
+ msgid " TranslatePress Settings"
580
+ msgstr ""
581
+
582
+ #: ../trp-add-on-translator-accounts-add-on/includes/class-translator-accounts.php:123, ../trp-add-on-translator-accounts-add-on/includes/class-translator-accounts.php:124
583
+ msgid "Translator"
584
+ msgstr ""
585
+
586
+ #: ../trp-add-on-translator-accounts-add-on/includes/class-translator-accounts.php:128
587
+ msgid "Allow this user to translate the website."
588
+ msgstr ""
partials/main-settings-language-selector.php CHANGED
@@ -3,10 +3,11 @@
3
  <td>
4
  <table id="trp-languages-table">
5
  <thead>
6
- <tr>
7
- <th colspan="2"><?php _e( 'Language', 'translatepress-multilingual' ); ?></th>
8
- <th><?php _e( 'Slug', 'translatepress-multilingual' ); ?></th>
9
- </tr>
 
10
  </thead>
11
  <tbody id="trp-sortable-languages" class="trp-language-selector-limited">
12
 
@@ -17,7 +18,6 @@
17
  <td><span class="trp-sortable-handle"></span></td>
18
  <td>
19
  <select name="trp_settings[translation-languages][]" class="trp-select2 trp-translation-language" <?php echo ( $default_language ) ? 'disabled' : '' ?>>
20
- <option value=""><?php _e( 'Choose...', 'translatepress-multilingual' );?></option>
21
  <?php foreach( $languages as $language_code => $language_name ){ ?>
22
  <option title="<?php echo $language_code; ?>" value="<?php echo $language_code; ?>" <?php echo ( $language_code == $selected_language_code ) ? 'selected' : ''; ?>>
23
  <?php echo ( $default_language ) ? 'Default: ' : ''; ?>
@@ -31,10 +31,13 @@
31
  <?php } ?>
32
  </td>
33
  <td>
34
- <input class="trp-language-slug" name="trp_settings[url-slugs][<?php echo $selected_language_code ?>]" type="text" style="text-transform: lowercase;" value="<?php echo $this->url_converter->get_url_slug( $selected_language_code, false ); ?>">
 
 
 
35
  </td>
36
  <td>
37
- <a class="trp-remove-language" style=" <?php echo ( $default_language ) ? 'display:none' : '' ?>" data-confirm-message="<?php _e( 'Are you sure you want to remove this language?', TRP_PLUGIN_SLUG ); ?>"><?php _e( 'Remove', TRP_PLUGIN_SLUG ); ?></a>
38
  </td>
39
  </tr>
40
  <?php }?>
@@ -59,7 +62,7 @@
59
  <p class="trp-upsell-multiple-languages" style="display: none;">
60
  <?php
61
  $url = trp_add_affiliate_id_to_link('https://translatepress.com/?utm_source=wpbackend&utm_medium=clientsite&utm_content=multiple_languages&utm_campaign=tpfree');
62
- $link = sprintf( wp_kses( __( 'To add <strong>more then two languages</strong> and support for SEO Title, Description, Slug and more checkout <a href="%s" class="button button-primary" target="_blank" title="TranslatePress Pro">TranslatePress PRO</a>', 'translatepress-multilingual' ), array( 'strong' => array(), 'br' => array(), 'a' => array( 'href' => array(), 'title' => array(), 'target'=> array(), 'class' => array() ) ) ), esc_url( $url ) );
63
  $link .= '<br/>' . __('Not only you are getting extra features and premium support, you also help fund the future development of TranslatePress.', 'translatepress-multilingual');
64
  echo $link;
65
  ?>
3
  <td>
4
  <table id="trp-languages-table">
5
  <thead>
6
+ <tr>
7
+ <th colspan="2"><?php _e( 'Language', 'translatepress-multilingual' ); ?></th>
8
+ <th><?php _e( 'Code', 'translatepress-multilingual' ); ?></th>
9
+ <th><?php _e( 'Slug', 'translatepress-multilingual' ); ?></th>
10
+ </tr>
11
  </thead>
12
  <tbody id="trp-sortable-languages" class="trp-language-selector-limited">
13
 
18
  <td><span class="trp-sortable-handle"></span></td>
19
  <td>
20
  <select name="trp_settings[translation-languages][]" class="trp-select2 trp-translation-language" <?php echo ( $default_language ) ? 'disabled' : '' ?>>
 
21
  <?php foreach( $languages as $language_code => $language_name ){ ?>
22
  <option title="<?php echo $language_code; ?>" value="<?php echo $language_code; ?>" <?php echo ( $language_code == $selected_language_code ) ? 'selected' : ''; ?>>
23
  <?php echo ( $default_language ) ? 'Default: ' : ''; ?>
31
  <?php } ?>
32
  </td>
33
  <td>
34
+ <input class="trp-language-code trp-code-slug" type="text" disabled value="<?php echo esc_html( $selected_language_code ); ?>">
35
+ </td>
36
+ <td>
37
+ <input class="trp-language-slug trp-code-slug" name="trp_settings[url-slugs][<?php echo $selected_language_code ?>]" type="text" style="text-transform: lowercase;" value="<?php echo $this->url_converter->get_url_slug( $selected_language_code, false ); ?>">
38
  </td>
39
  <td>
40
+ <a class="trp-remove-language" style=" <?php echo ( $default_language ) ? 'display:none' : '' ?>" data-confirm-message="<?php _e( 'Are you sure you want to remove this language?', 'translatepress-multilingual' ); ?>"><?php _e( 'Remove', 'translatepress-multilingual' ); ?></a>
41
  </td>
42
  </tr>
43
  <?php }?>
62
  <p class="trp-upsell-multiple-languages" style="display: none;">
63
  <?php
64
  $url = trp_add_affiliate_id_to_link('https://translatepress.com/?utm_source=wpbackend&utm_medium=clientsite&utm_content=multiple_languages&utm_campaign=tpfree');
65
+ $link = sprintf( wp_kses( __( 'To add <strong>more then two languages</strong> and support for SEO Title, Description, Slug and more check out <a href="%s" class="button button-primary" target="_blank" title="TranslatePress Pro">TranslatePress PRO</a>', 'translatepress-multilingual' ), array( 'strong' => array(), 'br' => array(), 'a' => array( 'href' => array(), 'title' => array(), 'target'=> array(), 'class' => array() ) ) ), esc_url( $url ) );
66
  $link .= '<br/>' . __('Not only you are getting extra features and premium support, you also help fund the future development of TranslatePress.', 'translatepress-multilingual');
67
  echo $link;
68
  ?>
partials/main-settings-page.php CHANGED
@@ -12,7 +12,7 @@
12
  <select id="trp-default-language" name="trp_settings[default-language]" class="trp-select2">
13
  <?php
14
  foreach( $languages as $language_code => $language_name ){ ?>
15
- <option value="<?php echo $language_code; ?>" <?php echo ( $this->settings['default-language'] == $language_code ? 'selected' : '' ); ?> >
16
  <?php echo $language_name; ?>
17
  </option>
18
  <?php }?>
12
  <select id="trp-default-language" name="trp_settings[default-language]" class="trp-select2">
13
  <?php
14
  foreach( $languages as $language_code => $language_name ){ ?>
15
+ <option title="<?php echo $language_code; ?>" value="<?php echo $language_code; ?>" <?php echo ( $this->settings['default-language'] == $language_code ? 'selected' : '' ); ?> >
16
  <?php echo $language_name; ?>
17
  </option>
18
  <?php }?>
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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.8
7
- Stable tag: 1.3.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -124,6 +124,14 @@ For more information please check out [TranslatePress - Multilingual plugin docu
124
  6. Menu Language Switcher
125
 
126
  == Changelog ==
 
 
 
 
 
 
 
 
127
  = 1.3.6 =
128
  * Refactored the get_url_for_language() function which should fix a lot of problems with links
129
  * Speed improvements
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.8
7
+ Stable tag: 1.3.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
124
  6. Menu Language Switcher
125
 
126
  == Changelog ==
127
+ = 1.3.7 =
128
+ * Fixed an issue with Woocommerce and redirects when the default language is not English
129
+ * Speed improvements
130
+ * Fix relative url without a trailingslash not getting a proper link back
131
+ * Add ?trp=edit-translation=preview to ajax loaded content. Also add it to all dynamic content.
132
+ * Added language code column in settings
133
+ * Removed async false from JS translate-dom-changes
134
+
135
  = 1.3.6 =
136
  * Refactored the get_url_for_language() function which should fix a lot of problems with links
137
  * Speed improvements