Lingotek Translation - Version 1.5.2

Version Description

(2021-11-05) = - Removed the cancel action from the target dropdown - Fixed duplicated message "Your Lingotek account has been successfully connected." - Unable to add language-only locale if same language code already exists - Fixed Cancel translation for specific targets from bulk action displays an irrelevant message

Download this release

Release Info

Developer sowmiya2021
Plugin Icon 128x128 Lingotek Translation
Version 1.5.2
Comparing to
See all releases

Code changes from version 1.5.1 to 1.5.2

admin/actions.php CHANGED
@@ -693,8 +693,10 @@ abstract class Lingotek_Actions {
693
  if ( strpos( $action, '-translation' ) && ! $action_data['per_locale'] ) {
694
  continue;
695
  }
696
- // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText,WordPress.WP.I18n.NonSingularStringLiteralDomain
697
- $bulk_actions[ 'bulk-lingotek-' . $action ] = __( $action_data['action'], $action );
 
 
698
  if ( null !== filter_input( INPUT_GET, 'bulk-lingotek-' . $action ) ) {
699
  $text = $action_data['progress'];
700
  }
693
  if ( strpos( $action, '-translation' ) && ! $action_data['per_locale'] ) {
694
  continue;
695
  }
696
+ if ( !$action_data['per_locale'] ) {
697
+ // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText,WordPress.WP.I18n.NonSingularStringLiteralDomain
698
+ $bulk_actions[ 'bulk-lingotek-' . $action ] = __( $action_data['action'], $action );
699
+ }
700
  if ( null !== filter_input( INPUT_GET, 'bulk-lingotek-' . $action ) ) {
701
  $text = $action_data['progress'];
702
  }
admin/admin.php CHANGED
@@ -294,22 +294,9 @@ class Lingotek_Admin {
294
  // connect Lingotek account.
295
  $database_token_details = get_option( 'lingotek_token', array() );
296
  $access_token = isset( $database_token_details['access_token'] ) ? $database_token_details['access_token'] : null;
297
- if ( ! empty( $access_token ) && empty( $delete_access_token ) ) {
298
- // set and get token details.
299
- $client = new Lingotek_API();
300
- $token_details = $client->get_token_details( $access_token );
301
- if ( $token_details && strlen( $token_details->login_id ) ) {
302
- update_option(
303
- 'lingotek_token',
304
- array(
305
- 'access_token' => $access_token,
306
- 'login_id' => $token_details->login_id,
307
- )
308
- );
309
- add_settings_error( 'lingotek_token', 'account-connection', __( 'Your Lingotek account has been successfully connected.', 'lingotek-translation' ), 'updated' );
310
- } else {
311
- add_settings_error( 'lingotek_token', 'account-connection', __( 'Your Lingotek account was not connected. The Access Token received was invalid.', 'lingotek-translation' ), 'error' );
312
- }
313
  }
314
 
315
  // set page key primarily used for form submissions.
@@ -326,6 +313,7 @@ class Lingotek_Admin {
326
  update_option( 'lingotek_community', $lingotek_community );
327
  add_settings_error( 'lingotek_community', 'update', __( 'Your community has been successfully saved.', 'lingotek-translation' ), 'updated' );
328
  $this->set_community_resources( $lingotek_community );
 
329
  }
330
  $community_id = get_option( 'lingotek_community' );
331
  if ( ! $community_id ) {
@@ -357,6 +345,31 @@ class Lingotek_Admin {
357
  }
358
  }
359
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
360
  /**
361
  * Get possible settings for defaults or translation profiles
362
  *
294
  // connect Lingotek account.
295
  $database_token_details = get_option( 'lingotek_token', array() );
296
  $access_token = isset( $database_token_details['access_token'] ) ? $database_token_details['access_token'] : null;
297
+ if ( ! empty( $access_token ) && empty( $delete_access_token ) && ! isset( $database_token_details['login_id'] ) ) {
298
+ // Set and get token details, but only if the login_id is not already set.
299
+ $this->refresh_lingotek_token( $access_token );
 
 
 
 
 
 
 
 
 
 
 
 
 
300
  }
301
 
302
  // set page key primarily used for form submissions.
313
  update_option( 'lingotek_community', $lingotek_community );
314
  add_settings_error( 'lingotek_community', 'update', __( 'Your community has been successfully saved.', 'lingotek-translation' ), 'updated' );
315
  $this->set_community_resources( $lingotek_community );
316
+ $this->refresh_lingotek_token( $access_token );
317
  }
318
  $community_id = get_option( 'lingotek_community' );
319
  if ( ! $community_id ) {
345
  }
346
  }
347
 
348
+ /**
349
+ * Refreshes the lingotek access token and stores the login id.
350
+ *
351
+ * @param string $access_token
352
+ * The access token to be refreshed.
353
+ *
354
+ * @since 1.5.2
355
+ */
356
+ public function refresh_lingotek_token( $access_token ) {
357
+ $client = new Lingotek_API();
358
+ $token_details = $client->get_token_details( $access_token );
359
+ if ( $token_details && strlen( $token_details->login_id ) ) {
360
+ update_option(
361
+ 'lingotek_token',
362
+ array(
363
+ 'access_token' => $access_token,
364
+ 'login_id' => $token_details->login_id,
365
+ )
366
+ );
367
+ add_settings_error( 'lingotek_token', 'account-connection', __( 'Your Lingotek account has been successfully connected.', 'lingotek-translation' ), 'updated' );
368
+ } else {
369
+ add_settings_error( 'lingotek_token', 'account-connection', __( 'Your Lingotek account was not connected. The Access Token received was invalid.', 'lingotek-translation' ), 'error' );
370
+ }
371
+ }
372
+
373
  /**
374
  * Get possible settings for defaults or translation profiles
375
  *
admin/chip-target.php CHANGED
@@ -104,7 +104,13 @@ class Lingotek_Chip_Target extends Lingotek_Chip_Base {
104
  sprintf( __( 'Cancel translation', 'lingotek-translation' ), $language->locale )
105
  );
106
  }
107
- if ( in_array( $status, array( 'ready', 'error', 'failed' ), true ) ) {
 
 
 
 
 
 
108
  $urls[] = new Lingotek_Action_Url(
109
  $post_actions->download_translation_url( $this->id, $this->document, $language->locale ),
110
  sprintf( __( 'Download translation', 'lingotek-translation' ), $language->locale )
104
  sprintf( __( 'Cancel translation', 'lingotek-translation' ), $language->locale )
105
  );
106
  }
107
+ if ( in_array( $status, array( 'ready'), true ) ) {
108
+ $urls[] = new Lingotek_Action_Url(
109
+ $post_actions->download_translation_url( $this->id, $this->document, $language->locale ),
110
+ sprintf( __( 'Download translation', 'lingotek-translation' ), $language->locale )
111
+ );
112
+ }
113
+ if ( in_array( $status, array('error', 'failed' ), true ) ) {
114
  $urls[] = new Lingotek_Action_Url(
115
  $post_actions->download_translation_url( $this->id, $this->document, $language->locale ),
116
  sprintf( __( 'Download translation', 'lingotek-translation' ), $language->locale )
admin/filters-columns.php CHANGED
@@ -80,6 +80,9 @@ class Lingotek_Filters_Columns extends PLL_Admin_Filters_Columns {
80
  private function print_cancel_error() {
81
  $lingotek_log_errors = get_option( 'lingotek_log_errors' );
82
  $message = isset( $lingotek_log_errors['disassociate_document_error'] ) ? $lingotek_log_errors['disassociate_document_error'] : '';
 
 
 
83
  if ( get_option( 'disassociate_source_failed', false ) ) {
84
  $message = str_replace( 'cancel', 'delete', $message );
85
  printf(
80
  private function print_cancel_error() {
81
  $lingotek_log_errors = get_option( 'lingotek_log_errors' );
82
  $message = isset( $lingotek_log_errors['disassociate_document_error'] ) ? $lingotek_log_errors['disassociate_document_error'] : '';
83
+ if ( $message === '' ) {
84
+ return;
85
+ }
86
  if ( get_option( 'disassociate_source_failed', false ) ) {
87
  $message = str_replace( 'cancel', 'delete', $message );
88
  printf(
include/api.php CHANGED
@@ -932,7 +932,9 @@ class Lingotek_API extends Lingotek_HTTP {
932
  // Use the response message if it's an authorization error
933
  $response_error_message = 403 == wp_remote_retrieve_response_code( $response ) && $this->get_error_message_from_response( $response ) !== false ?
934
  $this->get_error_message_from_response( $response ) : false;
935
- $error_message = $response_error_message ? $response_error_message : "{$locale} was already completed in the TMS and cannot be cancelled unless the entire document is cancelled.";
 
 
936
  $lingotek_log_errors['disassociate_document_error'] = $error_message;
937
  update_option( 'lingotek_log_errors', $lingotek_log_errors, false );
938
 
932
  // Use the response message if it's an authorization error
933
  $response_error_message = 403 == wp_remote_retrieve_response_code( $response ) && $this->get_error_message_from_response( $response ) !== false ?
934
  $this->get_error_message_from_response( $response ) : false;
935
+ if ( $response_error_message ) {
936
+ $error_message = $response_error_message;
937
+ }
938
  $lingotek_log_errors['disassociate_document_error'] = $error_message;
939
  update_option( 'lingotek_log_errors', $lingotek_log_errors, false );
940
 
lingotek.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  Plugin name: Lingotek Translation
4
  Plugin URI: http://lingotek.com/wordpress#utm_source=wpadmin&utm_medium=plugin&utm_campaign=wplingotektranslationplugin
5
- Version: 1.5.1
6
  Author: Lingotek and Frédéric Demarle
7
  Author uri: http://lingotek.com
8
  Description: Lingotek offers convenient cloud-based localization and translation.
@@ -19,7 +19,7 @@ if ( ! function_exists( 'add_action' ) ) {
19
  }
20
 
21
  // Plugin version (should match above meta).
22
- define( 'LINGOTEK_VERSION', '1.5.1' );
23
  define( 'LINGOTEK_MIN_PLL_VERSION', '1.8' );
24
  // Plugin name as known by WordPress.
25
  define( 'LINGOTEK_BASENAME', plugin_basename( __FILE__ ) );
2
  /**
3
  Plugin name: Lingotek Translation
4
  Plugin URI: http://lingotek.com/wordpress#utm_source=wpadmin&utm_medium=plugin&utm_campaign=wplingotektranslationplugin
5
+ Version: 1.5.2
6
  Author: Lingotek and Frédéric Demarle
7
  Author uri: http://lingotek.com
8
  Description: Lingotek offers convenient cloud-based localization and translation.
19
  }
20
 
21
  // Plugin version (should match above meta).
22
+ define( 'LINGOTEK_VERSION', '1.5.2' );
23
  define( 'LINGOTEK_MIN_PLL_VERSION', '1.8' );
24
  // Plugin name as known by WordPress.
25
  define( 'LINGOTEK_BASENAME', plugin_basename( __FILE__ ) );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://lingotek.com/
4
  Tags: automation, bilingual, international, language, Lingotek, localization, multilanguage, multilingual, translate, translation
5
  Requires at least: 3.8
6
  Tested up to: 5.8
7
- Stable tag: 1.5.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -24,7 +24,7 @@ WordPress administrators use Translation Profiles to categorize content by its r
24
 
25
  * __Community__ - If you're looking to save money by avoiding professional translation, you can take the do-it-yourself approach and have your bilingual employees, partners and/or users perform translations right within Wordpress. The plugin integrates with and provides use of the Lingotek Workbench, a professional-grade text editor used for translating, reviewing, and post-editing multilingual content.
26
 
27
- * __Free Automatic__ - Machine translation is an excellent option if you're on a tight budget, looking for near-instant results, and are okay with less-than-perfect quality. The plugin allows you to quickly and automatically translate your site by providing use of the commercial API for Microsoft Translator (the cost is covered by Lingotek for up to 100,000 characters). Machine translations can be post-edited at any time using the Lingotek Workbench.
28
 
29
  = Cloud-Based Translation Management System =
30
 
@@ -51,6 +51,7 @@ Lingotek works in conjuction with the [Polylang](https://wordpress.org/plugins/p
51
  * Categories, post tags, and some other metas are automatically copied when adding a new post or page translation.
52
  * A customizable language switcher is provided as a widget or in the nav menu.
53
  * The admin interface is of course multilingual too and each user can set the WordPress admin language in its profile.
 
54
 
55
  = Credits =
56
 
@@ -122,6 +123,12 @@ For more, visit the [Lingotek documentation site](https://lingotek.atlassian.net
122
  5. The Lingotek Translation plugin provides the ability to Copy, Translate, and Ignore each specific custom field. Our plugin supports Wordpress custom fields and advanced custom fields.
123
 
124
  == Changelog ==
 
 
 
 
 
 
125
  = 1.5.1 (2021-08-19) =
126
  - Compatibility issues with PolyLang 3.1
127
  - Add check for the Document Status
4
  Tags: automation, bilingual, international, language, Lingotek, localization, multilanguage, multilingual, translate, translation
5
  Requires at least: 3.8
6
  Tested up to: 5.8
7
+ Stable tag: 1.5.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
24
 
25
  * __Community__ - If you're looking to save money by avoiding professional translation, you can take the do-it-yourself approach and have your bilingual employees, partners and/or users perform translations right within Wordpress. The plugin integrates with and provides use of the Lingotek Workbench, a professional-grade text editor used for translating, reviewing, and post-editing multilingual content.
26
 
27
+ * __Free Automatic__ - Machine translation is an excellent option if youre on a tight budget, looking for near-instant results, and are okay with less-than-perfect quality. The plugin allows you to automatically translate your site by providing the commercial API for Microsoft Translator. You can upload up to 20,000 processed words in the Lingotek system for free (we calculate processed words by multiplying the source word count by the number of requested translations). Machine translations can be post-edited at any time using the Lingotek Workbench.
28
 
29
  = Cloud-Based Translation Management System =
30
 
51
  * Categories, post tags, and some other metas are automatically copied when adding a new post or page translation.
52
  * A customizable language switcher is provided as a widget or in the nav menu.
53
  * The admin interface is of course multilingual too and each user can set the WordPress admin language in its profile.
54
+ * We maintain the privacy of free automatic users by deleting all completed content from our TMS older than one month and active content older than two months. To ensure this does not affect your translated content, please download your translation soon after they are complete, or set your download settings to automatic. Enterprise customers should coordinate with client success about their community’s archive and deletion timeframes.
55
 
56
  = Credits =
57
 
123
  5. The Lingotek Translation plugin provides the ability to Copy, Translate, and Ignore each specific custom field. Our plugin supports Wordpress custom fields and advanced custom fields.
124
 
125
  == Changelog ==
126
+ = 1.5.2 (2021-11-05) =
127
+ - Removed the cancel action from the target dropdown
128
+ - Fixed duplicated message "Your Lingotek account has been successfully connected."
129
+ - Unable to add language-only locale if same language code already exists
130
+ - Fixed Cancel translation for specific targets from bulk action displays an irrelevant message
131
+
132
  = 1.5.1 (2021-08-19) =
133
  - Compatibility issues with PolyLang 3.1
134
  - Add check for the Document Status