Version Description
(2015-07-23) =
- Fixed dashboard reporting issue, reduced workflow select options for new users, and other usability improvements.
Download this release
Release Info
Developer | smithworx |
Plugin | Lingotek Translation |
Version | 1.0.5 |
Comparing to | |
See all releases |
Code changes from version 1.0.4 to 1.0.5
- admin/actions.php +3 -1
- admin/admin.php +25 -1
- admin/filters-post.php +5 -3
- admin/filters-term.php +6 -3
- include/model.php +3 -0
- js/updater.js +38 -26
- lingotek.php +2 -2
- readme.txt +7 -2
admin/actions.php
CHANGED
@@ -272,7 +272,9 @@ abstract class Lingotek_Actions {
|
|
272 |
return $actions;
|
273 |
|
274 |
$document = $this->lgtm->get_group($this->type, $id);
|
275 |
-
|
|
|
|
|
276 |
|
277 |
if ($this->lgtm->can_upload($this->type, $id) || (isset($document->source) && 'string' != $this->type && $this->lgtm->can_upload($this->type, $document->source))) {
|
278 |
$actions['lingotek-upload'] = $this->get_action_link(array($this->type => $id, 'action' => 'upload'));
|
272 |
return $actions;
|
273 |
|
274 |
$document = $this->lgtm->get_group($this->type, $id);
|
275 |
+
if (isset($document->desc_array['lingotek']['source'])) {
|
276 |
+
$id = $document->desc_array['lingotek']['source'];
|
277 |
+
}
|
278 |
|
279 |
if ($this->lgtm->can_upload($this->type, $id) || (isset($document->source) && 'string' != $this->type && $this->lgtm->can_upload($this->type, $document->source))) {
|
280 |
$actions['lingotek-upload'] = $this->get_action_link(array($this->type => $id, 'action' => 'upload'));
|
admin/admin.php
CHANGED
@@ -33,6 +33,7 @@ class Lingotek_Admin {
|
|
33 |
public function ajax_get_current_status(){
|
34 |
global $wpdb;
|
35 |
$lgtm = &$GLOBALS['wp_lingotek']->model;
|
|
|
36 |
$languages = pll_languages_list(array('fields' => 'locale'));
|
37 |
$object_ids = $_POST['check_ids'];
|
38 |
if($object_ids === null){
|
@@ -47,12 +48,22 @@ class Lingotek_Admin {
|
|
47 |
$content_metadata = array();
|
48 |
foreach($object_ids as $object_id) {
|
49 |
$id = $object_id;
|
50 |
-
$document = $lgtm->get_group($taxonomy, $
|
|
|
|
|
|
|
|
|
51 |
$source_language = $terms ? pll_get_term_language($document->source, 'locale')
|
52 |
: pll_get_post_language($document->source, 'locale');
|
|
|
|
|
|
|
|
|
|
|
53 |
$content_metadata[$id]['source'] = $source_language;
|
54 |
$content_metadata[$id]['doc_id'] = $document->document_id;
|
55 |
$content_metadata[$id]['source_id'] = $document->source;
|
|
|
56 |
$target_status = $document->status == 'edited' || $document->status == null ? 'edited' : 'current';
|
57 |
$content_metadata[$id][$source_language]['status'] = $document->source == $object_id ? $document->status : $target_status;
|
58 |
if(is_array($document->translations)){
|
@@ -358,11 +369,24 @@ class Lingotek_Admin {
|
|
358 |
}
|
359 |
|
360 |
$api_data = $client->get_workflows($community_id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
$workflows = array();
|
362 |
if ($api_data) {
|
363 |
foreach ($api_data->entities as $workflow) {
|
364 |
$workflows[$workflow->properties->id] = $workflow->properties->title;
|
365 |
}
|
|
|
|
|
|
|
|
|
366 |
natcasesort($workflows); //order by title (case-insensitive)
|
367 |
$refresh_success['workflows'] = TRUE;
|
368 |
}
|
33 |
public function ajax_get_current_status(){
|
34 |
global $wpdb;
|
35 |
$lgtm = &$GLOBALS['wp_lingotek']->model;
|
36 |
+
$pllm = $GLOBALS['polylang']->model;
|
37 |
$languages = pll_languages_list(array('fields' => 'locale'));
|
38 |
$object_ids = $_POST['check_ids'];
|
39 |
if($object_ids === null){
|
48 |
$content_metadata = array();
|
49 |
foreach($object_ids as $object_id) {
|
50 |
$id = $object_id;
|
51 |
+
$document = $lgtm->get_group($taxonomy, $object_id);
|
52 |
+
if($document->source !== $object_id){
|
53 |
+
$document = $lgtm->get_group($taxonomy, $document->source);
|
54 |
+
}
|
55 |
+
$source_id = $document->source !== null ? $document->source : $object_id;
|
56 |
$source_language = $terms ? pll_get_term_language($document->source, 'locale')
|
57 |
: pll_get_post_language($document->source, 'locale');
|
58 |
+
$existing_translations = $pllm->get_translations($taxonomy, $source_id);
|
59 |
+
$content_metadata[$id]['existing_trans'] = false;
|
60 |
+
if(count($existing_translations) > 1){
|
61 |
+
$content_metadata[$id]['existing_trans'] = true;
|
62 |
+
}
|
63 |
$content_metadata[$id]['source'] = $source_language;
|
64 |
$content_metadata[$id]['doc_id'] = $document->document_id;
|
65 |
$content_metadata[$id]['source_id'] = $document->source;
|
66 |
+
$content_metadata[$id]['source_status'] = $document->status;
|
67 |
$target_status = $document->status == 'edited' || $document->status == null ? 'edited' : 'current';
|
68 |
$content_metadata[$id][$source_language]['status'] = $document->source == $object_id ? $document->status : $target_status;
|
69 |
if(is_array($document->translations)){
|
369 |
}
|
370 |
|
371 |
$api_data = $client->get_workflows($community_id);
|
372 |
+
$default_workflows = array(
|
373 |
+
'c675bd20-0688-11e2-892e-0800200c9a66' => 'Machine Translation',
|
374 |
+
'ddf6e3c0-0688-11e2-892e-0800200c9a66' => 'Machine Translation + Post-Edit',
|
375 |
+
'6ff1b470-33fd-11e2-81c1-0800200c9a66' => 'Machine Translation + Translate',
|
376 |
+
'2b5498e0-f3c7-4c49-9afa-cca4b3345af7' => 'Translation + 1 review',
|
377 |
+
'814172a6-3744-4da7-b932-5857c1c20976' => 'Translation + 2 reviews',
|
378 |
+
'2210b148-0c44-4ae2-91d0-ca2ee47c069e' => 'Translation + 3 reviews',
|
379 |
+
'7993b4d7-4ada-46d0-93d5-858db46c4c7d' => 'Translation Only'
|
380 |
+
);
|
381 |
$workflows = array();
|
382 |
if ($api_data) {
|
383 |
foreach ($api_data->entities as $workflow) {
|
384 |
$workflows[$workflow->properties->id] = $workflow->properties->title;
|
385 |
}
|
386 |
+
$diff = array_diff_key($workflows, $default_workflows);
|
387 |
+
if (empty($diff)) {
|
388 |
+
$workflows = array('c675bd20-0688-11e2-892e-0800200c9a66' => 'Machine Translation');
|
389 |
+
}
|
390 |
natcasesort($workflows); //order by title (case-insensitive)
|
391 |
$refresh_success['workflows'] = TRUE;
|
392 |
}
|
admin/filters-post.php
CHANGED
@@ -55,10 +55,12 @@ class Lingotek_Filters_Post extends PLL_Admin_Filters_Post {
|
|
55 |
if (!$this->model->is_translated_post_type($post->post_type))
|
56 |
return;
|
57 |
|
58 |
-
|
|
|
59 |
|
60 |
-
|
61 |
-
|
|
|
62 |
}
|
63 |
}
|
64 |
|
55 |
if (!$this->model->is_translated_post_type($post->post_type))
|
56 |
return;
|
57 |
|
58 |
+
if (!isset($_REQUEST['import'])) {
|
59 |
+
parent::save_post($post_id, $post, $update);
|
60 |
|
61 |
+
if (!wp_is_post_revision($post_id) && 'auto-draft' != $post->post_status && Lingotek_Group_Post::is_valid_auto_upload_post_status($post->post_status) && 'automatic' == Lingotek_Model::get_profile_option('upload', $post->post_type, $this->model->get_post_language($post_id)) && !(isset($_POST['action']) && 'heartbeat' == $_POST['action']) && $this->lgtm->can_upload('post', $post_id)) {
|
62 |
+
$this->lgtm->upload_post($post_id);
|
63 |
+
}
|
64 |
}
|
65 |
}
|
66 |
|
admin/filters-term.php
CHANGED
@@ -50,10 +50,13 @@ class Lingotek_Filters_Term extends PLL_Admin_Filters_Term {
|
|
50 |
if (!$this->model->is_translated_taxonomy($taxonomy))
|
51 |
return;
|
52 |
|
53 |
-
|
|
|
54 |
|
55 |
-
|
56 |
-
|
|
|
|
|
57 |
}
|
58 |
|
59 |
/*
|
50 |
if (!$this->model->is_translated_taxonomy($taxonomy))
|
51 |
return;
|
52 |
|
53 |
+
if (!isset($_REQUEST['import'])) {
|
54 |
+
parent::save_term($term_id, $tt_id, $taxonomy);
|
55 |
|
56 |
+
if ('automatic' == Lingotek_Model::get_profile_option('upload', $taxonomy, $this->model->get_term_language($term_id)) && $this->lgtm->can_upload('term', $term_id))
|
57 |
+
$this->lgtm->upload_term($term_id, $taxonomy); {
|
58 |
+
}
|
59 |
+
}
|
60 |
}
|
61 |
|
62 |
/*
|
include/model.php
CHANGED
@@ -572,6 +572,9 @@ class Lingotek_Model {
|
|
572 |
}
|
573 |
}
|
574 |
}
|
|
|
|
|
|
|
575 |
}
|
576 |
|
577 |
return $r[$taxonomy] = compact('sources', 'targets', 'total');
|
572 |
}
|
573 |
}
|
574 |
}
|
575 |
+
if (count($sources) == 1 && $total != $sources[$this->pllm->options['default_lang']]) {
|
576 |
+
$total = $sources[$this->pllm->options['default_lang']];
|
577 |
+
}
|
578 |
}
|
579 |
|
580 |
return $r[$taxonomy] = compact('sources', 'targets', 'total');
|
js/updater.js
CHANGED
@@ -8,9 +8,10 @@ jQuery(document).ready(function($) {
|
|
8 |
var page_params = '/edit.php?';
|
9 |
var tr_id = '#post-';
|
10 |
var object_type = 'post';
|
|
|
11 |
if(url.indexOf('taxonomy') > -1){
|
12 |
var begin = url.indexOf('taxonomy=') + 'taxonomy='.length;
|
13 |
-
|
14 |
}
|
15 |
|
16 |
if($('.edit-tags-php').length > 0){
|
@@ -47,7 +48,9 @@ jQuery(document).ready(function($) {
|
|
47 |
$('.lingotek-upload').remove();
|
48 |
$('.lingotek-download').remove();
|
49 |
for(var key in data){
|
50 |
-
var source_id = key != data[key]['source_id']
|
|
|
|
|
51 |
var tr = $(tr_id + key);
|
52 |
if(data[key]['source'] === false){
|
53 |
updateUploadBulkLink(tr, data, source_id, 'upload' , 'Upload this item to Lingotek TMS', 'Upload to Lingotek');
|
@@ -57,34 +60,13 @@ jQuery(document).ready(function($) {
|
|
57 |
continue;
|
58 |
}
|
59 |
for(var locale in data[key]){
|
60 |
-
if(locale === 'source' || locale === 'doc_id' || locale === 'source_id'){
|
61 |
continue;
|
62 |
}
|
63 |
var td = $(tr).find('td.language_' + locale);
|
64 |
switch(data[key][locale]['status']){
|
65 |
case 'current':
|
66 |
-
|
67 |
-
if(locale === data[key]['source']){
|
68 |
-
$(td).find('.lingotek-color').remove();
|
69 |
-
if(post_data['terms_translations'] === true){
|
70 |
-
var request_link = $('<a></a>').attr('href', relative_url
|
71 |
-
+ '/edit-tags.php?action=edit'
|
72 |
-
+ '&taxonomy=' + taxonomy_type
|
73 |
-
+ '&tag_ID=' + key
|
74 |
-
+ '&post_type=post');
|
75 |
-
}
|
76 |
-
else {
|
77 |
-
var request_link = $('<a></a>').attr('href', relative_url
|
78 |
-
+ '/post.php?post=' + source_id
|
79 |
-
+ '&action=edit');
|
80 |
-
}
|
81 |
-
$(request_link).attr('title','Source uploaded')
|
82 |
-
.addClass('lingotek-color dashicons dashicons-yes');
|
83 |
-
$(td).append(request_link);
|
84 |
-
}
|
85 |
-
else {
|
86 |
-
updateWorkbenchIcon(td, data, key, locale, 'Current', 'edit');
|
87 |
-
}
|
88 |
break;
|
89 |
case 'pending':
|
90 |
updateGenericBulkLink(tr, data, key, 'status' , 'Update translations status of this item in Lingotek TMS', 'Update translations status ');
|
@@ -117,7 +99,7 @@ jQuery(document).ready(function($) {
|
|
117 |
else if ($(td).find('.pll_icon_add').length > 0 && data[key][data[key]['source']]['status'] === 'none'){
|
118 |
break;
|
119 |
}
|
120 |
-
else if(source !== false && data[key][
|
121 |
$(td).find('.pll_icon_add').remove();
|
122 |
$(td).find('.pll_icon_edit').remove();
|
123 |
$(td).find('.lingotek-color').remove();
|
@@ -184,6 +166,11 @@ jQuery(document).ready(function($) {
|
|
184 |
$(disassociate).before(status_update_link);
|
185 |
}
|
186 |
else {
|
|
|
|
|
|
|
|
|
|
|
187 |
$(row_actions).append(status_update_link);
|
188 |
}
|
189 |
}
|
@@ -214,4 +201,29 @@ jQuery(document).ready(function($) {
|
|
214 |
.addClass('lingotek-color dashicons dashicons-' + dashicon);
|
215 |
$(td).append(request_link);
|
216 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
});
|
8 |
var page_params = '/edit.php?';
|
9 |
var tr_id = '#post-';
|
10 |
var object_type = 'post';
|
11 |
+
var taxonomy_type = 'post';
|
12 |
if(url.indexOf('taxonomy') > -1){
|
13 |
var begin = url.indexOf('taxonomy=') + 'taxonomy='.length;
|
14 |
+
taxonomy_type = url.substring(begin);
|
15 |
}
|
16 |
|
17 |
if($('.edit-tags-php').length > 0){
|
48 |
$('.lingotek-upload').remove();
|
49 |
$('.lingotek-download').remove();
|
50 |
for(var key in data){
|
51 |
+
var source_id = key != data[key]['source_id'] && data[key]['source_id'] !== null
|
52 |
+
? data[key]['source_id']
|
53 |
+
: key;
|
54 |
var tr = $(tr_id + key);
|
55 |
if(data[key]['source'] === false){
|
56 |
updateUploadBulkLink(tr, data, source_id, 'upload' , 'Upload this item to Lingotek TMS', 'Upload to Lingotek');
|
60 |
continue;
|
61 |
}
|
62 |
for(var locale in data[key]){
|
63 |
+
if(locale === 'source' || locale === 'doc_id' || locale === 'source_id' || locale === 'source_status' || locale === 'existing_trans'){
|
64 |
continue;
|
65 |
}
|
66 |
var td = $(tr).find('td.language_' + locale);
|
67 |
switch(data[key][locale]['status']){
|
68 |
case 'current':
|
69 |
+
updateCurrentIndicator(td,data,key,locale, source_id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
break;
|
71 |
case 'pending':
|
72 |
updateGenericBulkLink(tr, data, key, 'status' , 'Update translations status of this item in Lingotek TMS', 'Update translations status ');
|
99 |
else if ($(td).find('.pll_icon_add').length > 0 && data[key][data[key]['source']]['status'] === 'none'){
|
100 |
break;
|
101 |
}
|
102 |
+
else if(source !== false && data[key]['source_status'] === 'current'){
|
103 |
$(td).find('.pll_icon_add').remove();
|
104 |
$(td).find('.pll_icon_edit').remove();
|
105 |
$(td).find('.lingotek-color').remove();
|
166 |
$(disassociate).before(status_update_link);
|
167 |
}
|
168 |
else {
|
169 |
+
if(data[key]['existing_trans'] === true && data[key]['source_id'] === null){
|
170 |
+
$(status_update_link).click(function(){
|
171 |
+
return confirm('You are about to overwrite existing translations. Are you sure?');
|
172 |
+
});
|
173 |
+
}
|
174 |
$(row_actions).append(status_update_link);
|
175 |
}
|
176 |
}
|
201 |
.addClass('lingotek-color dashicons dashicons-' + dashicon);
|
202 |
$(td).append(request_link);
|
203 |
}
|
204 |
+
|
205 |
+
function updateCurrentIndicator(td,data,key,locale, source_id){
|
206 |
+
$(td).find('.pll_icon_edit').remove();
|
207 |
+
if(locale === data[key]['source']){
|
208 |
+
$(td).find('.lingotek-color').remove();
|
209 |
+
if(post_data['terms_translations'] === true){
|
210 |
+
var request_link = $('<a></a>').attr('href', relative_url
|
211 |
+
+ '/edit-tags.php?action=edit'
|
212 |
+
+ '&taxonomy=' + taxonomy_type
|
213 |
+
+ '&tag_ID=' + key
|
214 |
+
+ '&post_type=post');
|
215 |
+
}
|
216 |
+
else {
|
217 |
+
var request_link = $('<a></a>').attr('href', relative_url
|
218 |
+
+ '/post.php?post=' + source_id
|
219 |
+
+ '&action=edit');
|
220 |
+
}
|
221 |
+
$(request_link).attr('title','Source uploaded')
|
222 |
+
.addClass('lingotek-color dashicons dashicons-yes');
|
223 |
+
$(td).append(request_link);
|
224 |
+
}
|
225 |
+
else {
|
226 |
+
updateWorkbenchIcon(td, data, key, locale, 'Current', 'edit');
|
227 |
+
}
|
228 |
+
}
|
229 |
});
|
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.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.
|
@@ -15,7 +15,7 @@ GitHub Plugin URI: https://github.com/lingotek/wp-lingotek
|
|
15 |
if (!function_exists('add_action'))
|
16 |
exit();
|
17 |
|
18 |
-
define('LINGOTEK_VERSION', '1.0.
|
19 |
define('LINGOTEK_MIN_PLL_VERSION', '1.7.4.2');
|
20 |
define('LINGOTEK_BASENAME', plugin_basename(__FILE__)); // plugin name as known by WP
|
21 |
define('LINGOTEK_PLUGIN_SLUG', 'wp-lingotek');// 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.0.5
|
6 |
Author: Lingotek and Frédéric Demarle
|
7 |
Author uri: http://lingotek.com
|
8 |
Description: Lingotek offers convenient cloud-based localization and translation.
|
15 |
if (!function_exists('add_action'))
|
16 |
exit();
|
17 |
|
18 |
+
define('LINGOTEK_VERSION', '1.0.5'); // plugin version (should match above meta)
|
19 |
define('LINGOTEK_MIN_PLL_VERSION', '1.7.4.2');
|
20 |
define('LINGOTEK_BASENAME', plugin_basename(__FILE__)); // plugin name as known by WP
|
21 |
define('LINGOTEK_PLUGIN_SLUG', 'wp-lingotek');// plugin slug (should match above meta: Text Domain)
|
readme.txt
CHANGED
@@ -4,11 +4,11 @@ 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.2
|
7 |
-
Stable tag: 1.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
-
|
12 |
|
13 |
== Description ==
|
14 |
|
@@ -115,6 +115,11 @@ For more, visit the [Lingotek documentation site](https://lingotek.atlassian.net
|
|
115 |
|
116 |
== Changelog ==
|
117 |
|
|
|
|
|
|
|
|
|
|
|
118 |
= 1.0.4 (2015-07-21) =
|
119 |
|
120 |
* Plugin and PHP compatability improvements
|
4 |
Tags: automation, bilingual, international, language, Lingotek, localization, multilanguage, multilingual, translate, translation
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.2
|
7 |
+
Stable tag: 1.0.5
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
+
Convenient cloud-based localization and translation for WordPress.
|
12 |
|
13 |
== Description ==
|
14 |
|
115 |
|
116 |
== Changelog ==
|
117 |
|
118 |
+
|
119 |
+
= 1.0.5 (2015-07-23) =
|
120 |
+
|
121 |
+
* Fixed dashboard reporting issue, reduced workflow select options for new users, and other usability improvements.
|
122 |
+
|
123 |
= 1.0.4 (2015-07-21) =
|
124 |
|
125 |
* Plugin and PHP compatability improvements
|