TranslatePress – Translate Multilingual sites - Version 2.2.1

Version Description

  • Added Advanced option to adjust hreflang to hide region independent language tags or country locale tags
  • Added missing flags for Tamil (Sri Lanka), Spanish (Ecuador), Spanish (Dominican Republic), Amharic
  • Improved Automatic Translation tab checking for translation API key validity
  • Improved Plugins interface action buttons for TP by taking into account free/pro status
  • Fixed error management interface displaying raw HTML instead of formatted HTML
  • Fixed notice in admin for an edge case
  • Fixed notice in Test API Page when test request resulted in WP Error
Download this release

Release Info

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

Code changes from version 2.2.0 to 2.2.1

assets/css/trp-back-end-style.css CHANGED
@@ -218,9 +218,7 @@ table.trp-adst-list-option th{
218
  display: inline-block;
219
  margin-right: 3em;
220
  }
221
- .trp-adst-radio .description{
222
- margin-top: 2em;
223
- }
224
  #trp_advanced_tab_content_table{
225
  margin-top: 25px;
226
  font-size: 15px;
218
  display: inline-block;
219
  margin-right: 3em;
220
  }
221
+
 
 
222
  #trp_advanced_tab_content_table{
223
  margin-top: 25px;
224
  font-size: 15px;
