Lingotek Translation - Version 1.4.7

Version Description

(2020-5-13) = * Changed workebench URL to allow for In-Context translation using the new workbench * Returns more descriptive error message on delete and cancel translation

Download this release

Release Info

Developer elliothanna
Plugin Icon 128x128 Lingotek Translation
Version 1.4.7
Comparing to
See all releases

Code changes from version 1.4.6 to 1.4.7

admin/actions.php CHANGED
@@ -233,55 +233,9 @@ abstract class Lingotek_Actions {
233
  * @return string workbench link
234
  */
235
  public static function workbench_link( $document_id, $locale ) {
236
- $client_id = Lingotek_API::CLIENT_ID;
237
- $token_details = get_option( 'lingotek_token' );
238
- $user = wp_get_current_user();
239
- $base_url = get_option( 'lingotek_base_url' );
240
-
241
- $acting_login_id = $user->user_email; // user_nicename;
242
-
243
- return self::generate_workbench_link(
244
- $document_id,
245
- $locale,
246
- $client_id,
247
- $token_details['access_token'],
248
- $token_details['login_id'],
249
- $acting_login_id,
250
- $base_url
251
- );
252
- }
253
-
254
- /**
255
- * Generates a workbench link
256
- * function provided by Matt Smith from Lingotek
257
- *
258
- * @since 0.1
259
- *
260
- * @param string $document_id
261
- * @param string $locale_code
262
- * @param string $client_id
263
- * @param string $access_token
264
- * @param string $login_id
265
- * @param string $acting_login_id
266
- * @param string $base_url
267
- * @param int|null $expiration
268
- * @return string workbench link
269
- */
270
- public static function generate_workbench_link( $document_id, $locale_code, $client_id, $access_token, $login_id, $acting_login_id = 'anonymous', $base_url = 'https://myaccount.lingotek.com', $expiration = null ) {
271
- $expiration_default = time() + (60 * 30); // 30-minute default, otherwise use $expiration as passed in
272
- $expiration = is_null( $expiration ) ? $expiration_default : $expiration;
273
- $data = array(
274
- 'document_id' => $document_id,
275
- 'locale_code' => $locale_code,
276
- 'client_id' => $client_id,
277
- 'login_id' => $login_id,
278
- 'acting_login_id' => $acting_login_id,
279
- 'expiration' => $expiration,
280
- );
281
- $query_data = utf8_encode( http_build_query( $data ) );
282
- $hmac = rawurlencode( base64_encode( hash_hmac( 'sha1', $query_data, $access_token, true ) ) );
283
- $workbench_url = $base_url . '/lingopoint/portal/wb.action?' . $query_data . '&hmac=' . $hmac;
284
- return $workbench_url;
285
  }
286
 
287
  /**
@@ -547,10 +501,10 @@ abstract class Lingotek_Actions {
547
  }
548
 
549
  $target_locale = $this->get_language($target_id)->locale;
550
- if ( $id == $target_id && isset( $document->source ) ) {
551
  $actions['lingotek-cancel'] = $this->get_action_link( array( 'document_id' => $document->document_id, 'action' => 'cancel' ), true );
552
  $actions['lingotek-delete'] = $this->get_action_link( array( 'document_id' => $document->document_id, 'action' => 'delete' ), true );
553
- } else if ( isset($document->source) && isset($document->translations[$target_locale]) && $document->translations[$target_locale] != 'cancelled' ) {
554
  $actions['lingotek-cancel-translation'] = $this->get_action_link(array('document_id' => $document->document_id, 'target_id' => $target_id, 'target_locale' => $target_locale, 'action' => 'cancel-translation'), true);
555
  $actions['lingotek-delete-translation'] = $this->get_action_link(array('document_id' => $document->document_id, 'target_id' => $target_id, 'target_locale' => $target_locale, 'action' => 'delete-translation'), true);
556
  }
@@ -776,7 +730,6 @@ abstract class Lingotek_Actions {
776
  if ( $document && $document->source == $id ) {
777
  $document->cancel();
778
  } else if ($document && $document->source != $id && $language){
779
-
780
  $document->cancel_translation($language, $id);
781
  }
782
  die();
233
  * @return string workbench link
234
  */
235
  public static function workbench_link( $document_id, $locale ) {
236
+ $document_id = $document_id ?: '';
237
+ $locale = $locale ? Lingotek::map_to_lingotek_locale($locale) : '';
238
+ return Lingotek_API::PRODUCTION_URL . "/workbench/document/$document_id/locale/$locale";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
239
  }
240
 
241
  /**
501
  }
502
 
503
  $target_locale = $this->get_language($target_id)->locale;
504
+ if ( $id == $target_id && isset( $document->source ) && $document->status !== 'cancelled' ) {
505
  $actions['lingotek-cancel'] = $this->get_action_link( array( 'document_id' => $document->document_id, 'action' => 'cancel' ), true );
506
  $actions['lingotek-delete'] = $this->get_action_link( array( 'document_id' => $document->document_id, 'action' => 'delete' ), true );
507
+ } else if ( isset($document->source) && isset($document->translations[$target_locale]) && $document->translations[$target_locale] != 'cancelled' ) {
508
  $actions['lingotek-cancel-translation'] = $this->get_action_link(array('document_id' => $document->document_id, 'target_id' => $target_id, 'target_locale' => $target_locale, 'action' => 'cancel-translation'), true);
509
  $actions['lingotek-delete-translation'] = $this->get_action_link(array('document_id' => $document->document_id, 'target_id' => $target_id, 'target_locale' => $target_locale, 'action' => 'delete-translation'), true);
510
  }
730
  if ( $document && $document->source == $id ) {
731
  $document->cancel();
732
  } else if ($document && $document->source != $id && $language){
 
733
  $document->cancel_translation($language, $id);
734
  }
735
  die();
admin/filters-columns.php CHANGED
@@ -59,25 +59,29 @@ class Lingotek_Filters_Columns extends PLL_Admin_Filters_Columns {
59
  }
60
 
61
  private function print_cancel_error() {
 
 
62
  if (get_option('disassociate_source_failed', FALSE)) {
 
63
  printf('<div class="notice notice-warning is-dismissible">
64
- <p>Could not cancel source. Associated documents will not be deleted from WordPress.</p>
65
- </div>');
66
  update_option('disassociate_source_failed', FALSE);
67
  } elseif (get_option('disassociate_target_failed', FALSE)) {
 
68
  printf('<div class="notice notice-warning is-dismissible">
69
- <p>Could not cancel target. Target will not be deleted from WordPress.</p>
70
- </div>');
71
  update_option('disassociate_target_failed', FALSE);
72
  } elseif (get_option('cancel_source_failed', FALSE)) {
73
  printf('<div class="notice notice-warning is-dismissible">
74
- <p>Could not cancel source. Process failed or source is already completed. Check TMS for details.</p>
75
- </div>');
76
  update_option('cancel_source_failed', FALSE);
77
  } elseif (get_option('cancel_target_failed', FALSE)) {
78
  printf('<div class="notice notice-warning is-dismissible">
79
- <p>Could not cancel target. Process failed or target is already completed. Check TMS for details.</p>
80
- </div>');
81
  update_option('cancel_target_failed', FALSE);
82
  }
83
  }
@@ -200,6 +204,9 @@ class Lingotek_Filters_Columns extends PLL_Admin_Filters_Columns {
200
  elseif ($document->status == 'failed') {
201
  return $actions->failed_import_icon($document->status, $object_id);
202
  }
 
 
 
203
  // no translation.
204
  else {
205
  return '<div class="lingotek-color dashicons dashicons-no"></div>';
59
  }
60
 
61
  private function print_cancel_error() {
62
+ $lingotek_log_errors = get_option('lingotek_log_errors');
63
+ $message = isset($lingotek_log_errors['disassociate_document_error']) ? $lingotek_log_errors['disassociate_document_error'] : '';
64
  if (get_option('disassociate_source_failed', FALSE)) {
65
+ $message = str_replace('cancel', 'delete', $message);
66
  printf('<div class="notice notice-warning is-dismissible">
67
+ <p>%s</p>
68
+ </div>', $message);
69
  update_option('disassociate_source_failed', FALSE);
70
  } elseif (get_option('disassociate_target_failed', FALSE)) {
71
+ $message = str_replace('cancel', 'delete', $message);
72
  printf('<div class="notice notice-warning is-dismissible">
73
+ <p>%s</p>
74
+ </div>', $message);
75
  update_option('disassociate_target_failed', FALSE);
76
  } elseif (get_option('cancel_source_failed', FALSE)) {
77
  printf('<div class="notice notice-warning is-dismissible">
78
+ <p>%s</p>
79
+ </div>', $message);
80
  update_option('cancel_source_failed', FALSE);
81
  } elseif (get_option('cancel_target_failed', FALSE)) {
82
  printf('<div class="notice notice-warning is-dismissible">
83
+ <p>%s</p>
84
+ </div>', $message);
85
  update_option('cancel_target_failed', FALSE);
86
  }
87
  }
204
  elseif ($document->status == 'failed') {
205
  return $actions->failed_import_icon($document->status, $object_id);
206
  }
207
+ elseif ($document->status === 'cancelled') {
208
+ return parent::post_column( $column, $object_id );
209
+ }
210
  // no translation.
211
  else {
212
  return '<div class="lingotek-color dashicons dashicons-no"></div>';
admin/post-actions.php CHANGED
@@ -256,12 +256,12 @@ class Lingotek_Post_actions extends Lingotek_Actions {
256
  check_ajax_referer( 'lingotek_progress', '_lingotek_nonce' );
257
  $id = (int)filter_input(INPUT_POST, 'id');
258
  $wp_locales = json_decode(filter_input( INPUT_POST, 'locales'));
259
-
260
- $lingotek_locales = array_map('Lingotek::map_to_lingotek_locale', $wp_locales);
261
- $lingotek_locales = array('translation_locale_code' => $lingotek_locales);
262
-
263
- $wp_locales = array_map(array($this->pllm, 'get_language'), $wp_locales);
264
- $wp_locales = array_column($wp_locales, 'locale');
265
  $this->lgtm->upload_post($id);
266
  die();
267
  }
256
  check_ajax_referer( 'lingotek_progress', '_lingotek_nonce' );
257
  $id = (int)filter_input(INPUT_POST, 'id');
258
  $wp_locales = json_decode(filter_input( INPUT_POST, 'locales'));
259
+ if (isset($wp_locales)) {
260
+ $lingotek_locales = array_map('Lingotek::map_to_lingotek_locale', $wp_locales);
261
+ $lingotek_locales = array('translation_locale_code' => $lingotek_locales);
262
+ $wp_locales = array_map(array($this->pllm, 'get_language'), $wp_locales);
263
+ $wp_locales = array_column($wp_locales, 'locale');
264
+ }
265
  $this->lgtm->upload_post($id);
266
  die();
267
  }
include/api.php CHANGED
@@ -147,6 +147,21 @@ class Lingotek_API extends Lingotek_HTTP {
147
  $response = $this->patch($this->api_url . '/document/' . $id, $args);
148
  $status_code = wp_remote_retrieve_response_code($response);
149
  $body = json_decode(wp_remote_retrieve_body($response));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  if ($status_code == 423) {
151
  $document->document_id = $body->next_document_id;
152
  $document->save();
@@ -239,7 +254,6 @@ class Lingotek_API extends Lingotek_HTTP {
239
  public function cancel_document($id, $wp_id = null) {
240
  $args = wp_parse_args(array('cancelled_reason' => "CANCELLED_BY_AUTHOR"));
241
  $response = $this->post("$this->api_url/document/$id/cancel", $args);
242
-
243
  if($wp_id) {
244
  $arr = get_option('lingotek_log_errors');
245
  if(isset($arr[$wp_id])) {
@@ -249,8 +263,22 @@ class Lingotek_API extends Lingotek_HTTP {
249
  }
250
  $this->log_error_on_response_failure($response, "CancelDocument: Error occurred", array('id' => $id, 'wordpress_id' => $wp_id));
251
  $is_success = !is_wp_error($response) && (204 == wp_remote_retrieve_response_code($response) || 202 == wp_remote_retrieve_response_code($response));
252
- if ($is_success) { Lingotek_Logger::info('Document cancelled', array('document_id' => $id, 'wp_id' => $wp_id)); }
253
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
254
  return $is_success;
255
  }
256
 
@@ -674,7 +702,18 @@ class Lingotek_API extends Lingotek_HTTP {
674
  }
675
  $this->log_error_on_response_failure($response, "CancelTranslation: Error occurred", array('id' => $id, 'wordpress_id' => $wp_id));
676
  $is_success = !is_wp_error($response) && (204 == wp_remote_retrieve_response_code($response) || 202 == wp_remote_retrieve_response_code($response));
677
- if ($is_success) { Lingotek_Logger::info('Target cancelled', ['document_id' => $id, 'wp_id' => $wp_id]); }
 
 
 
 
 
 
 
 
 
 
 
678
 
679
  return $is_success;
680
  }
147
  $response = $this->patch($this->api_url . '/document/' . $id, $args);
148
  $status_code = wp_remote_retrieve_response_code($response);
149
  $body = json_decode(wp_remote_retrieve_body($response));
150
+ if ($status_code == 400 && strpos($body->messages[0], 'has previously been cancelled')) {
151
+ if ($targets = isset($document->translations) ? array_keys($document->translations) : null) {
152
+ $unformatted_args['translation_locale_code'] = $targets;
153
+ }
154
+ $this->format_args_for_upload($unformatted_args, $wp_id);
155
+ if (isset($document->translations)) {
156
+ foreach ($document->translations as $locale) {
157
+ $document->translations[$locale] = 'pending';
158
+ }
159
+ }
160
+ $document->document_id = NULL;
161
+ unset($document->desc_array['lingotek']);
162
+ $document->save();
163
+ return $this->upload_document($unformatted_args, $wp_id);
164
+ }
165
  if ($status_code == 423) {
166
  $document->document_id = $body->next_document_id;
167
  $document->save();
254
  public function cancel_document($id, $wp_id = null) {
255
  $args = wp_parse_args(array('cancelled_reason' => "CANCELLED_BY_AUTHOR"));
256
  $response = $this->post("$this->api_url/document/$id/cancel", $args);
 
257
  if($wp_id) {
258
  $arr = get_option('lingotek_log_errors');
259
  if(isset($arr[$wp_id])) {
263
  }
264
  $this->log_error_on_response_failure($response, "CancelDocument: Error occurred", array('id' => $id, 'wordpress_id' => $wp_id));
265
  $is_success = !is_wp_error($response) && (204 == wp_remote_retrieve_response_code($response) || 202 == wp_remote_retrieve_response_code($response));
266
+ if ($is_success) {
267
+ Lingotek_Logger::info('Document cancelled', array('document_id' => $id, 'wp_id' => $wp_id));
268
+ $lgtm = $GLOBALS['wp_lingotek']->model;
269
+ $document = $lgtm->get_group_by_id($id);
270
+ $document->status = 'cancelled';
271
+ $document->save();
272
+ return $is_success;
273
+ }
274
+ $lingotek_log_errors = get_option('lingotek_log_errors', array());
275
+ if (!is_array($lingotek_log_errors)) {
276
+ $lingotek_log_errors = array();
277
+ }
278
+ $error_message = $this->get_error_message_from_response($response) !== FALSE ?
279
+ $this->get_error_message_from_response($response) : "No error message set by Lingotek.";
280
+ $lingotek_log_errors['disassociate_document_error'] = $error_message;
281
+ update_option('lingotek_log_errors', $lingotek_log_errors);
282
  return $is_success;
283
  }
284
 
702
  }
703
  $this->log_error_on_response_failure($response, "CancelTranslation: Error occurred", array('id' => $id, 'wordpress_id' => $wp_id));
704
  $is_success = !is_wp_error($response) && (204 == wp_remote_retrieve_response_code($response) || 202 == wp_remote_retrieve_response_code($response));
705
+ if ($is_success) {
706
+ Lingotek_Logger::info('Target cancelled', ['document_id' => $id, 'wp_id' => $wp_id]);
707
+ return $is_success;
708
+ }
709
+ $lingotek_log_errors = get_option('lingotek_log_errors', array());
710
+ if (!is_array($lingotek_log_errors)) {
711
+ $lingotek_log_errors = array();
712
+ }
713
+ $error_message = $this->get_error_message_from_response($response) !== FALSE ?
714
+ $this->get_error_message_from_response($response) : "No error message set by Lingotek.";
715
+ $lingotek_log_errors['disassociate_document_error'] = $error_message;
716
+ update_option('lingotek_log_errors', $lingotek_log_errors);
717
 
718
  return $is_success;
719
  }
include/group.php CHANGED
@@ -116,6 +116,7 @@ abstract class Lingotek_Group {
116
  }
117
  }
118
  $this->save();
 
119
  update_option("ignore_delete_pref", FALSE);
120
  } else {
121
  update_option('disassociate_source_failed', TRUE);
@@ -131,7 +132,13 @@ abstract class Lingotek_Group {
131
  public function cancel() {
132
  $client = new Lingotek_API();
133
  if ($client->cancel_document($this->document_id, $this->source)) {
134
- unset($this->desc_array['lingotek']);
 
 
 
 
 
 
135
  $this->save();
136
  } else {
137
  update_option('cancel_source_failed', TRUE);
@@ -189,13 +196,12 @@ abstract class Lingotek_Group {
189
  'external_url' => $external_url,
190
  );
191
  $params = array_merge($params, $filters);
192
-
193
  $res = $client->patch_document($this->document_id, $params, $this->source);
194
 
195
  if ($res !== FALSE) {
196
  $this->document_id = $res;
197
  $this->status = 'importing';
198
- $this->translations = array_fill_keys(array_keys($this->translations), 'pending');
199
  $this->save();
200
  }
201
  }
@@ -399,7 +405,6 @@ abstract class Lingotek_Group {
399
  // $this->translations = array_fill_keys(array_keys($this->translations), 'not-current');
400
  $this->save();
401
  }
402
-
403
  /*
404
  * sets document status to failed_import
405
  *
116
  }
117
  }
118
  $this->save();
119
+ wp_delete_term($this->term_id, $this->taxonomy);
120
  update_option("ignore_delete_pref", FALSE);
121
  } else {
122
  update_option('disassociate_source_failed', TRUE);
132
  public function cancel() {
133
  $client = new Lingotek_API();
134
  if ($client->cancel_document($this->document_id, $this->source)) {
135
+ if (count ($this->desc_array['lingotek']['translations']) > 0) {
136
+ unset($this->desc_array['lingotek']['translations']);
137
+ $this->desc_array['lingotek']['status'] = 'cancelled';
138
+ } else {
139
+ unset($this->desc_array['lingotek']);
140
+ }
141
+
142
  $this->save();
143
  } else {
144
  update_option('cancel_source_failed', TRUE);
196
  'external_url' => $external_url,
197
  );
198
  $params = array_merge($params, $filters);
 
199
  $res = $client->patch_document($this->document_id, $params, $this->source);
200
 
201
  if ($res !== FALSE) {
202
  $this->document_id = $res;
203
  $this->status = 'importing';
204
+ $this->translations = isset($this->translations) ? array_fill_keys(array_keys($this->translations), 'pending') : null;
205
  $this->save();
206
  }
207
  }
405
  // $this->translations = array_fill_keys(array_keys($this->translations), 'not-current');
406
  $this->save();
407
  }
 
408
  /*
409
  * sets document status to failed_import
410
  *
include/model.php CHANGED
@@ -296,7 +296,6 @@ class Lingotek_Model {
296
  * Customized workflows have the option to do any sort of pre-processing before a document is uploaded to lingotek.
297
  */
298
  $document = $this->get_group('post', $post_id);
299
-
300
  if ($document) {
301
  $document->pre_upload_to_lingotek($post_id, $post->post_type, $language, 'post');
302
  }
@@ -307,19 +306,19 @@ class Lingotek_Model {
307
  $params = $this->build_params($external_url, $post->post_title, $post->post_type, $content, $language, $profile, $post_id, $wp_target_locales);
308
  $filter_ids = $this->get_filter_ids($post->post_type, $language, $post_id);
309
  $params = array_merge($params, $filter_ids);
310
-
311
  if ($document && 'edited' == $document->status) {
312
  $document->patch($post->post_title, $post, $external_url, $filter_ids);
313
- } elseif (!Lingotek_Group::$creating_translation && !self::$copying_post && !$document) {
314
-
315
  update_option($post_id, true);
316
  $document_id = $client->upload_document($params, $post->ID);
317
 
318
  if ($document_id) {
319
  Lingotek_Group_Post::create($post->ID , $language, $document_id);
320
  $document = $this->get_group_by_id( $document_id );
321
- foreach ($wp_target_locales as $locale){
322
- $document->translations[$locale] = 'pending';
 
 
323
  }
324
  $document->save();
325
  // If a translation profile has targets set to copy then copy them
@@ -468,8 +467,9 @@ class Lingotek_Model {
468
 
469
  case 'post':
470
  $language = PLL()->model->post->get_language($object_id);
 
471
  return !empty($language) && (empty($document) ||
472
- (isset($document) && 'edited' == $document->status && $document->source == $object_id));
473
  case 'term':
474
  // first check that a language is associated to the object
475
  $language = PLL()->model->term->get_language($object_id);
296
  * Customized workflows have the option to do any sort of pre-processing before a document is uploaded to lingotek.
297
  */
298
  $document = $this->get_group('post', $post_id);
 
299
  if ($document) {
300
  $document->pre_upload_to_lingotek($post_id, $post->post_type, $language, 'post');
301
  }
306
  $params = $this->build_params($external_url, $post->post_title, $post->post_type, $content, $language, $profile, $post_id, $wp_target_locales);
307
  $filter_ids = $this->get_filter_ids($post->post_type, $language, $post_id);
308
  $params = array_merge($params, $filter_ids);
 
309
  if ($document && 'edited' == $document->status) {
310
  $document->patch($post->post_title, $post, $external_url, $filter_ids);
311
+ } elseif (!Lingotek_Group::$creating_translation && !self::$copying_post && (!$document || $document->document_id )) {
 
312
  update_option($post_id, true);
313
  $document_id = $client->upload_document($params, $post->ID);
314
 
315
  if ($document_id) {
316
  Lingotek_Group_Post::create($post->ID , $language, $document_id);
317
  $document = $this->get_group_by_id( $document_id );
318
+ if (isset($wp_target_locales)) {
319
+ foreach ($wp_target_locales as $locale){
320
+ $document->translations[$locale] = 'pending';
321
+ }
322
  }
323
  $document->save();
324
  // If a translation profile has targets set to copy then copy them
467
 
468
  case 'post':
469
  $language = PLL()->model->post->get_language($object_id);
470
+ $allow_status = $document && 'edited' == $document->status ? true : ($document && 'cancelled' === $document->status ? true: false);
471
  return !empty($language) && (empty($document) ||
472
+ (isset($document) && $allow_status && $document->source == $object_id));
473
  case 'term':
474
  // first check that a language is associated to the object
475
  $language = PLL()->model->term->get_language($object_id);
js/updater.js CHANGED
@@ -128,7 +128,7 @@ jQuery(document).ready(function($) {
128
  else if (data[key][locale]['status'] === 'disabled' || data[key]['source'] === 'disabled') {
129
  $(td).find('.lingotek-color').remove();
130
  }
131
- else if ($(td).find('.pll_icon_add').length > 0 && data[key][data[key]['source']]['status'] === 'none'){
132
  break;
133
  }
134
  else if (data[key]['source_status'] === 'failed') {
@@ -224,19 +224,19 @@ jQuery(document).ready(function($) {
224
  } else if($(cancel).length > 0){
225
  $(cancel).off("click");
226
  $(cancel).click(function(){
227
- return confirm('You are about to cancel this translations in your Lingotek community. Are you sure?');
228
  });
229
  $(cancel).before(status_update_link);
230
  } else if($(disassociate).length > 0 ){
231
  $(disassociate).off("click");
232
  $(disassociate).click(function(){
233
- return confirm('You are about to cancel existing translations in your Lingotek community. Are you sure?');
234
  });
235
  $(disassociate).before(status_update_link);
236
  } else if($(disassociate_translation).length > 0){
237
  $(disassociate_translation).off("click");
238
  $(disassociate_translation).click(function(){
239
- return confirm('You are about to cancel this translations in your Lingotek community. Are you sure?');
240
  });
241
  $(disassociate_translation).before(status_update_link);
242
  } else {
128
  else if (data[key][locale]['status'] === 'disabled' || data[key]['source'] === 'disabled') {
129
  $(td).find('.lingotek-color').remove();
130
  }
131
+ else if ($(td).find('.pll_icon_add').length > 0 && (data[key][data[key]['source']]['status'] === 'none' || data[key][data[key]['source']]['status'] === 'cancelled')){
132
  break;
133
  }
134
  else if (data[key]['source_status'] === 'failed') {
224
  } else if($(cancel).length > 0){
225
  $(cancel).off("click");
226
  $(cancel).click(function(){
227
+ return confirm('You are about to cancel this translation in your Lingotek community. Are you sure?');
228
  });
229
  $(cancel).before(status_update_link);
230
  } else if($(disassociate).length > 0 ){
231
  $(disassociate).off("click");
232
  $(disassociate).click(function(){
233
+ return confirm('You are about to delete existing translations in your WordPress Site and cancel existing translations in your Lingotek community. Are you sure?');
234
  });
235
  $(disassociate).before(status_update_link);
236
  } else if($(disassociate_translation).length > 0){
237
  $(disassociate_translation).off("click");
238
  $(disassociate_translation).click(function(){
239
+ return confirm('You are about to cancel this translation in your Lingotek community. Are you sure?');
240
  });
241
  $(disassociate_translation).before(status_update_link);
242
  } else {
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.4.6
6
  Author: Lingotek and Frédéric Demarle
7
  Author uri: http://lingotek.com
8
  Description: Lingotek offers convenient cloud-based localization and translation.
@@ -16,7 +16,7 @@ if ( ! function_exists( 'add_action' ) ) {
16
  exit();
17
  }
18
 
19
- define( 'LINGOTEK_VERSION', '1.4.6' ); // plugin version (should match above meta).
20
  define( 'LINGOTEK_MIN_PLL_VERSION', '1.8' );
21
  define( 'LINGOTEK_BASENAME', plugin_basename( __FILE__ ) ); // plugin name as known by WP.
22
  define( 'LINGOTEK_PLUGIN_SLUG', 'lingotek-translation' );// plugin slug (should match above meta: Text Domain).
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.4.7
6
  Author: Lingotek and Frédéric Demarle
7
  Author uri: http://lingotek.com
8
  Description: Lingotek offers convenient cloud-based localization and translation.
16
  exit();
17
  }
18
 
19
+ define( 'LINGOTEK_VERSION', '1.4.7' ); // plugin version (should match above meta).
20
  define( 'LINGOTEK_MIN_PLL_VERSION', '1.8' );
21
  define( 'LINGOTEK_BASENAME', plugin_basename( __FILE__ ) ); // plugin name as known by WP.
22
  define( 'LINGOTEK_PLUGIN_SLUG', 'lingotek-translation' );// plugin slug (should match above meta: Text Domain).
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: chouby, smithworx, erichie, robertdhanna, ipoulsen, elliothanna, l
3
  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.3.2
7
- Stable tag: 1.4.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -123,6 +123,10 @@ For more, visit the [Lingotek documentation site](https://lingotek.atlassian.net
123
 
124
  == Changelog ==
125
 
 
 
 
 
126
  = 1.4.6 (2020-1-28) =
127
  * Fixed issue that caused duplicate uploads to Lingotek TMS
128
  * Enabled in-context translation for WordPress using the new Workbench
3
  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.4
7
+ Stable tag: 1.4.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
123
 
124
  == Changelog ==
125
 
126
+ = 1.4.7 (2020-5-13) =
127
+ * Changed workebench URL to allow for In-Context translation using the new workbench
128
+ * Returns more descriptive error message on delete and cancel translation
129
+
130
  = 1.4.6 (2020-1-28) =
131
  * Fixed issue that caused duplicate uploads to Lingotek TMS
132
  * Enabled in-context translation for WordPress using the new Workbench