Lingotek Translation - Version 1.3.1

Version Description

(2017-7-13) =

  • Added the ability to trigger auto-uploading of custom post statuses (Thanks to Soluto for contributing this feature!)
  • Added a filter hook, lingotek_is_post_valid_for_upload, that allows users to provide custom logic to determine where a document should be auto-uploaded (Thanks to Soluto for contributing this feature!)
  • Fixed a caching issue that was loading an outdated JavaScript file
  • Fixed an issue that caused the Professional Translation Quote Calculator to fail if a language rate had not been set on the API side
  • Fixed an auto-updater issue that was marking disabled languages as enabled
  • Added several styling updates
Download this release

Release Info

Developer robertdhanna
Plugin Icon 128x128 Lingotek Translation
Version 1.3.1
Comparing to
See all releases

Code changes from version 1.3.0 to 1.3.1

admin/admin.php CHANGED
@@ -107,6 +107,7 @@ class Lingotek_Admin {
107
 
108
  // fills in missing languages, makes life easier for the updater.
109
  foreach ( $languages as $language ) {
 
110
  foreach ( $content_metadata as $group => $status ) {
111
  $language_obj = $pllm->get_language( $source_language );
112
  $target_lang_obj = $pllm->get_language( $language );
107
 
108
  // fills in missing languages, makes life easier for the updater.
109
  foreach ( $languages as $language ) {
110
+ if (!Lingotek::is_allowed_tms_locale($language)) { continue; }
111
  foreach ( $content_metadata as $group => $status ) {
112
  $language_obj = $pllm->get_language( $source_language );
113
  $target_lang_obj = $pllm->get_language( $language );
admin/filters-post.php CHANGED
@@ -99,7 +99,7 @@ class Lingotek_Filters_Post extends PLL_Admin_Filters_Post {
99
  $profile = $content_profiles[$post_type]['sources'][$post_language->slug];
100
  echo $profiles[$profile]['name'];
101
  }
102
- else if (!empty($content_profiles) && !isset($content_profiles[$post_type]) && !isset($profiles[$content_profiles[$post_type]['profile']]['name']))
103
  {
104
  echo esc_html( __('Disabled', 'lingotek-translation') );
105
  }
@@ -141,7 +141,10 @@ class Lingotek_Filters_Post extends PLL_Admin_Filters_Post {
141
  }
142
  if ($this->can_save_post_data($post_id, $post, true)) {
143
  // updated post
144
- if ($document && $post_id == $document->source && $this->post_hash_has_changed($post)) {
 
 
 
145
  $document->source_edited();
146
  if ($document->is_automatic_upload() && Lingotek_Group_Post::is_valid_auto_upload_post_status($post->post_status)) {
147
  $this->lgtm->upload_post($post_id);
@@ -154,12 +157,39 @@ class Lingotek_Filters_Post extends PLL_Admin_Filters_Post {
154
  // new post
155
  if (!isset($_REQUEST['import'])) {
156
  parent::save_post($post_id, $post, $update);
157
- if (!$document && !wp_is_post_revision($post_id) && 'auto-draft' != $post->post_status && 'automatic' == Lingotek_Model::get_profile_option('upload', $post->post_type, PLL()->model->post->get_language($post_id), false, $post_id) && Lingotek_Group_Post::is_valid_auto_upload_post_status($post->post_status) && !(isset($_POST['action']) && 'heartbeat' == $_POST['action']) && $this->lgtm->can_upload('post', $post_id)) {
 
 
 
 
 
 
 
 
158
  $this->lgtm->upload_post($post_id);
159
  }
160
  }
161
  }
162
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  /*
164
  * checks if we can act when saving a post
165
  *
99
  $profile = $content_profiles[$post_type]['sources'][$post_language->slug];
100
  echo $profiles[$profile]['name'];
101
  }
102
+ else if (!empty($content_profiles) && (!isset($content_profiles[$post_type]) || !isset($profiles[$content_profiles[$post_type]['profile']]['name'])))
103
  {
104
  echo esc_html( __('Disabled', 'lingotek-translation') );
105
  }
141
  }
142
  if ($this->can_save_post_data($post_id, $post, true)) {
143
  // updated post
144
+ if ($document &&
145
+ $post_id == $document->source &&
146
+ $this->post_hash_has_changed($post) &&
147
+ $this->is_post_valid_for_upload_by_custom_terms($post_id, false)) {
148
  $document->source_edited();
149
  if ($document->is_automatic_upload() && Lingotek_Group_Post::is_valid_auto_upload_post_status($post->post_status)) {
150
  $this->lgtm->upload_post($post_id);
157
  // new post
158
  if (!isset($_REQUEST['import'])) {
159
  parent::save_post($post_id, $post, $update);
160
+ if (!$document &&
161
+ !wp_is_post_revision($post_id) &&
162
+ 'auto-draft' != $post->post_status &&
163
+ 'automatic' == Lingotek_Model::get_profile_option('upload', $post->post_type, PLL()->model->post->get_language($post_id), false, $post_id) &&
164
+ Lingotek_Group_Post::is_valid_auto_upload_post_status($post->post_status) &&
165
+ !(isset($_POST['action']) && 'heartbeat' == $_POST['action']) &&
166
+ $this->lgtm->can_upload('post', $post_id) &&
167
+ $this->is_post_valid_for_upload_by_custom_terms($post_id, true)) {
168
+
169
  $this->lgtm->upload_post($post_id);
170
  }
171
  }
172
  }
173
 
174
+ /*
175
+ * Allows the customer to interrupt the post upload by applying filter.
176
+ * By using This filter we are allowing users to implement custom logic on the post upload and check if it is valid
177
+ * for upload
178
+ *
179
+ * @since 1.3.1
180
+ *
181
+ * @author Soluto
182
+ *
183
+ * @param int $post_id
184
+ * @param bool $is_new_post
185
+ * @return bool
186
+ */
187
+ protected function is_post_valid_for_upload_by_custom_terms($post_id, $is_new_post) {
188
+ $defaults = array();
189
+ $results = apply_filters('lingotek_is_post_valid_for_upload', $defaults, $post_id, $is_new_post );
190
+ return !(in_array(false, $results));
191
+ }
192
+
193
  /*
194
  * checks if we can act when saving a post
195
  *
admin/settings/view-preferences.php CHANGED
@@ -1,29 +1,19 @@
1
  <?php
2
-
3
  $setting_details = array(
4
  'download_post_status' => array(
5
  'type' => 'dropdown',
6
  'label' => __( 'Download translation status', 'lingotek-translation' ),
7
  'description' => __( 'The post status for newly downloaded translations', 'lingotek-translation' ),
8
  'values' => array(
9
- Lingotek_Group_Post::SAME_AS_SOURCE => __( 'Same as source post', 'lingotek-translation' ),
10
- 'draft' => __( 'Draft', 'lingotek-translation' ),
11
- 'pending' => __( 'Pending Review', 'lingotek-translation' ),
12
- 'publish' => __( 'Published', 'lingotek-translation' ),
13
- 'private' => __( 'Privately Published', 'lingotek-translation' ),
14
  ),
15
  ),
16
  'auto_upload_post_statuses' => array( // blacklist.
17
  'type' => 'checkboxes',
18
  'label' => __( 'Auto upload statuses', 'lingotek-translation' ),
19
  'description' => __( 'The post statuses checked above are enabled for automatic upload (when using automatic uploading translation profiles).', 'lingotek-translation' ),
20
- 'values' => array(
21
- 'draft' => __( 'Draft', 'lingotek-translation' ),
22
- 'pending' => __( 'Pending Review', 'lingotek-translation' ),
23
- 'publish' => __( 'Published', 'lingotek-translation' ),
24
- 'future' => __( 'Scheduled', 'lingotek-translation' ),
25
- 'private' => __( 'Privately Published', 'lingotek-translation' ),
26
- ),
27
  ),
28
  'delete_document_from_tms' => array(
29
  'type' => 'checkboxes',
@@ -51,6 +41,25 @@ $setting_details = array(
51
  ),
52
  );
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  $page_key = $this->plugin_slug . '_settings&sm=preferences';
55
 
56
  if ( ! empty( $_POST ) ) {
1
  <?php
2
+ global $wp_post_statuses;
3
  $setting_details = array(
4
  'download_post_status' => array(
5
  'type' => 'dropdown',
6
  'label' => __( 'Download translation status', 'lingotek-translation' ),
7
  'description' => __( 'The post status for newly downloaded translations', 'lingotek-translation' ),
8
  'values' => array(
9
+ Lingotek_Group_Post::SAME_AS_SOURCE => __( 'Same as source post', 'lingotek-translation' )
 
 
 
 
10
  ),
11
  ),
12
  'auto_upload_post_statuses' => array( // blacklist.
13
  'type' => 'checkboxes',
14
  'label' => __( 'Auto upload statuses', 'lingotek-translation' ),
15
  'description' => __( 'The post statuses checked above are enabled for automatic upload (when using automatic uploading translation profiles).', 'lingotek-translation' ),
16
+ 'values' => array(),
 
 
 
 
 
 
17
  ),
18
  'delete_document_from_tms' => array(
19
  'type' => 'checkboxes',
41
  ),
42
  );
43
 
44
+ function map_wp_post_status($status){
45
+ return __( $status->label, 'lingotek-translation' );
46
+ }
47
+
48
+ function filter_statuses($statuses){
49
+ $statuses_to_filter = array('auto-draft', 'trash', 'inactive', 'inherit');
50
+ $ret = array();
51
+ foreach ($statuses as $status => $value) {
52
+ if (!in_array($status,$statuses_to_filter)) {
53
+ $ret[$status] = $value;
54
+ }
55
+ }
56
+ return $ret;
57
+ }
58
+
59
+ $post_statuses = filter_statuses(array_map("map_wp_post_status", $wp_post_statuses));
60
+ $setting_details["auto_upload_post_statuses"]["values"] = array_merge($post_statuses, $setting_details["auto_upload_post_statuses"]["values"]);
61
+ $setting_details["download_post_status"]["values"] = array_merge($post_statuses, $setting_details["download_post_status"]["values"]);
62
+
63
  $page_key = $this->plugin_slug . '_settings&sm=preferences';
64
 
65
  if ( ! empty( $_POST ) ) {
admin/workflows/professional-translation-workflow.php CHANGED
@@ -189,27 +189,21 @@ class Lingotek_Professional_Translation_Workflow extends Lingotek_Workflow {
189
  <div class='You-can-now-connect payment-method-setup'>
190
  You can now connect with audiences around the globe using Lingotek's network of 5000+ professional, in-country, translators. Professional Translation ensures that your audiences will feel the sentiment of your content.
191
  </div>
192
- <div class='minimum-per-language-warning minimum-warning payment-method-setup'>
193
- <img class='payment-method-setup' src='". esc_url_raw( LINGOTEK_URL ) ."/img/minimum-warning.svg' />
194
- <span class='payment-method-setup' >*$59.99 minimum per language.</span>
195
- <span class='payment-method-setup' ltk-data-tooltip='This minimum ensures that we can retain the best professional linguists for your translation job.'><img src='". esc_url_raw( LINGOTEK_URL ) ."/img/minimum-help.svg' /></span>
196
- </div>
197
- <br class='payment-method-setup'>
198
- <span class='Translation-Request payment-method-setup'>Translation Request Summary<br><br></span>
199
-
200
-
201
  <span class='Congratulations-You payment-not-setup'>Welcome to Lingotek's Translation Quote Calculator<br><br></span>
202
  <div class='You-can-now-connect payment-not-setup'>
203
  Using the quote calculator below you can get an idea of how much your translations will cost. You will need to add a payment method to the Lingotek Secure Payment Portal In order to purchase these translations.
204
  </div>
205
- <br class='payment-not-setup'>
206
- <div class='minimum-per-language-warning minimum-warning payment-not-setup'>
207
- <img class='payment-not-setup' src='". esc_url_raw( LINGOTEK_URL ) ."/img/minimum-warning.svg' />
208
- <span class='payment-not-setup'>*$59.99 minimum per language.</span>
209
- <span class='payment-not-setup' ltk-data-tooltip='This minimum ensures that we can retain the best professional linguists for your translation job.'><img src='". esc_url_raw( LINGOTEK_URL ) ."/img/minimum-help.svg' /></span>
210
  </div>
211
  <br class='payment-not-setup'>
212
  <span class='Translation-Request payment-not-setup'>Translation Quotes<br><br></span>
 
 
213
  <div id='table-wrapper'>
214
  <table class='request-table'>
215
  <tr class='bordered-bottom'><th style='display: table-cell;' class='table-header'>Title</th><th style='display: table-cell;' class='table-header' id='words-column'>Words</th><th style='text-align:center;'><a href='#' id='next-language-set'> <img id='next-language-image' src='" . esc_url_raw( LINGOTEK_URL ) . "/img/right-arrow.svg' /> </a> </th><th class='table-header table-total invisible'>Total</th></tr>
@@ -443,7 +437,7 @@ class Lingotek_Professional_Translation_Workflow extends Lingotek_Workflow {
443
  private function load_request_scripts_and_styles($type)
444
  {
445
  add_thickbox();
446
- wp_enqueue_script( 'lingotek_professional_workflow', LINGOTEK_URL . '/js/workflow/professional-workflow.js' );
447
  wp_enqueue_style( 'lingotek_professional_workflow_style', LINGOTEK_URL . '/css/workflow/professional-workflow-style.css', array(), LINGOTEK_VERSION );
448
 
449
  $client = new Lingotek_API();
@@ -457,8 +451,12 @@ class Lingotek_Professional_Translation_Workflow extends Lingotek_Workflow {
457
  $lingotek_gmc_locale = str_replace('-', '_', $locale->lingotek_locale);
458
  $enabled_langs[$locale->locale] = array(
459
  'lingotek_locale' => $locale->lingotek_locale,
460
- 'language' => $language_mappings[$lingotek_gmc_locale]['language_name'],
461
- 'country_name' => $language_mappings[$lingotek_gmc_locale]['country_name']
 
 
 
 
462
  );
463
  }
464
 
189
  <div class='You-can-now-connect payment-method-setup'>
190
  You can now connect with audiences around the globe using Lingotek's network of 5000+ professional, in-country, translators. Professional Translation ensures that your audiences will feel the sentiment of your content.
191
  </div>
192
+
 
 
 
 
 
 
 
 
193
  <span class='Congratulations-You payment-not-setup'>Welcome to Lingotek's Translation Quote Calculator<br><br></span>
194
  <div class='You-can-now-connect payment-not-setup'>
195
  Using the quote calculator below you can get an idea of how much your translations will cost. You will need to add a payment method to the Lingotek Secure Payment Portal In order to purchase these translations.
196
  </div>
197
+ <br>
198
+ <div class='minimum-per-language-warning minimum-warning'>
199
+ <img src='". esc_url_raw( LINGOTEK_URL ) ."/img/minimum-warning.svg' />
200
+ <span >*$59.99 minimum per language.</span>
201
+ <span ltk-data-tooltip='This minimum ensures that we can retain the best professional linguists for your translation job.'><img src='". esc_url_raw( LINGOTEK_URL ) ."/img/minimum-help.svg' /></span>
202
  </div>
203
  <br class='payment-not-setup'>
204
  <span class='Translation-Request payment-not-setup'>Translation Quotes<br><br></span>
205
+ <br class='payment-method-setup'>
206
+ <span class='Translation-Request payment-method-setup'>Translation Request Summary<br><br></span>
207
  <div id='table-wrapper'>
208
  <table class='request-table'>
209
  <tr class='bordered-bottom'><th style='display: table-cell;' class='table-header'>Title</th><th style='display: table-cell;' class='table-header' id='words-column'>Words</th><th style='text-align:center;'><a href='#' id='next-language-set'> <img id='next-language-image' src='" . esc_url_raw( LINGOTEK_URL ) . "/img/right-arrow.svg' /> </a> </th><th class='table-header table-total invisible'>Total</th></tr>
437
  private function load_request_scripts_and_styles($type)
438
  {
439
  add_thickbox();
440
+ wp_enqueue_script( 'lingotek_professional_workflow', LINGOTEK_URL . '/js/workflow/professional-workflow.js', array(), LINGOTEK_VERSION );
441
  wp_enqueue_style( 'lingotek_professional_workflow_style', LINGOTEK_URL . '/css/workflow/professional-workflow-style.css', array(), LINGOTEK_VERSION );
442
 
443
  $client = new Lingotek_API();
451
  $lingotek_gmc_locale = str_replace('-', '_', $locale->lingotek_locale);
452
  $enabled_langs[$locale->locale] = array(
453
  'lingotek_locale' => $locale->lingotek_locale,
454
+ 'language' => isset($language_mappings[$lingotek_gmc_locale])
455
+ ? $language_mappings[$lingotek_gmc_locale]['language_name']
456
+ : null,
457
+ 'country_name' => isset($language_mappings[$lingotek_gmc_locale])
458
+ ? $language_mappings[$lingotek_gmc_locale]['country_name']
459
+ : null,
460
  );
461
  }
462
 
css/workflow/professional-workflow-style.css CHANGED
@@ -223,7 +223,7 @@
223
  width: 95%;
224
  overflow:hidden;
225
  overflow-y: auto;
226
- max-height: 350px;
227
  }
228
 
229
  /*#request-table-head {
@@ -607,7 +607,7 @@
607
  float: left;
608
  padding-right: 5px;
609
  height: 100%;
610
- width: 150px;
611
  padding-right: 3px;
612
  padding-left: 3px;
613
  }
223
  width: 95%;
224
  overflow:hidden;
225
  overflow-y: auto;
226
+ max-height: 315px;
227
  }
228
 
229
  /*#request-table-head {
607
  float: left;
608
  padding-right: 5px;
609
  height: 100%;
610
+ width: 53%;
611
  padding-right: 3px;
612
  padding-left: 3px;
613
  }
js/workflow/professional-workflow.js CHANGED
@@ -47,7 +47,6 @@ jQuery(document).ready(function() {
47
  jQuery(document).on('tb_unload', function(event) {
48
  if (twice)
49
  {
50
- console.log('unload');
51
  tear_down();
52
  twice = false;
53
  dispatched = false;
@@ -230,7 +229,6 @@ jQuery(document).ready(function() {
230
  jQuery.each(global_ajax_requests_list, function(index,request) {
231
  abort_ajax = true;
232
  request.abort();
233
- console.log('abort');
234
  });
235
  }
236
 
@@ -503,7 +501,6 @@ jQuery(document).ready(function() {
503
  translations[doc_id].push(locale);
504
  }
505
  });
506
- console.log(translations);
507
  ajax_request_bulk_translation(translations);
508
  }
509
 
@@ -522,7 +519,6 @@ jQuery(document).ready(function() {
522
  '_lingotek_nonce' : workflow_vars.nonce
523
  };
524
  var request = Workflow.modals.ajax_request('POST', ajax_url, request_translation_body, function(response) {
525
- console.log(response);
526
  if (response.data.transaction_approved)
527
  {
528
  show_display_invoice_screen_success(response);
@@ -812,8 +808,6 @@ jQuery(document).ready(function() {
812
  var glob_list_copy = global_locale_list.slice(0);
813
  render_table_headers(false, glob_list_copy, true);
814
 
815
- console.log('ajax stop');
816
-
817
  /**
818
  * Hides the loading gif and shows everything but the hidden items on the table.
819
  */
@@ -886,7 +880,6 @@ jQuery(document).ready(function() {
886
  var ajax_url = Workflow.modals.get_ajax_url('get_user_payment_information');
887
 
888
  var request = Workflow.modals.ajax_request('GET', ajax_url, {'_lingotek_nonce' : workflow_vars.nonce}, function(response) {
889
- console.log(response);
890
  if (response.payment_info && response.payment_info.payment_profile)
891
  {
892
  show_does_have_payment_info(response);
@@ -960,7 +953,6 @@ jQuery(document).ready(function() {
960
  '_lingotek_nonce' : workflow_vars.nonce
961
  };
962
 
963
- console.log(estimate_body);
964
  var estimate_ajax_url = Workflow.modals.get_ajax_url('estimate_cost');
965
 
966
  /**
@@ -969,7 +961,6 @@ jQuery(document).ready(function() {
969
  * are aborted as the modal is closed.
970
  */
971
  var request = Workflow.modals.ajax_request('GET', estimate_ajax_url, estimate_body, function(response) {
972
- console.log(response);
973
 
974
  document_id_to_row_buffer[response.data.document_id] = {
975
  'response' : response,
@@ -1051,7 +1042,6 @@ jQuery(document).ready(function() {
1051
  add_to_row_buffer(doc_id, locale_data.csv, clicked_locale_code, locale_data.locale_list, check_all_rows);
1052
  set_payment_information();
1053
  jQuery(document).ajaxStop(function() {
1054
- console.log('ajax stop in');
1055
  try
1056
  {
1057
  render_rows_from_buffer();
@@ -1317,10 +1307,17 @@ jQuery(document).ready(function() {
1317
  */
1318
  if (specific_locale_code)
1319
  {
1320
- element += "<td class='"+ escape_html(document_id) +"-row-table cost-font-size'><input class='"+ escape_html(specific_locale_code) +" checkable "+ escape_html(document_id) +"' type='checkbox' name='confirm-request' value='"+ escape_html(response.data.costs[specific_locale_code].estimated_cost) +"'>$"+ escape_html(response.data.costs[specific_locale_code].estimated_cost) +"</td>";
 
 
 
 
 
 
 
 
1321
  glob_locale_copy.splice(glob_locale_copy.indexOf(specific_locale_code), 1);
1322
  counter = 1;
1323
- row_total = parseFloat(response.data.costs[specific_locale_code].estimated_cost.replace(',', ''));
1324
  iteration_length--;
1325
  }
1326
 
@@ -1340,7 +1337,7 @@ jQuery(document).ready(function() {
1340
  * passed into the method. The locale list passed into the method contains the languages that have been enabled for this particular document.
1341
  * If the next_locale variable is not found in our enabled locales list then we add a row that doesn't contain any sort of input.
1342
  */
1343
- if (next_local && jQuery.inArray(next_local, locales) !== -1)
1344
  {
1345
  element += "<td class='"+ escape_html(document_id) +"-row-table cost-font-size "+ escape_html(display_class) +"'><input class='"+ escape_html(next_local) +" checkable "+ escape_html(document_id) +"' type='checkbox' name='confirm-request' value='"+ escape_html(response.data.costs[next_local].estimated_cost) +"'>$"+ escape_html(response.data.costs[next_local].estimated_cost) +"</td>"
1346
  }
@@ -1397,7 +1394,10 @@ jQuery(document).ready(function() {
1397
  if (specific_locale_code)
1398
  {
1399
  locales.splice(locales.indexOf(specific_locale_code), 1);
1400
- header += "<th class='appended header-table' title='"+ escape_html(get_language_from_locale(specific_locale_code)) +" ("+ escape_html(get_country_from_locale(specific_locale_code)) +")'><div class='document-title language-header'>"+escape_html(get_language_from_locale(specific_locale_code))+" ("+escape_html(get_country_from_locale(specific_locale_code))+")</div><input class='"+ escape_html(specific_locale_code) +"-header' type='checkbox' name='confirm-request' value='request-translation'><span class='"+escape_html(specific_locale_code)+"-header-cost cost-header'>" + escape_html('$40.99') + "</span></th>";
 
 
 
1401
  counter = 1;
1402
  }
1403
 
@@ -1406,7 +1406,10 @@ jQuery(document).ready(function() {
1406
  {
1407
  var display_class = '';
1408
  if (counter >= table_element_limit) { display_class = '-hidden'; }
1409
- header += "<th class='appended header-table"+ escape_html(display_class) +"' title='"+ escape_html(get_language_from_locale(next_local)) +" ("+ escape_html(get_country_from_locale(next_local)) +")'><div class='document-title language-header'>"+escape_html(get_language_from_locale(next_local))+" ("+escape_html(get_country_from_locale(next_local))+")</div><input class='"+ escape_html(next_local) +"-header' type='checkbox' name='confirm-request' value='request-translation'><span class='"+escape_html(next_local)+"-header-cost cost-header'>" + escape_html('$40.99') + "</span></th>";
 
 
 
1410
  counter++;
1411
  }
1412
 
@@ -1481,7 +1484,6 @@ jQuery(document).ready(function() {
1481
  // TODO: optimize row listener
1482
  jQuery.each(document_id_list, function(index,value) {
1483
  jQuery(document).on('click', '.' + value, function() {
1484
- console.log('total');
1485
  update_row_total(value);
1486
  })
1487
  });
@@ -1641,7 +1643,7 @@ jQuery(document).ready(function() {
1641
  {
1642
  list.push({
1643
  'locale' : item.lingotek_locale,
1644
- 'name' : item.language + ', ' + item.country_name,
1645
  'count' : get_word_count_by_locale(item.lingotek_locale),
1646
  'cost' : get_cost_by_locale(item.lingotek_locale, false)
1647
  });
@@ -1650,6 +1652,10 @@ jQuery(document).ready(function() {
1650
 
1651
  return list;
1652
  }
 
 
 
 
1653
 
1654
  function get_word_count_by_locale(locale)
1655
  {
@@ -1726,11 +1732,11 @@ jQuery(document).ready(function() {
1726
  });
1727
  if (mins_met)
1728
  {
1729
- jQuery('.minimum-per-language-warning').hide();
1730
  }
1731
  else
1732
  {
1733
- jQuery('.minimum-per-language-warning').show();
1734
  }
1735
  }
1736
 
47
  jQuery(document).on('tb_unload', function(event) {
48
  if (twice)
49
  {
 
50
  tear_down();
51
  twice = false;
52
  dispatched = false;
229
  jQuery.each(global_ajax_requests_list, function(index,request) {
230
  abort_ajax = true;
231
  request.abort();
 
232
  });
233
  }
234
 
501
  translations[doc_id].push(locale);
502
  }
503
  });
 
504
  ajax_request_bulk_translation(translations);
505
  }
506
 
519
  '_lingotek_nonce' : workflow_vars.nonce
520
  };
521
  var request = Workflow.modals.ajax_request('POST', ajax_url, request_translation_body, function(response) {
 
522
  if (response.data.transaction_approved)
523
  {
524
  show_display_invoice_screen_success(response);
808
  var glob_list_copy = global_locale_list.slice(0);
809
  render_table_headers(false, glob_list_copy, true);
810
 
 
 
811
  /**
812
  * Hides the loading gif and shows everything but the hidden items on the table.
813
  */
880
  var ajax_url = Workflow.modals.get_ajax_url('get_user_payment_information');
881
 
882
  var request = Workflow.modals.ajax_request('GET', ajax_url, {'_lingotek_nonce' : workflow_vars.nonce}, function(response) {
 
883
  if (response.payment_info && response.payment_info.payment_profile)
884
  {
885
  show_does_have_payment_info(response);
953
  '_lingotek_nonce' : workflow_vars.nonce
954
  };
955
 
 
956
  var estimate_ajax_url = Workflow.modals.get_ajax_url('estimate_cost');
957
 
958
  /**
961
  * are aborted as the modal is closed.
962
  */
963
  var request = Workflow.modals.ajax_request('GET', estimate_ajax_url, estimate_body, function(response) {
 
964
 
965
  document_id_to_row_buffer[response.data.document_id] = {
966
  'response' : response,
1042
  add_to_row_buffer(doc_id, locale_data.csv, clicked_locale_code, locale_data.locale_list, check_all_rows);
1043
  set_payment_information();
1044
  jQuery(document).ajaxStop(function() {
 
1045
  try
1046
  {
1047
  render_rows_from_buffer();
1307
  */
1308
  if (specific_locale_code)
1309
  {
1310
+ if (response.data.costs[specific_locale_code] !== false)
1311
+ {
1312
+ element += "<td class='"+ escape_html(document_id) +"-row-table cost-font-size'><input class='"+ escape_html(specific_locale_code) +" checkable "+ escape_html(document_id) +"' type='checkbox' name='confirm-request' value='"+ escape_html(response.data.costs[specific_locale_code].estimated_cost) +"'>$"+ escape_html(response.data.costs[specific_locale_code].estimated_cost) +"</td>";
1313
+ row_total = parseFloat(response.data.costs[specific_locale_code].estimated_cost.replace(',', ''));
1314
+ }
1315
+ else
1316
+ {
1317
+ element += "<td class='"+ escape_html(document_id) +"-row-table cost-font-size "+ escape_html(display_class) +"'><span ltk-data-tooltip-ctr='This element is unavailable for translation ...'><input type='checkbox' disabled></span></td>";
1318
+ }
1319
  glob_locale_copy.splice(glob_locale_copy.indexOf(specific_locale_code), 1);
1320
  counter = 1;
 
1321
  iteration_length--;
1322
  }
1323
 
1337
  * passed into the method. The locale list passed into the method contains the languages that have been enabled for this particular document.
1338
  * If the next_locale variable is not found in our enabled locales list then we add a row that doesn't contain any sort of input.
1339
  */
1340
+ if (next_local && jQuery.inArray(next_local, locales) !== -1 && response.data.costs[next_local] !== false)
1341
  {
1342
  element += "<td class='"+ escape_html(document_id) +"-row-table cost-font-size "+ escape_html(display_class) +"'><input class='"+ escape_html(next_local) +" checkable "+ escape_html(document_id) +"' type='checkbox' name='confirm-request' value='"+ escape_html(response.data.costs[next_local].estimated_cost) +"'>$"+ escape_html(response.data.costs[next_local].estimated_cost) +"</td>"
1343
  }
1394
  if (specific_locale_code)
1395
  {
1396
  locales.splice(locales.indexOf(specific_locale_code), 1);
1397
+ var language = escape_html(get_language_from_locale(specific_locale_code));
1398
+ var country = escape_html(get_country_from_locale(specific_locale_code));
1399
+ var header_text = get_lang_with_country_string(language, country, specific_locale_code);
1400
+ header += "<th class='appended header-table' title='" + header_text + "'><div class='document-title language-header'>"+header_text+"</div><input class='"+ escape_html(specific_locale_code) +"-header' type='checkbox' name='confirm-request' value='request-translation'><span class='"+escape_html(specific_locale_code)+"-header-cost cost-header'>" + escape_html('$40.99') + "</span></th>";
1401
  counter = 1;
1402
  }
1403
 
1406
  {
1407
  var display_class = '';
1408
  if (counter >= table_element_limit) { display_class = '-hidden'; }
1409
+ var language = escape_html(get_language_from_locale(next_local));
1410
+ var country = escape_html(get_country_from_locale(next_local));
1411
+ var header_text = get_lang_with_country_string(language, country, next_local);
1412
+ header += "<th class='appended header-table"+ escape_html(display_class) +"' title='"+ header_text +"'><div class='document-title language-header'>"+header_text+"</div><input class='"+ escape_html(next_local) +"-header' type='checkbox' name='confirm-request' value='request-translation'><span class='"+escape_html(next_local)+"-header-cost cost-header'>" + escape_html('$40.99') + "</span></th>";
1413
  counter++;
1414
  }
1415
 
1484
  // TODO: optimize row listener
1485
  jQuery.each(document_id_list, function(index,value) {
1486
  jQuery(document).on('click', '.' + value, function() {
 
1487
  update_row_total(value);
1488
  })
1489
  });
1643
  {
1644
  list.push({
1645
  'locale' : item.lingotek_locale,
1646
+ 'name' : get_lang_with_country_string(item.language, item.country_name, item.lingotek_locale),
1647
  'count' : get_word_count_by_locale(item.lingotek_locale),
1648
  'cost' : get_cost_by_locale(item.lingotek_locale, false)
1649
  });
1652
 
1653
  return list;
1654
  }
1655
+ function get_lang_with_country_string(language, country, locale)
1656
+ {
1657
+ return (language == null || country == null) || (language == 'null' || country == 'null') ? locale : language + ' (' + country + ')';
1658
+ }
1659
 
1660
  function get_word_count_by_locale(locale)
1661
  {
1732
  });
1733
  if (mins_met)
1734
  {
1735
+ jQuery('.minimum-per-language-warning').css('visibility','hidden');
1736
  }
1737
  else
1738
  {
1739
+ jQuery('.minimum-per-language-warning').css('visibility','visible');
1740
  }
1741
  }
1742
 
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.3.0
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.3.0' ); // 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).
@@ -25,7 +25,7 @@ define( 'LINGOTEK_INC', LINGOTEK_DIR . '/include' );
25
  define( 'LINGOTEK_ADMIN_INC', LINGOTEK_DIR . '/admin' );
26
  define( 'LINGOTEK_WORKFLOWS', LINGOTEK_ADMIN_INC . '/workflows' );
27
  define( 'LINGOTEK_URL', plugins_url( '', __FILE__ ) );
28
- define( 'BRIDGE_URL', 'https://mw.lingotek.com' );
29
 
30
  class Lingotek {
31
  /**
@@ -51,378 +51,172 @@ class Lingotek {
51
  */
52
  public static $lingotek_locales = array(
53
  'af' => 'af-ZA',
54
- 'ak' => 'ak-GH',
55
- 'am' => 'am-ET',
56
- 'ar' => 'ar',
57
- 'as' => 'as-IN',
58
- 'az' => 'az-AZ',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  'ba' => 'ba-RU',
60
- 'bel' => 'be-BY',
61
- 'bg_BG' => 'bg-BG',
62
- 'bn_BD' => 'bn-BD',
63
- 'bo' => 'bo-CN',
64
- 'bs_BA' => 'bs-BA',
65
  'ca' => 'ca-ES',
66
- 'co' => 'co-FR',
67
- 'cs_CZ' => 'cs-CZ',
68
- 'cy' => 'cy-GB',
69
- 'da_DK' => 'da-DK',
70
- 'de_CH' => 'de-CH',
 
 
 
71
  'de_DE' => 'de-DE',
72
- 'dv' => 'dv-MV',
73
- 'el' => 'el-GR',
74
- 'en_AU' => 'en-AU',
75
- 'en_CA' => 'en-CA',
76
- 'en_GB' => 'en-GB',
 
77
  'en_US' => 'en-US',
78
- 'eo' => 'eo-FR',
79
- 'es_AR' => 'es-AR',
80
- 'es_CL' => 'es-CL',
81
- 'es_CO' => 'es-CO',
82
- 'es_ES' => 'es-ES',
 
 
 
 
 
83
  'es_MX' => 'es-MX',
84
- 'es_PE' => 'es-PE',
85
- 'es_PR' => 'es-PR',
86
- 'es_VE' => 'es-VE',
87
- 'et' => 'et-EE',
88
- 'eu' => 'eu-ES',
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  'fa_IR' => 'fa-IR',
90
- 'fi' => 'fi-FI',
91
- 'fr_FR' => 'fr-FR',
92
- 'ga' => 'ga-IE',
93
- 'gd' => 'gd-GB',
94
- 'gl_ES' => 'gl-ES',
 
 
 
 
 
95
  'gn' => 'gn-BO',
96
- 'haw_US' => 'haw-US',
97
- 'he_IL' => 'he-IL',
98
- 'hi_IN' => 'hi-IN',
99
- 'hr' => 'hr-HR',
100
- 'hu_HU' => 'hu-HU',
 
101
  'hy' => 'hy-AM',
102
- 'id_ID' => 'id-ID',
103
- 'is_IS' => 'is-IS',
104
- 'it_IT' => 'it-IT',
105
- 'ja' => 'ja-JP',
106
- 'jv_ID' => 'jv-ID',
 
 
107
  'ka_GE' => 'ka-GE',
108
- 'kin' => 'kin-RW',
109
- 'kk' => 'kk-KZ',
110
- 'kn' => 'kn-IN',
111
- 'ko_KR' => 'ko-KR',
112
- 'ky_KY' => 'ky-KG',
113
  'lb_LU' => 'lb-LU',
114
- 'lo' => 'lo-LA',
115
- 'lt_LT' => 'lt-LT',
116
- 'lv' => 'lv-LV',
117
- 'mg_MG' => 'mg-MG',
118
- 'mk_MK' => 'mk-MK',
 
119
  'ml_IN' => 'ml-IN',
120
- 'mn' => 'mn-MN',
121
- 'mr' => 'mr-IN',
122
- 'ms_MY' => 'ms-MY',
123
- 'my_MM' => 'my-MM',
124
- 'ne_NP' => 'ne-NP',
 
125
  'nl_BE' => 'nl-BE',
126
- 'nl_NL' => 'nl-NL',
127
- 'nn_NO' => 'nn-NO',
128
- 'pa_IN' => 'pa-IN',
129
- 'pl_PL' => 'pl-PL',
130
- 'ps' => 'ps-AF',
 
131
  'pt_BR' => 'pt-BR',
132
- 'pt_PT' => 'pt-PT',
133
- 'ro_RO' => 'ro-RO',
134
- 'ru_RU' => 'ru-RU',
135
- 'sa_IN' => 'sa-IN',
136
- 'sd_PK' => 'sd-PK',
137
  'si_LK' => 'si-LK',
138
- 'sk_SK' => 'sk-SK',
139
- 'sl_SI' => 'sl-SI',
140
- 'so_SO' => 'so-SO',
141
- 'sq' => 'sq-SQ',
142
- 'sr_RS' => 'sr-CS',
143
  'su_ID' => 'su-ID',
144
- 'sv_SE' => 'sv-SE',
145
- 'sw' => 'sw-TZ',
146
- 'ta_IN' => 'ta-IN',
147
- 'te' => 'te-IN',
148
- 'tg' => 'tg-TJ',
 
149
  'th' => 'th-TH',
150
- 'tir' => 'ti-ER',
151
- 'tl' => 'tl-PH',
152
- 'tr_TR' => 'tr-TR',
153
- 'ug_CN' => 'ug-CN',
154
- 'uk' => 'uk-UA',
 
 
155
  'ur' => 'ur-PK',
156
- 'uz_UZ' => 'uz-UZ',
157
- 'vi' => 'vi-VN',
158
- 'zh_CN' => 'zh-CN',
159
- 'zh_HK' => 'zh-HK',
160
- 'zh_TW' => 'zh-TW',
 
 
 
161
  );
162
 
163
- /**
164
- * These are the locale codes that TMS can handle and process. Because polylang allows users to create
165
- * their own custom languages and locales we want to verify that we are able to handle a locale before we start
166
- * tracking it and allow the user to request translations for it.
167
- *
168
- * @var array
169
- */
170
- public static $allowed_tms_locales = array(
171
- 'ab-GE' => 'ab_GE',
172
- 'af-ZA' => 'af_ZA',
173
- 'ak-GH' => 'ak_GH',
174
- 'am-ET' => 'am_ET',
175
- 'apa-US' => 'apa_US',
176
- 'ar-AE' => 'ar_AE',
177
- 'ar-AF' => 'ar_AF',
178
- 'ar-BH' => 'ar_BH',
179
- 'ar-DZ' => 'ar_DZ',
180
- 'ar-EG' => 'ar_EG',
181
- 'ar-IQ' => 'ar_IQ',
182
- 'ar-JO' => 'ar_JO',
183
- 'ar-LY' => 'ar_LY',
184
- 'ar-MA' => 'ar_MA',
185
- 'ar-MR' => 'ar_MR',
186
- 'ar-OM' => 'ar_OM',
187
- 'ar-SA' => 'ar_SA',
188
- 'ar-SD' => 'ar_SD',
189
- 'ar-SY' => 'ar_SY',
190
- 'ar-TD' => 'ar_TD',
191
- 'ar-TN' => 'ar_TN',
192
- 'ar-UZ' => 'ar_UZ',
193
- 'ar-YE' => 'ar_YE',
194
- 'as-IN' => 'as_IN',
195
- 'ast-ES' => 'ast_ES',
196
- 'ay-BO' => 'ay_BO',
197
- 'az-AZ' => 'az_AZ',
198
- 'ba-RU' => 'ba_RU',
199
- 'be-BY' => 'be_BY',
200
- 'bg-BG' => 'bg_BG',
201
- 'bi-VU' => 'bi_VU',
202
- 'bik-PH' => 'bik_PH',
203
- 'bm-ML' => 'bm_ML',
204
- 'bn-BD' => 'bn_BD',
205
- 'bo-CN' => 'bo_CN',
206
- 'br-FR' => 'br_FR',
207
- 'bs-BA' => 'bs_BA',
208
- 'ca-ES' => 'ca_ES',
209
- 'ce-RU' => 'ce_RU',
210
- 'ceb-PH' => 'ceb_PH',
211
- 'ch-GU' => 'ch_GU',
212
- 'chr-US' => 'chr_US',
213
- 'chy-US' => 'chy_US',
214
- 'co-FR' => 'co_FR',
215
- 'cs-CZ' => 'cs_CZ',
216
- 'cy-GB' => 'cy_GB',
217
- 'da-DK' => 'da_DK',
218
- 'de-DE' => 'de_DE',
219
- 'dik-SD' => 'dik_SD',
220
- 'dv-MV' => 'dv_MV',
221
- 'dz-BT' => 'dz_BT',
222
- 'ee-GH' => 'ee_GH',
223
- 'efi-NG' => 'efi_NG',
224
- 'el-GR' => 'el_GR',
225
- 'en-AU' => 'en_AU',
226
- 'en-CA' => 'en_CA',
227
- 'en-GB' => 'en_GB',
228
- 'en-US' => 'en_US',
229
- 'en-ZA' => 'en_ZA',
230
- 'eo-FR' => 'eo_FR',
231
- 'es-AR' => 'es_AR',
232
- 'es-BO' => 'es_BO',
233
- 'es-CL' => 'es_CL',
234
- 'es-CO' => 'es_CO',
235
- 'es-CR' => 'es_CR',
236
- 'es-CU' => 'es_CU',
237
- 'es-DO' => 'es_DO',
238
- 'es-EC' => 'es_EC',
239
- 'es-ES' => 'es_ES',
240
- 'es-GT' => 'es_GT',
241
- 'es-HN' => 'es_HN',
242
- 'es-MX' => 'es_MX',
243
- 'es-NI' => 'es_NI',
244
- 'es-PA' => 'es_PA',
245
- 'es-PE' => 'es_PE',
246
- 'es-PR' => 'es_PR',
247
- 'es-PY' => 'es_PY',
248
- 'es-SV' => 'es_SV',
249
- 'es-UY' => 'es_UY',
250
- 'es-VE' => 'es_VE',
251
- 'et-EE' => 'et_EE',
252
- 'eu-ES' => 'eu_ES',
253
- 'fa-IR' => 'fa_IR',
254
- 'fat-GH' => 'fat_GH',
255
- 'fi-FI' => 'fi_FI',
256
- 'fj-FJ' => 'fj_FJ',
257
- 'fj-IN' => 'fj_IN',
258
- 'fon-BJ' => 'fon_BJ',
259
- 'fr-CA' => 'fr_CA',
260
- 'fr-FR' => 'fr_FR',
261
- 'gaa-GH' => 'gaa_GH',
262
- 'gbz-IR' => 'gbz_IR',
263
- 'gil-KI' => 'gil_KI',
264
- 'gl-ES' => 'gl_ES',
265
- 'gn-BO' => 'gn_BO',
266
- 'gu-IN' => 'gu_IN',
267
- 'ha-NG' => 'ha_NG',
268
- 'haw-US' => 'haw_US',
269
- 'he-IL' => 'he_IL',
270
- 'hi-IN' => 'hi_IN',
271
- 'hil-PH' => 'hil_PH',
272
- 'hmn-LA' => 'hmn_LA',
273
- 'hr-HR' => 'hr_HR',
274
- 'ht-HT' => 'ht_HT',
275
- 'hu-HU' => 'hu_HU',
276
- 'hy-AM' => 'hy_AM',
277
- 'id-ID' => 'id_ID',
278
- 'ig-NG' => 'ig_NG',
279
- 'ilo-PH' => 'ilo_PH',
280
- 'is-IS' => 'is_IS',
281
- 'it-IT' => 'it_IT',
282
- 'ja-JP' => 'ja_JP',
283
- 'jv-ID' => 'jv_ID',
284
- 'ka-GE' => 'ka_GE',
285
- 'kek-GT' => 'kek_GT',
286
- 'kg-CD' => 'kg_CD',
287
- 'kik-KE' => 'kik_KE',
288
- 'kin-RW' => 'kin_RW',
289
- 'kj-AO' => 'kj_AO',
290
- 'kk-KZ' => 'kk_KZ',
291
- 'km-KH' => 'km_KH',
292
- 'kn-IN' => 'kn_IN',
293
- 'ko-KR' => 'ko_KR',
294
- 'kos-FM' => 'kos_FM',
295
- 'ks-IN' => 'ks_IN',
296
- 'ku-IQ' => 'ku_IQ',
297
- 'kw-GB' => 'kw_GB',
298
- 'ky-KG' => 'ky_KG',
299
- 'la-VA' => 'la_VA',
300
- 'lb-LU' => 'lb_LU',
301
- 'lg-UG' => 'lg_UG',
302
- 'ln-CD' => 'ln_CD',
303
- 'lo-LA' => 'lo_LA',
304
- 'lt-LT' => 'lt_LT',
305
- 'lu-CD' => 'lu_CD',
306
- 'lv-LV' => 'lv_LV',
307
- 'mg-MG' => 'mg_MG',
308
- 'mh-MH' => 'mh_MH',
309
- 'mi-NZ' => 'mi_NZ',
310
- 'mk-MK' => 'mk_MK',
311
- 'ml-IN' => 'ml_IN',
312
- 'mn-MN' => 'mn_MN',
313
- 'mo-MD' => 'mo_MD',
314
- 'mr-IN' => 'mr_IN',
315
- 'ms-MY' => 'ms_MY',
316
- 'mt-MT' => 'mt_MT',
317
- 'my-MM' => 'my_MM',
318
- 'na-NR' => 'na_NR',
319
- 'nb-NO' => 'nb_NO',
320
- 'nd-ZW' => 'nd_ZW',
321
- 'ne-NP' => 'ne_NP',
322
- 'ng-NA' => 'ng_NA',
323
- 'niu-NU' => 'niu_NU',
324
- 'nl-NL' => 'nl_NL',
325
- 'nn-NO' => 'nn_NO',
326
- 'no-NO' => 'no_NO',
327
- 'nr-ZA' => 'nr_ZA',
328
- 'nso-ZA' => 'nso_ZA',
329
- 'nv-US' => 'nv_US',
330
- 'ny-MW' => 'ny_MW',
331
- 'om-ET' => 'om_ET',
332
- 'or-IN' => 'or_IN',
333
- 'pag-PH' => 'pag_PH',
334
- 'pap-AN' => 'pap_AN',
335
- 'pau-PW' => 'pau_PW',
336
- 'pl-PL' => 'pl_PL',
337
- 'ps-AF' => 'ps_AF',
338
- 'pt-BR' => 'pt_BR',
339
- 'pt-PT' => 'pt_PT',
340
- 'qu-BO' => 'qu_BO',
341
- 'rar-CK' => 'rar_CK',
342
- 'rn-BI' => 'rn_BI',
343
- 'ro-RO' => 'ro_RO',
344
- 'ru-RU' => 'ru_RU',
345
- 'sa-IN' => 'sa_IN',
346
- 'qu-PE' => 'qu_PE',
347
- 'sc-IT' => 'sc_IT',
348
- 'scn-IT' => 'scn_IT',
349
- 'sd-PK' => 'sd_PK',
350
- 'sg-CF' => 'sg_CF',
351
- 'si-LK' => 'si_LK',
352
- 'sk-SK' => 'sk_SK',
353
- 'sl-SI' => 'sl_SI',
354
- 'sm-WS' => 'sm_WS',
355
- 'sn-ZW' => 'sn_ZW',
356
- 'so-SO' => 'so_SO',
357
- 'sq-SQ' => 'sq_SQ',
358
- 'sr-CS' => 'sr_CS',
359
- 'ss-SZ' => 'ss_SZ',
360
- 'st-LS' => 'st_LS',
361
- 'su-ID' => 'su_ID',
362
- 'sv-SE' => 'sv_SE',
363
- 'sw-TZ' => 'sw_TZ',
364
- 'ta-IN' => 'ta_IN',
365
- 'te-IN' => 'te_IN',
366
- 'tg-TJ' => 'tg_TJ',
367
- 'th-TH' => 'th_TH',
368
- 'ti-ER' => 'ti_ER',
369
- 'tk-TM' => 'tk_TM',
370
- 'tl-PH' => 'tl_PH',
371
- 'tn-BW' => 'tn_BW',
372
- 'to-TO' => 'to_TO',
373
- 'tpi-PG' => 'tpi_PG',
374
- 'tr-TR' => 'tr_TR',
375
- 'ts-ZA' => 'ts_ZA',
376
- 'tum-MW' => 'tum_MW',
377
- 'tvl-TV' => 'tvl_TV',
378
- 'tw-GH' => 'tw_GH',
379
- 'ty-PF' => 'ty_PF',
380
- 'ug-CN' => 'ug_CN',
381
- 'uk-UA' => 'uk_UA',
382
- 'um-AO' => 'um_AO',
383
- 'ur-PK' => 'ur_PK',
384
- 'uz-UZ' => 'uz_UZ',
385
- 've-ZA' => 've_ZA',
386
- 'vi-VN' => 'vi_VN',
387
- 'war-PH' => 'war_PH',
388
- 'wo-SN' => 'wo_SN',
389
- 'xh-ZA' => 'xh_ZA',
390
- 'yap-FM' => 'yap_FM',
391
- 'yi-IL' => 'yi_IL',
392
- 'yo-NG' => 'yo_NG',
393
- 'zh-CN' => 'zh_CN',
394
- 'zh-HK' => 'zh_HK',
395
- 'zh-SG' => 'zh_SG',
396
- 'zh-TW' => 'zh_TW',
397
- 'zu-ZA' => 'zu_ZA',
398
- 'es-US' => 'es_US',
399
- 'fr-US' => 'fr_US',
400
- 'gd-GB' => 'gd_GB',
401
- 'ga-IE' => 'ga_IE',
402
- 'pa-IN' => 'pa_IN',
403
- 'pa-PK' => 'pa_PK',
404
- 'nl-BE' => 'nl_BE',
405
- 'de-CH' => 'de_CH',
406
- 'it-CH' => 'it_CH',
407
- 'fr-CH' => 'fr_CH',
408
- 'de-AT' => 'de_AT',
409
- 'chk-FM' => 'chk_FM',
410
- 'pam-PH' => 'pam_PH',
411
- 'pon-FM' => 'pon_FM',
412
- 'prs-AF' => 'prs_AF',
413
- 'aiq-AF' => 'aiq_AF',
414
- 'haz-AF' => 'haz_AF',
415
- 'cpe-US' => 'cpe_US',
416
- 'cpf-MU' => 'cpf_MU',
417
- 'cpp-BR' => 'cpp_BR',
418
- 'ar' => 'ar',
419
- 'aa-DJ' => 'aa_DJ',
420
- 'en-IE' => 'en_IE',
421
- 'es-419' => 'es_419',
422
- 'en-IN' => 'en_IN',
423
- 'fr-BE' => 'fr_BE',
424
- 'vls-BE' => 'vls_BE',
425
- );
426
 
427
  /**
428
  * Verifies that a lingotek-locale (ie. es-ES) is an allowed
@@ -433,7 +227,7 @@ class Lingotek {
433
  */
434
  public static function is_allowed_tms_locale($lingotek_locale)
435
  {
436
- return isset(self::$allowed_tms_locales[$lingotek_locale]);
437
  }
438
 
439
  /**
@@ -524,8 +318,6 @@ class Lingotek {
524
  public function do_plugin_updates() {
525
  $cr = get_option('lingotek_community_resources');
526
  if (is_array($cr) && isset($cr['workflows'])) {
527
- // unset($cr['workflows']['ab6c522a-7645-4317-9284-3fbddf516151']);
528
-
529
  // put Lingotek Professional Translation at the top of the select box.
530
  $cr['workflows'] = array_merge(array('ab6c522a-7645-4317-9284-3fbddf516151' => 'Lingotek Professional Translation'), $cr['workflows']);
531
  update_option('lingotek_community_resources', $cr);
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.3.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.
16
  exit();
17
  }
18
 
19
+ define( 'LINGOTEK_VERSION', '1.3.1' ); // 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).
25
  define( 'LINGOTEK_ADMIN_INC', LINGOTEK_DIR . '/admin' );
26
  define( 'LINGOTEK_WORKFLOWS', LINGOTEK_ADMIN_INC . '/workflows' );
27
  define( 'LINGOTEK_URL', plugins_url( '', __FILE__ ) );
28
+ define( 'BRIDGE_URL', 'https://inside.lingotek.com' );
29
 
30
  class Lingotek {
31
  /**
51
  */
52
  public static $lingotek_locales = array(
53
  'af' => 'af-ZA',
54
+ 'ak' => 'ak-GH',
55
+ 'am' => 'am-ET',
56
+ 'ar' => 'ar',
57
+ 'ar_AE' => 'ar-AE',
58
+ 'ar_AF' => 'ar-AF',
59
+ 'ar_BH' => 'ar-BH',
60
+ 'ar_DZ' => 'ar-DZ',
61
+ 'ar_EG' => 'ar-EG',
62
+ 'ar_IQ' => 'ar-IQ',
63
+ 'ar_JO' => 'ar-JO',
64
+ 'ar_LY' => 'ar-LY',
65
+ 'ar_MA' => 'ar-MA',
66
+ 'ar_MR' => 'ar-MR',
67
+ 'ar_OM' => 'ar-OM',
68
+ 'ar_SA' => 'ar-SA',
69
+ 'ar_SD' => 'ar-SD',
70
+ 'ar_SY' => 'ar-SY',
71
+ 'ar_TD' => 'ar-TD',
72
+ 'ar_TN' => 'ar-TN',
73
+ 'ar_UZ' => 'ar-UZ',
74
+ 'ar_YE' => 'ar-YE',
75
+ 'as' => 'as-IN',
76
+ 'az' => 'az-AZ',
77
  'ba' => 'ba-RU',
78
+ 'bel' => 'be-BY',
79
+ 'bg_BG' => 'bg-BG',
80
+ 'bn_BD' => 'bn-BD',
81
+ 'bo' => 'bo-CN',
82
+ 'bs_BA' => 'bs-BA',
83
  'ca' => 'ca-ES',
84
+ 'ca_ES' => 'ca-ES',
85
+ 'co' => 'co-FR',
86
+ 'cs_CZ' => 'cs-CZ',
87
+ 'cy' => 'cy-GB',
88
+ 'cy_GB' => 'cy-GB',
89
+ 'de_AT' => 'de-AT',
90
+ 'da_DK' => 'da-DK',
91
+ 'de_CH' => 'de-CH',
92
  'de_DE' => 'de-DE',
93
+ 'dv' => 'dv-MV',
94
+ 'el' => 'el-GR',
95
+ 'el_GR' => 'el-GR',
96
+ 'en_AU' => 'en-AU',
97
+ 'en_CA' => 'en-CA',
98
+ 'en_GB' => 'en-GB',
99
  'en_US' => 'en-US',
100
+ 'en_IE' => 'en-IE',
101
+ 'en_IN' => 'en-IN',
102
+ 'en_ZA' => 'en-ZA',
103
+ 'eo' => 'eo-FR',
104
+ 'es_419' => 'es-419',
105
+ 'es_AR' => 'es-AR',
106
+ 'es_BO' => 'es-BO',
107
+ 'es_CL' => 'es-CL',
108
+ 'es_CO' => 'es-CO',
109
+ 'es_ES' => 'es-ES',
110
  'es_MX' => 'es-MX',
111
+ 'es_PE' => 'es-PE',
112
+ 'es_PR' => 'es-PR',
113
+ 'es_VE' => 'es-VE',
114
+ 'es_HN' => 'es-HN',
115
+ 'es_CR' => 'es-CR',
116
+ 'es_CU' => 'es-CU',
117
+ 'es_DO' => 'es-DO',
118
+ 'es_EC' => 'es-EC',
119
+ 'es_GT' => 'es-GT',
120
+ 'es_NI' => 'es-NI',
121
+ 'es_PA' => 'es-PA',
122
+ 'es_PY' => 'es-PY',
123
+ 'es_SV' => 'es-SV',
124
+ 'es_UY' => 'es-UY',
125
+ 'es_US' => 'es-US',
126
+ 'et' => 'et-EE',
127
+ 'et_EE' => 'et-EE',
128
+ 'eu' => 'eu-ES',
129
  'fa_IR' => 'fa-IR',
130
+ 'fi' => 'fi-FI',
131
+ 'fi_FI' => 'fi-FI',
132
+ 'fr_FR' => 'fr-FR',
133
+ 'fr_BE' => 'fr-BE',
134
+ 'fr_CA' => 'fr-CA',
135
+ 'fr_CH' => 'fr-CH',
136
+ 'fr_US' => 'fr-US',
137
+ 'ga' => 'ga-IE',
138
+ 'gd' => 'gd-GB',
139
+ 'gl_ES' => 'gl-ES',
140
  'gn' => 'gn-BO',
141
+ 'haw_US' => 'haw-US',
142
+ 'he_IL' => 'he-IL',
143
+ 'hi_IN' => 'hi-IN',
144
+ 'hr' => 'hr-HR',
145
+ 'ht_HT' => 'ht-HT',
146
+ 'hu_HU' => 'hu-HU',
147
  'hy' => 'hy-AM',
148
+ 'id_ID' => 'id-ID',
149
+ 'is_IS' => 'is-IS',
150
+ 'it_IT' => 'it-IT',
151
+ 'it_CH' => 'it-CH',
152
+ 'ja' => 'ja-JP',
153
+ 'ja_JP' => 'ja-JP',
154
+ 'jv_ID' => 'jv-ID',
155
  'ka_GE' => 'ka-GE',
156
+ 'kin' => 'kin-RW',
157
+ 'kk' => 'kk-KZ',
158
+ 'kn' => 'kn-IN',
159
+ 'ko_KR' => 'ko-KR',
160
+ 'ky_KY' => 'ky-KG',
161
  'lb_LU' => 'lb-LU',
162
+ 'lo' => 'lo-LA',
163
+ 'lt_LT' => 'lt-LT',
164
+ 'lv' => 'lv-LV',
165
+ 'lv_LV' => 'lv-LV',
166
+ 'mg_MG' => 'mg-MG',
167
+ 'mk_MK' => 'mk-MK',
168
  'ml_IN' => 'ml-IN',
169
+ 'mn' => 'mn-MN',
170
+ 'mr' => 'mr-IN',
171
+ 'ms_MY' => 'ms-MY',
172
+ 'mt_MT' => 'mt-MT',
173
+ 'my_MM' => 'my-MM',
174
+ 'ne_NP' => 'ne-NP',
175
  'nl_BE' => 'nl-BE',
176
+ 'nl_NL' => 'nl-NL',
177
+ 'nn_NO' => 'nn-NO',
178
+ 'no_NO' => 'no-NO',
179
+ 'pa_IN' => 'pa-IN',
180
+ 'pl_PL' => 'pl-PL',
181
+ 'ps' => 'ps-AF',
182
  'pt_BR' => 'pt-BR',
183
+ 'pt_PT' => 'pt-PT',
184
+ 'ro_RO' => 'ro-RO',
185
+ 'ru_RU' => 'ru-RU',
186
+ 'sa_IN' => 'sa-IN',
187
+ 'sd_PK' => 'sd-PK',
188
  'si_LK' => 'si-LK',
189
+ 'sk_SK' => 'sk-SK',
190
+ 'sl_SI' => 'sl-SI',
191
+ // 'so_SO' => 'so-SO',
192
+ 'sq' => 'sq-SQ',
193
+ 'sr_RS' => 'sr-CS',
194
  'su_ID' => 'su-ID',
195
+ 'sv_SE' => 'sv-SE',
196
+ 'sw' => 'sw-TZ',
197
+ 'sw_TZ' => 'sw-TZ',
198
+ 'ta_IN' => 'ta-IN',
199
+ 'te' => 'te-IN',
200
+ 'tg' => 'tg-TJ',
201
  'th' => 'th-TH',
202
+ 'th_TH' => 'th-TH',
203
+ 'tir' => 'ti-ER',
204
+ 'tl' => 'tl-PH',
205
+ 'tr_TR' => 'tr-TR',
206
+ 'ug_CN' => 'ug-CN',
207
+ 'uk' => 'uk-UA',
208
+ 'uk_UA' => 'uk-UA',
209
  'ur' => 'ur-PK',
210
+ 'ur_PK' => 'ur-PK',
211
+ 'uz_UZ' => 'uz-UZ',
212
+ 'vi' => 'vi-VN',
213
+ 'vi_VN' => 'vi-VN',
214
+ 'zh_CN' => 'zh-CN',
215
+ 'zh_HK' => 'zh-HK',
216
+ 'zh_TW' => 'zh-TW',
217
+ 'zh_SG' => 'zh-SG',
218
  );
219
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
 
221
  /**
222
  * Verifies that a lingotek-locale (ie. es-ES) is an allowed
227
  */
228
  public static function is_allowed_tms_locale($lingotek_locale)
229
  {
230
+ return isset(self::$lingotek_locales[$lingotek_locale]) || in_array($lingotek_locale, self::$lingotek_locales);
231
  }
232
 
233
  /**
318
  public function do_plugin_updates() {
319
  $cr = get_option('lingotek_community_resources');
320
  if (is_array($cr) && isset($cr['workflows'])) {
 
 
321
  // put Lingotek Professional Translation at the top of the select box.
322
  $cr['workflows'] = array_merge(array('ab6c522a-7645-4317-9284-3fbddf516151' => 'Lingotek Professional Translation'), $cr['workflows']);
323
  update_option('lingotek_community_resources', $cr);
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: 4.8
7
- Stable tag: 1.3.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -122,17 +122,26 @@ For more, visit the [Lingotek documentation site](https://lingotek.atlassian.net
122
 
123
  == Changelog ==
124
 
 
 
 
 
 
 
 
 
 
125
  = 1.3.0 (2017-7-10) =
126
 
127
- * Added the Lingotek Professional Translation workflow.
128
- * Fixed a bug that was showing the incorrect profile type.
129
 
130
  = 1.2.9 (2017-6-15) =
131
 
132
- * Fixed a bug that displayed an error upon installing the plugin.
133
- * Fixed a bug that was breaking the String Groups page.
134
- * The real-time status updater has been fixed.
135
- * Statuses are saved correctly when callbacks are received quickly.
136
 
137
  = 1.2.8 (2017-4-17) =
138
 
@@ -260,7 +269,7 @@ For more, visit the [Lingotek documentation site](https://lingotek.atlassian.net
260
 
261
  = 1.0.7 (2015-08-18) =
262
 
263
- * Enhanced custom field support including compatibility with user created custom fields, the Advanced Custom Fields (ACF) plugin, and the use of language configuration files (i.e., wpml-config.xml) for default settings.
264
  * Fixed issue with sub-category translation
265
 
266
  = 1.0.6 (2015-07-30) =
@@ -270,7 +279,7 @@ For more, visit the [Lingotek documentation site](https://lingotek.atlassian.net
270
 
271
  = 1.0.5 (2015-07-23) =
272
 
273
- * Fixed dashboard reporting issue, reduced workflow select options for new users, and other usability improvements.
274
 
275
  = 1.0.4 (2015-07-21) =
276
 
@@ -278,7 +287,7 @@ For more, visit the [Lingotek documentation site](https://lingotek.atlassian.net
278
 
279
  = 1.0.3 (2015-07-20) =
280
 
281
- * Minor usability improvements.
282
 
283
  = 1.0.2 (2015-07-16) =
284
 
4
  Tags: automation, bilingual, international, language, Lingotek, localization, multilanguage, multilingual, translate, translation
5
  Requires at least: 3.8
6
  Tested up to: 4.8
7
+ Stable tag: 1.3.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
122
 
123
  == Changelog ==
124
 
125
+ = 1.3.1 (2017-7-13) =
126
+
127
+ * Added the ability to trigger auto-uploading of custom post statuses (Thanks to Soluto for contributing this feature!)
128
+ * Added a filter hook, lingotek_is_post_valid_for_upload, that allows users to provide custom logic to determine where a document should be auto-uploaded (Thanks to Soluto for contributing this feature!)
129
+ * Fixed a caching issue that was loading an outdated JavaScript file
130
+ * Fixed an issue that caused the Professional Translation Quote Calculator to fail if a language rate had not been set on the API side
131
+ * Fixed an auto-updater issue that was marking disabled languages as enabled
132
+ * Added several styling updates
133
+
134
  = 1.3.0 (2017-7-10) =
135
 
136
+ * Added the Lingotek Professional Translation workflow
137
+ * Fixed a bug that was showing the incorrect profile type
138
 
139
  = 1.2.9 (2017-6-15) =
140
 
141
+ * Fixed a bug that displayed an error upon installing the plugin
142
+ * Fixed a bug that was breaking the String Groups page
143
+ * The real-time status updater has been fixed
144
+ * Statuses are saved correctly when callbacks are received quickly
145
 
146
  = 1.2.8 (2017-4-17) =
147
 
269
 
270
  = 1.0.7 (2015-08-18) =
271
 
272
+ * Enhanced custom field support including compatibility with user created custom fields, the Advanced Custom Fields (ACF) plugin, and the use of language configuration files (i.e., wpml-config.xml) for default settings
273
  * Fixed issue with sub-category translation
274
 
275
  = 1.0.6 (2015-07-30) =
279
 
280
  = 1.0.5 (2015-07-23) =
281
 
282
+ * Fixed dashboard reporting issue, reduced workflow select options for new users, and other usability improvements
283
 
284
  = 1.0.4 (2015-07-21) =
285
 
287
 
288
  = 1.0.3 (2015-07-20) =
289
 
290
+ * Minor usability improvements
291
 
292
  = 1.0.2 (2015-07-16) =
293