assets/images/flags/am.png ADDED
Binary file
assets/images/flags/es_DO.png ADDED
Binary file
assets/images/flags/es_EC.png ADDED
Binary file
assets/images/flags/ta_LK.png ADDED
Binary file
class-translate-press.php CHANGED
@@ -59,7 +59,7 @@ class TRP_Translate_Press{
59
  define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
60
  define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
61
  define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
62
- define( 'TRP_PLUGIN_VERSION', '2.2.0' );
63
 
64
  wp_cache_add_non_persistent_groups(array('trp'));
65
 
59
  define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
60
  define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
61
  define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
62
+ define( 'TRP_PLUGIN_VERSION', '2.2.1' );
63
 
64
  wp_cache_add_non_persistent_groups(array('trp'));
65
 
includes/advanced-settings/hreflang-remove-locale.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ add_filter( 'trp_register_advanced_settings', 'trp_register_hreflang_remove_locale', 1000 );
4
+ function trp_register_hreflang_remove_locale( $settings_array ){
5
+ $settings_array[] = array(
6
+ 'name' => 'hreflang_remove_locale',
7
+ 'type' => 'radio',
8
+ 'options' => array( 'show_both', 'remove_country_locale', 'remove_region_independent_locale' ),
9
+ 'default' => 'show_both',
10
+ 'labels' => array( esc_html__( 'Show Both (recommended)', 'translatepress-multilingual' ), esc_html__( 'Remove Country Locale', 'translatepress-multilingual' ), esc_html__( 'Remove Region Independent Locale', 'translatepress-multilingual' ) ),
11
+ 'label' => esc_html__( 'Remove duplicate hreflang', 'translatepress-multilingual' ),
12
+ 'description' => wp_kses( __( 'Choose which hreflang tags will appear on your website.<br/>We recommend showing both types of hreflang tags as indicated by <a href="https://developers.google.com/search/docs/advanced/crawling/localized-versions" title="Google Crawling" target="_blank">Google documentation</a>.<br/>Removing Country Locale when having multiple Country Locales of the same language (ex. English UK and English US) will result in showing one hreflang tag with link to just one of the region locales for that language.', 'translatepress-multilingual' ), array( 'br' => array(), 'a' => array( 'href' => array(), 'title' => array(), 'target' => array() ) ) ),
13
+ );
14
+ return $settings_array;
15
+ }
16
+
17
+ add_filter( 'trp_add_country_hreflang_tags', 'trp_display_country_hreflang_tag' );
18
+ function trp_display_country_hreflang_tag( $display ){
19
+ $option = get_option( 'trp_advanced_settings', true );
20
+ if ( isset( $option['hreflang_remove_locale'] ) && $option['hreflang_remove_locale'] === 'remove_country_locale' ) {
21
+ return false;
22
+ }
23
+ return $display;
24
+ }
25
+
26
+ add_filter( 'trp_add_region_independent_hreflang_tags', 'trp_display_region_independent_hreflang_tag' );
27
+ function trp_display_region_independent_hreflang_tag( $display ){
28
+
29
+ $option = get_option( 'trp_advanced_settings', true );
30
+ if ( isset( $option['hreflang_remove_locale'] ) && $option['hreflang_remove_locale'] === 'remove_region_independent_locale' ) {
31
+ return false;
32
+ }
33
+ return $display;
34
+ }
includes/class-advanced-tab.php CHANGED
@@ -77,6 +77,10 @@ class TRP_Advanced_Tab {
77
  $settings[ $registered_setting['name'] ] = sanitize_text_field($submitted_settings[ $registered_setting['name'] ]);
78
  break;
79
  }
 
 
 
 
80
  case 'custom': {
81
  foreach ( $registered_setting['rows'] as $row_label => $row_type ) {
82
  if (isset($submitted_settings[$registered_setting['name']][$row_label])) {
@@ -229,6 +233,7 @@ class TRP_Advanced_Tab {
229
  include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/do-not-translate-certain-paths.php');
230
  include_once (TRP_PLUGIN_DIR . 'includes/advanced-settings/opposite-flag-shortcode.php');
231
  include_once (TRP_PLUGIN_DIR . 'includes/advanced-settings/open-language-switcher-shortcode-on-click.php');
 
232
  }
233
 
234
  /*
@@ -329,16 +334,29 @@ class TRP_Advanced_Tab {
329
  */
330
  public function radio_setting( $setting ){
331
  $adv_option = $this->settings['trp_advanced_settings'];
332
- $checked = '';
333
  $html = "
334
  <tr>
335
  <th scope='row'>" . esc_html($setting['label'] ) . "</th>
336
  <td class='trp-adst-radio'>";
337
 
338
  foreach($setting[ 'options' ] as $key => $option ){
339
- if( isset( $adv_option[ $setting['default'] ] ) && $adv_option[ $setting['default'] ] === $option ) {
340
- $checked = 'checked="checked"';
 
 
 
 
 
 
341
  }
 
 
 
 
 
 
 
 
342
  $setting_name = $setting['name'];
343
  $label = $setting[ 'labels' ][$key];
344
  $html .= "<label>
77
  $settings[ $registered_setting['name'] ] = sanitize_text_field($submitted_settings[ $registered_setting['name'] ]);
78
  break;
79
  }
80
+ case 'radio' : {
81
+ $settings[ $registered_setting['name'] ] = sanitize_text_field( $submitted_settings[ $registered_setting['name'] ] );
82
+ break;
83
+ }
84
  case 'custom': {
85
  foreach ( $registered_setting['rows'] as $row_label => $row_type ) {
86
  if (isset($submitted_settings[$registered_setting['name']][$row_label])) {
233
  include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/do-not-translate-certain-paths.php');
234
  include_once (TRP_PLUGIN_DIR . 'includes/advanced-settings/opposite-flag-shortcode.php');
235
  include_once (TRP_PLUGIN_DIR . 'includes/advanced-settings/open-language-switcher-shortcode-on-click.php');
236
+ include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/hreflang-remove-locale.php');
237
  }
238
 
239
  /*
334
  */
335
  public function radio_setting( $setting ){
336
  $adv_option = $this->settings['trp_advanced_settings'];
 
337
  $html = "
338
  <tr>
339
  <th scope='row'>" . esc_html($setting['label'] ) . "</th>
340
  <td class='trp-adst-radio'>";
341
 
342
  foreach($setting[ 'options' ] as $key => $option ){
343
+
344
+ if( isset( $adv_option[ $setting['name'] ] ) && !empty( $adv_option[ $setting['name'] ] ) ){
345
+ if( $adv_option[ $setting['name'] ] === $option ){
346
+ $checked = 'checked="checked"';
347
+ }
348
+ else{
349
+ $checked = '';
350
+ }
351
  }
352
+ else{
353
+ if( $setting['default'] === $option ){
354
+ $checked = 'checked="checked"';
355
+ }
356
+ else{
357
+ $checked = '';
358
+ }
359
+ }
360
  $setting_name = $setting['name'];
361
  $label = $setting[ 'labels' ][$key];
362
  $html .= "<label>
includes/class-error-manager.php CHANGED
@@ -135,7 +135,7 @@ class TRP_Error_Manager{
135
  return;
136
  }
137
  $option = get_option( 'trp_db_errors', false );
138
- if ( $option !== false ) {
139
  foreach( $option['notifications'] as $logged_notification ) {
140
  $notifications = TRP_Plugin_Notifications::get_instance();
141
 
135
  return;
136
  }
137
  $option = get_option( 'trp_db_errors', false );
138
+ if ( $option !== false && isset($option['notifications'])) {
139
  foreach( $option['notifications'] as $logged_notification ) {
140
  $notifications = TRP_Plugin_Notifications::get_instance();
141
 
includes/class-machine-translator.php CHANGED
@@ -114,6 +114,8 @@ class TRP_Machine_Translator {
114
  }
115
 
116
  /**
 
 
117
  * Check the automatic translation API keys for Google Translate and DeepL.
118
  *
119
  * @param TRP_Translate_Press $machine_translator Machine translator instance.
@@ -124,12 +126,6 @@ class TRP_Machine_Translator {
124
  */
125
  public function automatic_translate_error_check( $machine_translator, $translation_engine, $api_key ) {
126
 
127
- //@TODO need to find a better solution as the code bellow does not work
128
-
129
- // if ($this->correct_api_key!=null){
130
- // return $this->correct_api_key;
131
- // }
132
-
133
  $is_error = false;
134
  $return_message = '';
135
 
@@ -188,11 +184,16 @@ class TRP_Machine_Translator {
188
 
189
  public function is_correct_api_key(){
190
 
191
- $machine_translator = $this;
192
- $translation_engine = $this->settings['trp_machine_translation_settings']['translation-engine'];
193
- $api_key = $this->get_api_key();
 
194
 
195
- $verification = $this->automatic_translate_error_check( $machine_translator, $translation_engine, $api_key );
 
 
 
 
196
  if($verification['error']== false) {
197
  return true;
198
  }
114
  }
115
 
116
  /**
117
+ *
118
+ * @deprecated
119
  * Check the automatic translation API keys for Google Translate and DeepL.
120
  *
121
  * @param TRP_Translate_Press $machine_translator Machine translator instance.
126
  */
127
  public function automatic_translate_error_check( $machine_translator, $translation_engine, $api_key ) {
128
 
 
 
 
 
 
 
129
  $is_error = false;
130
  $return_message = '';
131
 
184
 
185
  public function is_correct_api_key(){
186
 
187
+ if(method_exists($this, 'check_api_key_validity')){
188
+ $verification = $this->check_api_key_validity();
189
+ }else {
190
+ //we only need this values for automatic translate error check function for backwards compatibility
191
 
192
+ $machine_translator = $this;
193
+ $translation_engine = $this->settings['trp_machine_translation_settings']['translation-engine'];
194
+ $api_key = $this->get_api_key();
195
+ $verification = $this->automatic_translate_error_check( $machine_translator, $translation_engine, $api_key );
196
+ }
197
  if($verification['error']== false) {
198
  return true;
199
  }
includes/class-settings.php CHANGED
@@ -601,8 +601,20 @@ class TRP_Settings{
601
 
602
  array_unshift( $links, $settings_link );
603
 
604
- $links['go_pro'] = sprintf( '<a href="%1$s" target="_blank" style="color: #e76054; font-weight: bold;">%2$s</a>', trp_add_affiliate_id_to_link('https://translatepress.com/pricing/?utm_source=wpbackend&utm_medium=clientsite&utm_content=tpeditor&utm_campaign=tpfree'), __( 'Pro Features', 'translatepress-multilingual' ) );
605
-
 
 
 
 
 
 
 
 
 
 
 
 
606
  return $links;
607
  }
608
 
601
 
602
  array_unshift( $links, $settings_link );
603
 
604
+ if( !trp_is_paid_version() ) {
605
+ $links['go_pro'] = sprintf( '<a href="%1$s" target="_blank" style="color: #e76054; font-weight: bold;">%2$s</a>', esc_url( trp_add_affiliate_id_to_link( 'https://translatepress.com/pricing/?utm_source=wpbackend&utm_medium=clientsite&utm_content=tpeditor&utm_campaign=tpfree' ) ), esc_html__( 'Pro Features', 'translatepress-multilingual' ) );
606
+ }else {
607
+ $license_details = get_option( 'trp_license_details' );
608
+ $is_demosite = ( strpos( site_url(), 'https://demo.translatepress.com' ) !== false );
609
+ if ( !empty( $license_details ) && !$is_demosite ) {
610
+ if ( !empty( $license_details['invalid'] ) ) {
611
+ $license_detail = $license_details['invalid'][0];
612
+ if ( isset( $license_detail->error ) && $license_detail->error == 'missing' ) {
613
+ $links['license'] = sprintf( '<a href="%1$s" target="_blank" style="color: #e76054; font-weight: bold;">%2$s</a>', esc_url(trp_add_affiliate_id_to_link( admin_url( '/admin.php?page=trp_license_key' ) ) ), esc_html__( 'Activate License', 'translatepress-multilingual' ) );
614
+ }
615
+ }
616
+ }
617
+ }
618
  return $links;
619
  }
620
 
includes/class-url-converter.php CHANGED
@@ -171,11 +171,13 @@ class TRP_Url_Converter {
171
  $hreflang_duplicates = array();
172
  $hreflang_duplicates_region_independent = array();
173
  foreach ( $languages as $language ) {
174
- // hreflang should have - instead of _ . For example: en-EN, not en_EN like the locale
175
- $hreflang = str_replace( '_', '-', $language );
176
- $hreflang = apply_filters( 'trp_hreflang', $hreflang, $language );
177
- $hreflang_duplicates[] = $hreflang;
178
- echo '<link rel="alternate" hreflang="' . esc_attr( $hreflang ) . '" href="' . esc_url( $this->get_url_for_language( $language ) ) . '"/>' . "\n";
 
 
179
 
180
  if ( apply_filters( 'trp_add_region_independent_hreflang_tags', true ) ) {
181
  if ( strpos( $language, '_' ) !== false ) {
171
  $hreflang_duplicates = array();
172
  $hreflang_duplicates_region_independent = array();
173
  foreach ( $languages as $language ) {
174
+ if( apply_filters( 'trp_add_country_hreflang_tags', true ) ){
175
+ // hreflang should have - instead of _ . For example: en-EN, not en_EN like the locale
176
+ $hreflang = str_replace( '_', '-', $language );
177
+ $hreflang = apply_filters( 'trp_hreflang', $hreflang, $language );
178
+ $hreflang_duplicates[] = $hreflang;
179
+ echo '<link rel="alternate" hreflang="' . esc_attr( $hreflang ) . '" href="' . esc_url( $this->get_url_for_language( $language ) ) . '"/>' . "\n";
180
+ }
181
 
182
  if ( apply_filters( 'trp_add_region_independent_hreflang_tags', true ) ) {
183
  if ( strpos( $language, '_' ) !== false ) {
includes/google-translate/class-google-translate-v2-machine-translator.php CHANGED
@@ -161,4 +161,43 @@ class TRP_Google_Translate_V2_Machine_Translator extends TRP_Machine_Translator
161
 
162
  return $formality_supported_languages;
163
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  }
161
 
162
  return $formality_supported_languages;
163
  }
164
+
165
+ public function check_api_key_validity() {
166
+ $machine_translator = $this;
167
+ $translation_engine = $this->settings['trp_machine_translation_settings']['translation-engine'];
168
+ $api_key = $machine_translator->get_api_key();
169
+
170
+ $is_error = false;
171
+ $return_message = '';
172
+
173
+ if ( 'google_translate_v2' === $translation_engine && $this->settings['trp_machine_translation_settings']['machine-translation'] === 'yes') {
174
+
175
+ if ( isset( $this->correct_api_key ) && $this->correct_api_key != null ) {
176
+ return $this->correct_api_key;
177
+ }
178
+
179
+ if ( empty( $api_key ) ) {
180
+ $is_error = true;
181
+ $return_message = __( 'Please enter your Google Translate key.', 'translatepress-multilingual' );
182
+ } else {
183
+ // Perform test.
184
+ $response = $machine_translator->test_request();
185
+ $code = wp_remote_retrieve_response_code( $response );
186
+ if ( 200 !== $code ) {
187
+ $is_error = true;
188
+ $translate_response = trp_gt_response_codes( $code );
189
+ $return_message = $translate_response['message'];
190
+ }
191
+ }
192
+ $this->correct_api_key = array(
193
+ 'message' => $return_message,
194
+ 'error' => $is_error,
195
+ );
196
+ }
197
+
198
+ return array(
199
+ 'message' => $return_message,
200
+ 'error' => $is_error,
201
+ );
202
+ }
203
  }
includes/google-translate/functions.php CHANGED
@@ -17,7 +17,8 @@ function trp_gt_add_settings( $mt_settings ){
17
 
18
  // Check for API errors only if $translation_engine is Google.
19
  if ( 'google_translate_v2' === $translation_engine ) {
20
- $api_check = $machine_translator->automatic_translate_error_check( $machine_translator, $translation_engine, $api_key );
 
21
  }
22
 
23
  // Check for errors.
17
 
18
  // Check for API errors only if $translation_engine is Google.
19
  if ( 'google_translate_v2' === $translation_engine ) {
20
+ $api_check = $machine_translator->check_api_key_validity();
21
+
22
  }
23
 
24
  // Check for errors.
index.php CHANGED
@@ -3,14 +3,14 @@
3
  Plugin Name: TranslatePress - Multilingual
4
  Plugin URI: https://translatepress.com/
5
  Description: Experience a better way of translating your WordPress site using a visual front-end translation editor, with full support for WooCommerce and site builders.
6
- Version: 2.2.0
7
  Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
8
  Author URI: https://cozmoslabs.com/
9
  Text Domain: translatepress-multilingual
10
  Domain Path: /languages
11
  License: GPL2
12
  WC requires at least: 2.5.0
13
- WC tested up to: 6.1.1
14
 
15
  == Copyright ==
16
  Copyright 2017 Cozmoslabs (www.cozmoslabs.com)
3
  Plugin Name: TranslatePress - Multilingual
4
  Plugin URI: https://translatepress.com/
5
  Description: Experience a better way of translating your WordPress site using a visual front-end translation editor, with full support for WooCommerce and site builders.
6
+ Version: 2.2.1
7
  Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
8
  Author URI: https://cozmoslabs.com/
9
  Text Domain: translatepress-multilingual
10
  Domain Path: /languages
11
  License: GPL2
12
  WC requires at least: 2.5.0
13
+ WC tested up to: 6.2
14
 
15
  == Copyright ==
16
  Copyright 2017 Cozmoslabs (www.cozmoslabs.com)
languages/translatepress-multilingual.catalog.php CHANGED
@@ -106,6 +106,7 @@
106
  <?php __("Addons", "translatepress-multilingual"); ?>
107
  <?php __("License", "translatepress-multilingual"); ?>
108
  <?php __("Settings", "translatepress-multilingual"); ?>
 
109
  <?php __("Pro Features", "translatepress-multilingual"); ?>
110
  <?php __("Image source", "translatepress-multilingual"); ?>
111
  <?php __("Alt attribute", "translatepress-multilingual"); ?>
@@ -258,7 +259,6 @@
258
  <?php __("There are no logged errors.", "translatepress-multilingual"); ?>
259
  <?php __("If you purchased a <a href=\"%s\">premium version</a>, first install and activate it. After this you will be prompted with an input to enter your license key.", "translatepress-multilingual"); ?>
260
  <?php __("License Key", "translatepress-multilingual"); ?>
261
- <?php __("Activate License", "translatepress-multilingual"); ?>
262
  <?php __("Deactivate License", "translatepress-multilingual"); ?>
263
  <?php __("Your license is invalid", "translatepress-multilingual"); ?>
264
  <?php __("Active on this site", "translatepress-multilingual"); ?>
@@ -403,6 +403,11 @@
403
  <?php __("Fixes attributes without spaces between them because they are not valid HTML.<br> May help fix missing or broken content from the HTML on translated pages.", "translatepress-multilingual"); ?>
404
  <?php __("Force slash at end of home url:", "translatepress-multilingual"); ?>
405
  <?php __("Ads a slash at the end of the home_url() function", "translatepress-multilingual"); ?>
 
 
 
 
 
406
  <?php __("Open language switcher only on click", "translatepress-multilingual"); ?>
407
  <?php __("Open the language switcher shortcode by clicking on it instead of hovering.<br> Close it by clicking on it, anywhere else on the screen or by pressing the escape key. This will affect only the shortcode language switcher.", "translatepress-multilingual"); ?>
408
  <?php __("Show opposite language in the language switcher", "translatepress-multilingual"); ?>
106
  <?php __("Addons", "translatepress-multilingual"); ?>
107
  <?php __("License", "translatepress-multilingual"); ?>
108
  <?php __("Settings", "translatepress-multilingual"); ?>
109
+ <?php __("Activate License", "translatepress-multilingual"); ?>
110
  <?php __("Pro Features", "translatepress-multilingual"); ?>
111
  <?php __("Image source", "translatepress-multilingual"); ?>
112
  <?php __("Alt attribute", "translatepress-multilingual"); ?>
259
  <?php __("There are no logged errors.", "translatepress-multilingual"); ?>
260
  <?php __("If you purchased a <a href=\"%s\">premium version</a>, first install and activate it. After this you will be prompted with an input to enter your license key.", "translatepress-multilingual"); ?>
261
  <?php __("License Key", "translatepress-multilingual"); ?>
 
262
  <?php __("Deactivate License", "translatepress-multilingual"); ?>
263
  <?php __("Your license is invalid", "translatepress-multilingual"); ?>
264
  <?php __("Active on this site", "translatepress-multilingual"); ?>
403
  <?php __("Fixes attributes without spaces between them because they are not valid HTML.<br> May help fix missing or broken content from the HTML on translated pages.", "translatepress-multilingual"); ?>
404
  <?php __("Force slash at end of home url:", "translatepress-multilingual"); ?>
405
  <?php __("Ads a slash at the end of the home_url() function", "translatepress-multilingual"); ?>
406
+ <?php __("Show Both (recommended)", "translatepress-multilingual"); ?>
407
+ <?php __("Remove Country Locale", "translatepress-multilingual"); ?>
408
+ <?php __("Remove Region Independent Locale", "translatepress-multilingual"); ?>
409
+ <?php __("Remove duplicate hreflang", "translatepress-multilingual"); ?>
410
+ <?php __("Choose which hreflang tags will appear on your website.<br/>We recommend showing both types of hreflang tags as indicated by <a href=\"https://developers.google.com/search/docs/advanced/crawling/localized-versions\" title=\"Google Crawling\" target=\"_blank\">Google documentation</a>.<br/>Removing Country Locale when having multiple Country Locales of the same language (ex. English UK and English US) will result in showing one hreflang tag with link to just one of the region locales for that language.", "translatepress-multilingual"); ?>
411
  <?php __("Open language switcher only on click", "translatepress-multilingual"); ?>
412
  <?php __("Open the language switcher shortcode by clicking on it instead of hovering.<br> Close it by clicking on it, anywhere else on the screen or by pressing the escape key. This will affect only the shortcode language switcher.", "translatepress-multilingual"); ?>
413
  <?php __("Show opposite language in the language switcher", "translatepress-multilingual"); ?>
languages/translatepress-multilingual.pot CHANGED
@@ -45,27 +45,27 @@ msgstr ""
45
  msgid "Advanced"
46
  msgstr ""
47
 
48
- #: includes/class-advanced-tab.php:181
49
  msgid "Settings saved."
50
  msgstr ""
51
 
52
- #: includes/class-advanced-tab.php:313, includes/class-error-manager.php:172, partials/machine-translation-settings-page.php:13, partials/machine-translation-settings-page.php:117, partials/machine-translation-settings-page.php:150, partials/main-settings-page.php:42, partials/main-settings-page.php:55, partials/main-settings-page.php:68
53
  msgid "Yes"
54
  msgstr ""
55
 
56
- #: includes/class-advanced-tab.php:510, includes/class-advanced-tab.php:521, includes/class-advanced-tab.php:615, includes/class-advanced-tab.php:646
57
  msgid "Are you sure you want to remove this item?"
58
  msgstr ""
59
 
60
- #: includes/class-advanced-tab.php:510, includes/class-advanced-tab.php:521, includes/class-advanced-tab.php:615, includes/class-advanced-tab.php:646, partials/main-settings-language-selector.php:60, add-ons-advanced/extra-languages/partials/language-selector-pro.php:62
61
  msgid "Remove"
62
  msgstr ""
63
 
64
- #: includes/class-advanced-tab.php:521, includes/class-advanced-tab.php:646, partials/main-settings-language-selector.php:102, add-ons-advanced/extra-languages/partials/language-selector-pro.php:103
65
  msgid "Add"
66
  msgstr ""
67
 
68
- #: includes/class-advanced-tab.php:599, includes/class-advanced-tab.php:633
69
  msgid "Select..."
70
  msgstr ""
71
 
@@ -297,11 +297,11 @@ msgstr ""
297
  msgid "(last checked on %s)"
298
  msgstr ""
299
 
300
- #: includes/class-machine-translator.php:140
301
  msgid "Please enter your Google Translate key."
302
  msgstr ""
303
 
304
- #: includes/class-machine-translator.php:155
305
  msgid "Please enter your DeepL API key."
306
  msgstr ""
307
 
@@ -441,7 +441,11 @@ msgstr ""
441
  msgid "Settings"
442
  msgstr ""
443
 
444
- #: includes/class-settings.php:604
 
 
 
 
445
  msgid "Pro Features"
446
  msgstr ""
447
 
@@ -1049,10 +1053,6 @@ msgstr ""
1049
  msgid "License Key"
1050
  msgstr ""
1051
 
1052
- #: partials/license-settings-page.php:32
1053
- msgid "Activate License"
1054
- msgstr ""
1055
-
1056
  #: partials/license-settings-page.php:22
1057
  msgid "Deactivate License"
1058
  msgstr ""
@@ -1363,11 +1363,11 @@ msgstr ""
1363
  msgid "Response:"
1364
  msgstr ""
1365
 
1366
- #: partials/test-api-settings-page.php:27
1367
  msgid "Response Body:"
1368
  msgstr ""
1369
 
1370
- #: partials/test-api-settings-page.php:32
1371
  msgid "Entire Response From wp_remote_get():"
1372
  msgstr ""
1373
 
@@ -1635,6 +1635,26 @@ msgstr ""
1635
  msgid "Ads a slash at the end of the home_url() function"
1636
  msgstr ""
1637
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1638
  #: includes/advanced-settings/open-language-switcher-shortcode-on-click.php:8
1639
  msgid "Open language switcher only on click"
1640
  msgstr ""
@@ -1699,23 +1719,23 @@ msgstr ""
1699
  msgid "Google Translate v2"
1700
  msgstr ""
1701
 
1702
- #: includes/google-translate/functions.php:40
1703
  msgid "Google Translate API Key"
1704
  msgstr ""
1705
 
1706
- #: includes/google-translate/functions.php:60
1707
  msgid "Visit <a href=\"https://cloud.google.com/docs/authentication/api-keys\" target=\"_blank\">this link</a> to see how you can set up an API key, <strong>control API costs</strong> and set HTTP referrer restrictions."
1708
  msgstr ""
1709
 
1710
- #: includes/google-translate/functions.php:61
1711
  msgid "Your HTTP referrer is: %s"
1712
  msgstr ""
1713
 
1714
- #: includes/google-translate/functions.php:100
1715
  msgid "There was an error on the server processing your Google Translate key."
1716
  msgstr ""
1717
 
1718
- #: includes/google-translate/functions.php:97
1719
  msgid "There was an error with your Google Translate key."
1720
  msgstr ""
1721
 
45
  msgid "Advanced"
46
  msgstr ""
47
 
48
+ #: includes/class-advanced-tab.php:185
49
  msgid "Settings saved."
50
  msgstr ""
51
 
52
+ #: includes/class-advanced-tab.php:318, includes/class-error-manager.php:172, partials/machine-translation-settings-page.php:13, partials/machine-translation-settings-page.php:117, partials/machine-translation-settings-page.php:150, partials/main-settings-page.php:42, partials/main-settings-page.php:55, partials/main-settings-page.php:68
53
  msgid "Yes"
54
  msgstr ""
55
 
56
+ #: includes/class-advanced-tab.php:528, includes/class-advanced-tab.php:539, includes/class-advanced-tab.php:633, includes/class-advanced-tab.php:664
57
  msgid "Are you sure you want to remove this item?"
58
  msgstr ""
59
 
60
+ #: includes/class-advanced-tab.php:528, includes/class-advanced-tab.php:539, includes/class-advanced-tab.php:633, includes/class-advanced-tab.php:664, partials/main-settings-language-selector.php:60, add-ons-advanced/extra-languages/partials/language-selector-pro.php:62
61
  msgid "Remove"
62
  msgstr ""
63
 
64
+ #: includes/class-advanced-tab.php:539, includes/class-advanced-tab.php:664, partials/main-settings-language-selector.php:102, add-ons-advanced/extra-languages/partials/language-selector-pro.php:103
65
  msgid "Add"
66
  msgstr ""
67
 
68
+ #: includes/class-advanced-tab.php:617, includes/class-advanced-tab.php:651
69
  msgid "Select..."
70
  msgstr ""
71
 
297
  msgid "(last checked on %s)"
298
  msgstr ""
299
 
300
+ #: includes/class-machine-translator.php:136, includes/google-translate/class-google-translate-v2-machine-translator.php:181
301
  msgid "Please enter your Google Translate key."
302
  msgstr ""
303
 
304
+ #: includes/class-machine-translator.php:151, add-ons-pro/deepl/includes/class-deepl-machine-translator.php:286
305
  msgid "Please enter your DeepL API key."
306
  msgstr ""
307
 
441
  msgid "Settings"
442
  msgstr ""
443
 
444
+ #: includes/class-settings.php:613, partials/license-settings-page.php:32
445
+ msgid "Activate License"
446
+ msgstr ""
447
+
448
+ #: includes/class-settings.php:605
449
  msgid "Pro Features"
450
  msgstr ""
451
 
1053
  msgid "License Key"
1054
  msgstr ""
1055
 
 
 
 
 
1056
  #: partials/license-settings-page.php:22
1057
  msgid "Deactivate License"
1058
  msgstr ""
1363
  msgid "Response:"
1364
  msgstr ""
1365
 
1366
+ #: partials/test-api-settings-page.php:32
1367
  msgid "Response Body:"
1368
  msgstr ""
1369
 
1370
+ #: partials/test-api-settings-page.php:42
1371
  msgid "Entire Response From wp_remote_get():"
1372
  msgstr ""
1373
 
1635
  msgid "Ads a slash at the end of the home_url() function"
1636
  msgstr ""
1637
 
1638
+ #: includes/advanced-settings/hreflang-remove-locale.php:10
1639
+ msgid "Show Both (recommended)"
1640
+ msgstr ""
1641
+
1642
+ #: includes/advanced-settings/hreflang-remove-locale.php:10
1643
+ msgid "Remove Country Locale"
1644
+ msgstr ""
1645
+
1646
+ #: includes/advanced-settings/hreflang-remove-locale.php:10
1647
+ msgid "Remove Region Independent Locale"
1648
+ msgstr ""
1649
+
1650
+ #: includes/advanced-settings/hreflang-remove-locale.php:11
1651
+ msgid "Remove duplicate hreflang"
1652
+ msgstr ""
1653
+
1654
+ #: includes/advanced-settings/hreflang-remove-locale.php:12
1655
+ msgid "Choose which hreflang tags will appear on your website.<br/>We recommend showing both types of hreflang tags as indicated by <a href=\"https://developers.google.com/search/docs/advanced/crawling/localized-versions\" title=\"Google Crawling\" target=\"_blank\">Google documentation</a>.<br/>Removing Country Locale when having multiple Country Locales of the same language (ex. English UK and English US) will result in showing one hreflang tag with link to just one of the region locales for that language."
1656
+ msgstr ""
1657
+
1658
  #: includes/advanced-settings/open-language-switcher-shortcode-on-click.php:8
1659
  msgid "Open language switcher only on click"
1660
  msgstr ""
1719
  msgid "Google Translate v2"
1720
  msgstr ""
1721
 
1722
+ #: includes/google-translate/functions.php:41
1723
  msgid "Google Translate API Key"
1724
  msgstr ""
1725
 
1726
+ #: includes/google-translate/functions.php:61
1727
  msgid "Visit <a href=\"https://cloud.google.com/docs/authentication/api-keys\" target=\"_blank\">this link</a> to see how you can set up an API key, <strong>control API costs</strong> and set HTTP referrer restrictions."
1728
  msgstr ""
1729
 
1730
+ #: includes/google-translate/functions.php:62
1731
  msgid "Your HTTP referrer is: %s"
1732
  msgstr ""
1733
 
1734
+ #: includes/google-translate/functions.php:101
1735
  msgid "There was an error on the server processing your Google Translate key."
1736
  msgstr ""
1737
 
1738
+ #: includes/google-translate/functions.php:98
1739
  msgid "There was an error with your Google Translate key."
1740
  msgstr ""
1741
 
partials/error-manager-page.php CHANGED
@@ -5,7 +5,7 @@
5
  if ( $page_output === '' ){
6
  $page_output = esc_html__('There are no logged errors.', 'translatepress-multilingual');
7
  }
8
- echo esc_html( $page_output );
9
 
10
  ?>
11
 
5
  if ( $page_output === '' ){
6
  $page_output = esc_html__('There are no logged errors.', 'translatepress-multilingual');
7
  }
8
+ echo $page_output; /* phpcs:ignore */ /* sanitized in the functions hooked to the filters */
9
 
10
  ?>
11
 
partials/test-api-settings-page.php CHANGED
@@ -22,16 +22,31 @@ $api_key = $machine_translator->get_api_key();
22
 
23
  <h3><?php esc_html_e('Response:', 'translatepress-multilingual');?></h3>
24
  <pre>
25
- <?php print_r( $response["response"] ); ?>
 
 
 
 
 
26
  </pre>
27
  <h3><?php esc_html_e('Response Body:', 'translatepress-multilingual');?></h3>
28
  <pre>
29
- <?php print_r( esc_html( $response["body"] ) ); ?>
 
 
 
 
 
30
  </pre>
31
 
32
  <h3><?php esc_html_e('Entire Response From wp_remote_get():', 'translatepress-multilingual');?></h3>
33
  <pre>
34
- <?php print_r( $response ); ?>
 
 
 
 
 
35
  </pre>
36
  </div>
37
  </div>
22
 
23
  <h3><?php esc_html_e('Response:', 'translatepress-multilingual');?></h3>
24
  <pre>
25
+ <?php
26
+ ob_start();
27
+ !is_wp_error( $response ) ? print_r( $response["response"] ) : print_r( $response->get_error_message() );
28
+ $buffer = ob_get_clean();
29
+ echo '<pre>' . esc_html( $buffer ) . '</pre>';
30
+ ?>
31
  </pre>
32
  <h3><?php esc_html_e('Response Body:', 'translatepress-multilingual');?></h3>
33
  <pre>
34
+ <?php
35
+ ob_start();
36
+ !is_wp_error( $response ) ? print_r( esc_html( $response["body"] ) ) : print_r( $response->get_error_data() );
37
+ $buffer = ob_get_clean();
38
+ echo '<pre>' . esc_html( $buffer ) . '</pre>';
39
+ ?>
40
  </pre>
41
 
42
  <h3><?php esc_html_e('Entire Response From wp_remote_get():', 'translatepress-multilingual');?></h3>
43
  <pre>
44
+ <?php
45
+ ob_start();
46
+ print_r( $response );
47
+ $buffer = ob_get_clean();
48
+ echo '<pre>' . esc_html( $buffer ) . '</pre>';
49
+ ?>
50
  </pre>
51
  </div>
52
  </div>
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: translate, translation, multilingual, automatic translation, bilingual, fr
5
  Requires at least: 3.1.0
6
  Tested up to: 5.9
7
  Requires PHP: 5.6.20
8
- Stable tag: 2.2.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -140,6 +140,15 @@ For more information please check out our [documentation](https://translatepress
140
 
141
 
142
  == Changelog ==
 
 
 
 
 
 
 
 
 
143
  = 2.2.0 =
144
  * Fixed language slug incorrectly ending up in .htaccess in some cases
145
  * Fixed issue in hreflang tags when using certain custom language codes
5
  Requires at least: 3.1.0
6
  Tested up to: 5.9
7
  Requires PHP: 5.6.20
8
+ Stable tag: 2.2.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
140
 
141
 
142
  == Changelog ==
143
+ = 2.2.1 =
144
+ * Added Advanced option to adjust hreflang to hide region independent language tags or country locale tags
145
+ * Added missing flags for Tamil (Sri Lanka), Spanish (Ecuador), Spanish (Dominican Republic), Amharic
146
+ * Improved Automatic Translation tab checking for translation API key validity
147
+ * Improved Plugins interface action buttons for TP by taking into account free/pro status
148
+ * Fixed error management interface displaying raw HTML instead of formatted HTML
149
+ * Fixed notice in admin for an edge case
150
+ * Fixed notice in Test API Page when test request resulted in WP Error
151
+
152
  = 2.2.0 =
153
  * Fixed language slug incorrectly ending up in .htaccess in some cases
154
  * Fixed issue in hreflang tags when using certain custom language codes