TranslatePress – Translate Multilingual sites - Version 1.2.7

Version Description

  • Added a warning when changing the default language that it will invalidate their existing translations
  • Fixed incorrect detection of the form action language parameter
  • Improved compatibility with themes and plugins that use object buffering
  • Fixed some issues with image urls
Download this release

Release Info

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

Code changes from version 1.2.6 to 1.2.7

assets/css/trp-back-end-style.css CHANGED
@@ -131,8 +131,10 @@ input.trp-translation-published{
131
  margin-top: 10px;
132
  }
133
 
 
134
  .trp-upsell-multiple-languages{
135
  border: 1px solid #a00;
136
  padding: 1rem;
137
  background: #fff;
 
138
  }
131
  margin-top: 10px;
132
  }
133
 
134
+ .warning,
135
  .trp-upsell-multiple-languages{
136
  border: 1px solid #a00;
137
  padding: 1rem;
138
  background: #fff;
139
+ max-width:800px;
140
  }
assets/js/trp-back-end-script.js CHANGED
@@ -94,5 +94,9 @@ var trpSettingsLanguages;
94
  // Initialize the Translate Press Settings after jQuery is ready
95
  jQuery( function() {
96
  trpSettingsLanguages = new TRP_Settings_Language_Selector();
 
 
 
 
97
  });
98
 
94
  // Initialize the Translate Press Settings after jQuery is ready
95
  jQuery( function() {
96
  trpSettingsLanguages = new TRP_Settings_Language_Selector();
97
+
98
+ jQuery('#trp-default-language').on("select2:selecting", function(e) {
99
+ jQuery("#trp-options .warning").show('fast');
100
+ });
101
  });
102
 
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.6' );
43
 
44
  $this->load_dependencies();
45
  $this->initialize_components();
@@ -129,7 +129,7 @@ class TRP_Translate_Press{
129
  * Hooks methods used in front-end
130
  */
131
  protected function define_frontend_hooks(){
132
- $this->loader->add_action( 'wp', $this->translation_render, 'start_output_buffer' );
133
  $this->loader->add_action( 'admin_init', $this->translation_render, 'start_output_buffer' );
134
  $this->loader->add_action( 'wp_enqueue_scripts', $this->translation_render, 'enqueue_dynamic_translation', 1 );
135
  $this->loader->add_filter( 'wp_redirect', $this->translation_render, 'force_preview_on_url_redirect', 99, 2 );
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.7' );
43
 
44
  $this->load_dependencies();
45
  $this->initialize_components();
129
  * Hooks methods used in front-end
130
  */
131
  protected function define_frontend_hooks(){
132
+ $this->loader->add_action( 'init', $this->translation_render, 'start_output_buffer', -1 );
133
  $this->loader->add_action( 'admin_init', $this->translation_render, 'start_output_buffer' );
134
  $this->loader->add_action( 'wp_enqueue_scripts', $this->translation_render, 'enqueue_dynamic_translation', 1 );
135
  $this->loader->add_filter( 'wp_redirect', $this->translation_render, 'force_preview_on_url_redirect', 99, 2 );
includes/class-translation-render.php CHANGED
@@ -677,9 +677,8 @@ class TRP_Translation_Render{
677
  if ( !empty($form_action)
678
  && $this->settings['force-language-to-custom-links'] == 'yes'
679
  && !$is_external_link
680
- && $this->url_converter->get_lang_from_url_string( $form_action ) == null
681
  && !$is_admin_link
682
- && strpos($url, '#TRPLINKPROCESSED') === false)
683
  {
684
  $row->action = $this->url_converter->get_url_for_language( $TRP_LANGUAGE, $form_action );
685
  }
677
  if ( !empty($form_action)
678
  && $this->settings['force-language-to-custom-links'] == 'yes'
679
  && !$is_external_link
 
680
  && !$is_admin_link
681
+ && strpos($form_action, '#TRPLINKPROCESSED') === false)
682
  {
683
  $row->action = $this->url_converter->get_url_for_language( $TRP_LANGUAGE, $form_action );
684
  }
includes/class-url-converter.php CHANGED
@@ -239,7 +239,7 @@ class TRP_Url_Converter {
239
  return false;
240
  }
241
 
242
- $path = untrailingslashit(ABSPATH) . str_replace($this->get_abs_home(), '', $url);
243
 
244
  return is_file($path);
245
  }
239
  return false;
240
  }
241
 
242
+ $path = trailingslashit(ABSPATH) . str_replace(untrailingslashit($this->get_abs_home()), '', $url);
243
 
244
  return is_file($path);
245
  }
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.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.2.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
@@ -53,6 +53,10 @@
53
  <?php __("Not only you are getting extra features and premium support, you also help fund the future development of TranslatePress.", "translatepress-multilingual"); ?>
54
  <?php __("Default Language", "translatepress-multilingual"); ?>
55
  <?php __("Select the original language your website was written in. ", "translatepress-multilingual"); ?>
 
 
 
 
56
  <?php __("Native language name", "translatepress-multilingual"); ?>
57
  <?php __("No", "translatepress-multilingual"); ?>
58
  <?php __("Yes", "translatepress-multilingual"); ?>
53
  <?php __("Not only you are getting extra features and premium support, you also help fund the future development of TranslatePress.", "translatepress-multilingual"); ?>
54
  <?php __("Default Language", "translatepress-multilingual"); ?>
55
  <?php __("Select the original language your website was written in. ", "translatepress-multilingual"); ?>
56
+ <?php __("WARNING. Changing the default language will invalidate existing translations.", "translatepress-multilingual"); ?>
57
+ <?php __("Even changing from en_US to en_GB, because they are treated as two different languages.", "translatepress-multilingual"); ?>
58
+ <?php __("In most cases changing the default flag is all it is needed: ", "translatepress-multilingual"); ?>
59
+ <?php __("replace the default flag", "translatepress-multilingual"); ?>
60
  <?php __("Native language name", "translatepress-multilingual"); ?>
61
  <?php __("No", "translatepress-multilingual"); ?>
62
  <?php __("Yes", "translatepress-multilingual"); ?>
languages/translatepress-multilingual.pot CHANGED
@@ -232,87 +232,103 @@ msgstr ""
232
  msgid "Select the original language your website was written in. "
233
  msgstr ""
234
 
235
- #: ../translatepress/partials/main-settings-page.php:29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  msgid "Native language name"
237
  msgstr ""
238
 
239
- #: ../translatepress/partials/main-settings-page.php:32, ../translatepress/partials/main-settings-page.php:45, ../translatepress/partials/main-settings-page.php:58, ../translatepress/partials/main-settings-page.php:71
240
  msgid "No"
241
  msgstr ""
242
 
243
- #: ../translatepress/partials/main-settings-page.php:33, ../translatepress/partials/main-settings-page.php:46, ../translatepress/partials/main-settings-page.php:59, ../translatepress/partials/main-settings-page.php:72
244
  msgid "Yes"
245
  msgstr ""
246
 
247
- #: ../translatepress/partials/main-settings-page.php:36
248
  msgid "Select Yes if you want languages to display in their native names. Otherwise, they will be displayed in English."
249
  msgstr ""
250
 
251
- #: ../translatepress/partials/main-settings-page.php:42
252
  msgid "Use subdirectory for default language"
253
  msgstr ""
254
 
255
- #: ../translatepress/partials/main-settings-page.php:49
256
  msgid "Select Yes if you want to add the subdirectory in the url for the default language.</br>By selecting Yes, the default language seen by website visitors will become the first one in the \"All Languages\" list."
257
  msgstr ""
258
 
259
- #: ../translatepress/partials/main-settings-page.php:55
260
  msgid "Force language in custom links"
261
  msgstr ""
262
 
263
- #: ../translatepress/partials/main-settings-page.php:62
264
  msgid "Select Yes if you want to force custom links without language encoding to keep the currently selected language."
265
  msgstr ""
266
 
267
- #: ../translatepress/partials/main-settings-page.php:68
268
  msgid "Google Translate"
269
  msgstr ""
270
 
271
- #: ../translatepress/partials/main-settings-page.php:75
272
  msgid "Enable or disable the automatic translation of the site with Google Translate. Only untranslated strings will receive a translation.<br>You can later edit these automatic translations.<br>Note: Not all languages support automatic translation. Please consult the <a href=\"https://cloud.google.com/translate/docs/languages\" target=\"_blank\" title=\"Automatic translation supported languages.\">supported languages list</a>. "
273
  msgstr ""
274
 
275
- #: ../translatepress/partials/main-settings-page.php:81
276
  msgid "Google Translate API Key"
277
  msgstr ""
278
 
279
- #: ../translatepress/partials/main-settings-page.php:84
280
  msgid "Test api key."
281
  msgstr ""
282
 
283
- #: ../translatepress/partials/main-settings-page.php:86
284
  msgid "Visit this <a href=\"https://support.google.com/cloud/answer/6158862\" target=\"_blank\">link</a> to see how you can set up an API key. "
285
  msgstr ""
286
 
287
- #: ../translatepress/partials/main-settings-page.php:93
288
  msgid "Language Switcher"
289
  msgstr ""
290
 
291
- #: ../translatepress/partials/main-settings-page.php:96
292
  msgid "Shortcode "
293
  msgstr ""
294
 
295
- #: ../translatepress/partials/main-settings-page.php:101
296
  msgid "Use shortcode on any page or widget."
297
  msgstr ""
298
 
299
- #: ../translatepress/partials/main-settings-page.php:105
300
  msgid "Menu item"
301
  msgstr ""
302
 
303
- #: ../translatepress/partials/main-settings-page.php:113
304
  msgid "Go to %1$s Appearance -> Menus%2$s to add Language Switcher Languages in any menu."
305
  msgstr ""
306
 
307
- #: ../translatepress/partials/main-settings-page.php:114
308
  msgid "Learn more in our documentation."
309
  msgstr ""
310
 
311
- #: ../translatepress/partials/main-settings-page.php:118
312
  msgid "Floating language selection"
313
  msgstr ""
314
 
315
- #: ../translatepress/partials/main-settings-page.php:123
316
  msgid "Have a floating dropdown following the user on every page."
317
  msgstr ""
318
 
232
  msgid "Select the original language your website was written in. "
233
  msgstr ""
234
 
235
+ #: ../translatepress/partials/main-settings-page.php:25
236
+ msgid "WARNING. Changing the default language will invalidate existing translations."
237
+ msgstr ""
238
+
239
+ #: ../translatepress/partials/main-settings-page.php:26
240
+ msgid "Even changing from en_US to en_GB, because they are treated as two different languages."
241
+ msgstr ""
242
+
243
+ #: ../translatepress/partials/main-settings-page.php:27
244
+ msgid "In most cases changing the default flag is all it is needed: "
245
+ msgstr ""
246
+
247
+ #: ../translatepress/partials/main-settings-page.php:28
248
+ msgid "replace the default flag"
249
+ msgstr ""
250
+
251
+ #: ../translatepress/partials/main-settings-page.php:37
252
  msgid "Native language name"
253
  msgstr ""
254
 
255
+ #: ../translatepress/partials/main-settings-page.php:40, ../translatepress/partials/main-settings-page.php:53, ../translatepress/partials/main-settings-page.php:66, ../translatepress/partials/main-settings-page.php:79
256
  msgid "No"
257
  msgstr ""
258
 
259
+ #: ../translatepress/partials/main-settings-page.php:41, ../translatepress/partials/main-settings-page.php:54, ../translatepress/partials/main-settings-page.php:67, ../translatepress/partials/main-settings-page.php:80
260
  msgid "Yes"
261
  msgstr ""
262
 
263
+ #: ../translatepress/partials/main-settings-page.php:44
264
  msgid "Select Yes if you want languages to display in their native names. Otherwise, they will be displayed in English."
265
  msgstr ""
266
 
267
+ #: ../translatepress/partials/main-settings-page.php:50
268
  msgid "Use subdirectory for default language"
269
  msgstr ""
270
 
271
+ #: ../translatepress/partials/main-settings-page.php:57
272
  msgid "Select Yes if you want to add the subdirectory in the url for the default language.</br>By selecting Yes, the default language seen by website visitors will become the first one in the \"All Languages\" list."
273
  msgstr ""
274
 
275
+ #: ../translatepress/partials/main-settings-page.php:63
276
  msgid "Force language in custom links"
277
  msgstr ""
278
 
279
+ #: ../translatepress/partials/main-settings-page.php:70
280
  msgid "Select Yes if you want to force custom links without language encoding to keep the currently selected language."
281
  msgstr ""
282
 
283
+ #: ../translatepress/partials/main-settings-page.php:76
284
  msgid "Google Translate"
285
  msgstr ""
286
 
287
+ #: ../translatepress/partials/main-settings-page.php:83
288
  msgid "Enable or disable the automatic translation of the site with Google Translate. Only untranslated strings will receive a translation.<br>You can later edit these automatic translations.<br>Note: Not all languages support automatic translation. Please consult the <a href=\"https://cloud.google.com/translate/docs/languages\" target=\"_blank\" title=\"Automatic translation supported languages.\">supported languages list</a>. "
289
  msgstr ""
290
 
291
+ #: ../translatepress/partials/main-settings-page.php:89
292
  msgid "Google Translate API Key"
293
  msgstr ""
294
 
295
+ #: ../translatepress/partials/main-settings-page.php:92
296
  msgid "Test api key."
297
  msgstr ""
298
 
299
+ #: ../translatepress/partials/main-settings-page.php:94
300
  msgid "Visit this <a href=\"https://support.google.com/cloud/answer/6158862\" target=\"_blank\">link</a> to see how you can set up an API key. "
301
  msgstr ""
302
 
303
+ #: ../translatepress/partials/main-settings-page.php:101
304
  msgid "Language Switcher"
305
  msgstr ""
306
 
307
+ #: ../translatepress/partials/main-settings-page.php:104
308
  msgid "Shortcode "
309
  msgstr ""
310
 
311
+ #: ../translatepress/partials/main-settings-page.php:109
312
  msgid "Use shortcode on any page or widget."
313
  msgstr ""
314
 
315
+ #: ../translatepress/partials/main-settings-page.php:113
316
  msgid "Menu item"
317
  msgstr ""
318
 
319
+ #: ../translatepress/partials/main-settings-page.php:121
320
  msgid "Go to %1$s Appearance -> Menus%2$s to add Language Switcher Languages in any menu."
321
  msgstr ""
322
 
323
+ #: ../translatepress/partials/main-settings-page.php:122
324
  msgid "Learn more in our documentation."
325
  msgstr ""
326
 
327
+ #: ../translatepress/partials/main-settings-page.php:126
328
  msgid "Floating language selection"
329
  msgstr ""
330
 
331
+ #: ../translatepress/partials/main-settings-page.php:131
332
  msgid "Have a floating dropdown following the user on every page."
333
  msgstr ""
334
 
partials/main-settings-page.php CHANGED
@@ -20,6 +20,14 @@
20
  <p class="description">
21
  <?php _e( 'Select the original language your website was written in. ', 'translatepress-multilingual' ); ?>
22
  </p>
 
 
 
 
 
 
 
 
23
  </td>
24
  </tr>
25
 
20
  <p class="description">
21
  <?php _e( 'Select the original language your website was written in. ', 'translatepress-multilingual' ); ?>
22
  </p>
23
+
24
+ <p class="warning" style="display: none;" >
25
+ <?php _e( 'WARNING. Changing the default language will invalidate existing translations.', 'translatepress-multilingual' ); ?><br/>
26
+ <?php _e( 'Even changing from en_US to en_GB, because they are treated as two different languages.', 'translatepress-multilingual' ); ?><br/>
27
+ <?php _e( 'In most cases changing the default flag is all it is needed: ', 'translatepress-multilingual' ); ?>
28
+ <a href="https://translatepress.com/docs/developers/replace-default-flags/"><?php _e( 'replace the default flag', 'translatepress-multilingual' ); ?></a>
29
+ </p>
30
+
31
  </td>
32
  </tr>
33
 
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.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 +117,12 @@ For more information please check out [TranslatePress documentation](https://tra
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
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.7
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.7 =
121
+ * Added a warning when changing the default language that it will invalidate their existing translations
122
+ * Fixed incorrect detection of the form action language parameter
123
+ * Improved compatibility with themes and plugins that use object buffering
124
+ * Fixed some issues with image urls
125
+
126
  = 1.2.6 =
127
  * Refactored determining language, redirecting and cookie adding
128
  * Removed leftover trp-gettext tags when WooCommerce is active on some pages