Version Description
(2015-07-16) =
- Real-time translation status updates!
Download this release
Release Info
Developer | smithworx |
Plugin | Lingotek Translation |
Version | 1.0.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.0.2
- admin/actions.php +1 -1
- admin/admin.php +78 -4
- admin/filters-columns.php +25 -16
- admin/manage/view-string-groups.php +6 -3
- admin/post-actions.php +1 -0
- admin/tutorial/faq.php +2 -2
- js/progress.js +0 -1
- js/updater.js +177 -0
- lingotek.php +2 -2
- readme.txt +42 -3
admin/actions.php
CHANGED
@@ -86,7 +86,7 @@ abstract class Lingotek_Actions {
|
|
86 |
),
|
87 |
|
88 |
'current' => array(
|
89 |
-
'title' => __('
|
90 |
'icon' => 'edit'
|
91 |
),
|
92 |
|
86 |
),
|
87 |
|
88 |
'current' => array(
|
89 |
+
'title' => __('Current', 'wp-lingotek'),
|
90 |
'icon' => 'edit'
|
91 |
),
|
92 |
|
admin/admin.php
CHANGED
@@ -8,7 +8,6 @@ class Lingotek_Admin {
|
|
8 |
* @since 0.1
|
9 |
*/
|
10 |
public function __construct() {
|
11 |
-
|
12 |
$plugin = Lingotek::get_instance();
|
13 |
$this->plugin_slug = $plugin->get_plugin_slug();
|
14 |
$this->dashboard = new Lingotek_Dashboard($plugin);
|
@@ -26,11 +25,84 @@ class Lingotek_Admin {
|
|
26 |
add_action('load-translation_page_wp-lingotek_manage', array(&$this, 'load_manage_page'));
|
27 |
add_filter('set-screen-option', array($this, 'set_screen_option'), 10, 3);
|
28 |
|
29 |
-
|
30 |
-
|
31 |
//Network admin menu
|
32 |
add_action('network_admin_menu', array($this, 'add_network_admin_menu'));
|
33 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
public function get_dashboard_endpoint(){
|
36 |
return site_url("wp-admin/admin-ajax.php?action=".$this->ajax_dashboard_language_endpoint);
|
@@ -55,6 +127,7 @@ class Lingotek_Admin {
|
|
55 |
// FIXME: check if I can load more scripts in footer
|
56 |
$scripts = array(
|
57 |
'progress' => array(array('edit', 'upload', 'edit-tags', 'translation_page_wp-lingotek_manage', 'translation_page_wp-lingotek_settings'), array('jquery-ui-progressbar', 'jquery-ui-dialog', 'wp-ajax-response'), 1),
|
|
|
58 |
);
|
59 |
|
60 |
$styles = array(
|
@@ -409,8 +482,9 @@ class Lingotek_Admin {
|
|
409 |
* @since 0.2
|
410 |
*/
|
411 |
public function set_screen_option($status, $option, $value) {
|
412 |
-
if ('lingotek_strings_per_page' == $option)
|
413 |
return $value;
|
|
|
414 |
return $status;
|
415 |
}
|
416 |
|
8 |
* @since 0.1
|
9 |
*/
|
10 |
public function __construct() {
|
|
|
11 |
$plugin = Lingotek::get_instance();
|
12 |
$this->plugin_slug = $plugin->get_plugin_slug();
|
13 |
$this->dashboard = new Lingotek_Dashboard($plugin);
|
25 |
add_action('load-translation_page_wp-lingotek_manage', array(&$this, 'load_manage_page'));
|
26 |
add_filter('set-screen-option', array($this, 'set_screen_option'), 10, 3);
|
27 |
|
28 |
+
add_action('wp_ajax_'.$this->ajax_dashboard_language_endpoint, array(&$this->dashboard, 'ajax_language_dashboard'));
|
29 |
+
add_action('wp_ajax_get_current_status', array($this,'ajax_get_current_status'));
|
30 |
//Network admin menu
|
31 |
add_action('network_admin_menu', array($this, 'add_network_admin_menu'));
|
32 |
}
|
33 |
+
public function ajax_get_current_status(){
|
34 |
+
global $wpdb;
|
35 |
+
$languages = pll_languages_list(array('fields' => 'locale'));
|
36 |
+
$object_ids = $_POST['check_ids'];
|
37 |
+
if($object_ids === null){
|
38 |
+
return;
|
39 |
+
}
|
40 |
+
$terms = isset($_POST['terms_translations']);
|
41 |
+
$taxonomy = $terms ? 'term_translations'
|
42 |
+
: 'post_translations';
|
43 |
+
//this function allows for sanitization of a variable amount of sql IN values
|
44 |
+
$relationship_placeholders = $this->lingotek_get_placeholders($object_ids);
|
45 |
+
|
46 |
+
$terms_query = $wpdb->prepare("SELECT term_tax.*, terms.name AS doc_id, wp_tr.object_id FROM wp_term_taxonomy term_tax "
|
47 |
+
. "INNER JOIN wp_terms terms ON term_tax.term_id = terms.term_id "
|
48 |
+
. "INNER JOIN wp_term_relationships wp_tr ON term_tax.term_taxonomy_id = wp_tr.term_taxonomy_id "
|
49 |
+
. "WHERE taxonomy = '$taxonomy' "
|
50 |
+
. "AND wp_tr.object_id in ($relationship_placeholders)", $object_ids);
|
51 |
+
$results = $wpdb->get_results($terms_query);
|
52 |
+
|
53 |
+
//package up the db results into an associative array. The main array consists of
|
54 |
+
//ids and nonces. Each id has a source language, languages with statuses, and a workbench link
|
55 |
+
$content_metadata = [];
|
56 |
+
foreach($results as $group => $result){
|
57 |
+
$id = $result->object_id;
|
58 |
+
$post_data = unserialize($result->description)['lingotek'];
|
59 |
+
|
60 |
+
$source_language = $terms ? pll_get_term_language($post_data['source'], 'locale')
|
61 |
+
: pll_get_post_language($post_data['source'], 'locale');
|
62 |
+
|
63 |
+
$content_metadata[$id]['source'] = $source_language;
|
64 |
+
$content_metadata[$id]['doc_id'] = $result->doc_id;
|
65 |
+
$content_metadata[$id][$source_language]['status'] = $post_data['status'];
|
66 |
+
foreach($post_data['translations']as $locale => $translation_status){
|
67 |
+
$content_metadata[$id][$locale]['status'] = $translation_status;
|
68 |
+
$workbench_link = Lingotek_Actions::workbench_link($result->doc_id, $locale);
|
69 |
+
$content_metadata[$id][$locale]['workbench_link'] = $workbench_link;
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
//fills in missing languages to be able to update all the ones listed on Wordpress
|
74 |
+
foreach($languages as $language){
|
75 |
+
foreach($content_metadata as $group => $status){
|
76 |
+
if(!isset($status[$language])){
|
77 |
+
$content_metadata[$group][$language]['status'] = "none";
|
78 |
+
}
|
79 |
+
}
|
80 |
+
}
|
81 |
+
//get the nonces associated with the different actions
|
82 |
+
$content_metadata['request_nonce'] = $this->lingotek_get_matching_nonce('lingotek-request');
|
83 |
+
$content_metadata['download_nonce'] = $this->lingotek_get_matching_nonce('lingotek-download');
|
84 |
+
$content_metadata['upload_nonce'] = $this->lingotek_get_matching_nonce('lingotek-upload');
|
85 |
+
$content_metadata['status_nonce'] = $this->lingotek_get_matching_nonce('lingotek-status');
|
86 |
+
|
87 |
+
wp_send_json($content_metadata);
|
88 |
+
}
|
89 |
+
|
90 |
+
public function lingotek_get_matching_nonce($action){
|
91 |
+
$upload_link = wp_nonce_url(add_query_arg(array(
|
92 |
+
'action' => $action)),
|
93 |
+
$action);
|
94 |
+
$nonce_begin = strpos($upload_link, 'wpnonce=') + 8;
|
95 |
+
$nonce = substr($upload_link,$nonce_begin);
|
96 |
+
return $nonce;
|
97 |
+
}
|
98 |
+
|
99 |
+
public function lingotek_get_placeholders($items){
|
100 |
+
foreach($items as $item){
|
101 |
+
$placeholders .= '%s,';
|
102 |
+
}
|
103 |
+
$placeholders = rtrim($placeholders, ',');
|
104 |
+
return $placeholders;
|
105 |
+
}
|
106 |
|
107 |
public function get_dashboard_endpoint(){
|
108 |
return site_url("wp-admin/admin-ajax.php?action=".$this->ajax_dashboard_language_endpoint);
|
127 |
// FIXME: check if I can load more scripts in footer
|
128 |
$scripts = array(
|
129 |
'progress' => array(array('edit', 'upload', 'edit-tags', 'translation_page_wp-lingotek_manage', 'translation_page_wp-lingotek_settings'), array('jquery-ui-progressbar', 'jquery-ui-dialog', 'wp-ajax-response'), 1),
|
130 |
+
'updater' => array(array('edit', 'upload', 'edit-tags'), array('jquery-ui-progressbar', 'jquery-ui-dialog', 'wp-ajax-response'), 1),
|
131 |
);
|
132 |
|
133 |
$styles = array(
|
482 |
* @since 0.2
|
483 |
*/
|
484 |
public function set_screen_option($status, $option, $value) {
|
485 |
+
if ('lingotek_strings_per_page' == $option) {
|
486 |
return $value;
|
487 |
+
}
|
488 |
return $status;
|
489 |
}
|
490 |
|
admin/filters-columns.php
CHANGED
@@ -43,7 +43,7 @@ class Lingotek_Filters_Columns extends PLL_Admin_Filters_Columns {
|
|
43 |
}
|
44 |
|
45 |
foreach ($this->model->get_languages_list() as $language) {
|
46 |
-
$columns['language_'.$language->
|
47 |
sprintf('<a href="" title="%s">%s</a>',
|
48 |
esc_html("$language->name ($language->locale)"),
|
49 |
esc_html($language->slug)
|
@@ -70,18 +70,19 @@ class Lingotek_Filters_Columns extends PLL_Admin_Filters_Columns {
|
|
70 |
$this->model->get_language($_POST['inline_lang_choice']) :
|
71 |
call_user_func(array($this->model, 'get_' . $type . '_language'), $object_id);
|
72 |
|
73 |
-
if (false === strpos($column, 'language_') || !$lang)
|
74 |
return '';
|
|
|
75 |
|
76 |
$language = $this->model->get_language(substr($column, 9));
|
77 |
|
78 |
// FIXME should I suppress quick edit?
|
79 |
// yes for uploaded posts, but I will need js as the field is built for all posts
|
80 |
// /!\ also take care not add this field two times when translations are managed by Polylang
|
81 |
-
|
82 |
// hidden field containing the post language for quick edit (used to filter categories since Polylang 1.7)
|
83 |
-
if ($column == $this->get_first_language_column()
|
84 |
printf('<div class="hidden" id="lang_%d">%s</div>', esc_attr($object_id), esc_html($lang->slug));
|
|
|
85 |
|
86 |
$id = ($inline && $lang->slug != $this->model->get_language($_POST['old_lang'])->slug) ?
|
87 |
($language->slug == $lang->slug ? $object_id : 0) :
|
@@ -96,42 +97,50 @@ class Lingotek_Filters_Columns extends PLL_Admin_Filters_Columns {
|
|
96 |
$disabled = 'disabled' == $profile['profile'];
|
97 |
|
98 |
// post ready for upload
|
99 |
-
if ($this->lgtm->can_upload($type, $object_id) && $object_id == $id)
|
100 |
return $disabled ?
|
101 |
-
('post' == $type ? parent::post_column($column, $object_id)
|
102 |
-
|
|
|
|
|
103 |
|
104 |
// translation disabled
|
105 |
-
elseif (isset($document->source) && $document->is_disabled_target($language))
|
106 |
return 'post' == $type ? parent::post_column($column, $object_id) : parent::term_column('', $column, $object_id);
|
|
|
107 |
|
108 |
// source post is uploaded
|
109 |
elseif (isset($document->source) && $document->source == $id) {
|
110 |
// source ready for upload
|
111 |
-
if ($this->lgtm->can_upload($type, $id))
|
112 |
return $actions->upload_icon($id);
|
|
|
113 |
|
114 |
// importing source
|
115 |
-
if ($id == $object_id && 'importing' == $document->status)
|
116 |
return Lingotek_Actions::importing_icon($document);
|
|
|
117 |
|
118 |
// uploaded
|
119 |
return 'post' == $type ? Lingotek_Post_actions::uploaded_icon($id) : Lingotek_Term_actions::uploaded_icon($id);
|
120 |
}
|
121 |
|
122 |
// translations
|
123 |
-
elseif (isset($document->translations[$language->locale]) || (isset($document->source) && 'current' == $document->status))
|
124 |
return Lingotek_Actions::translation_icon($document, $language);
|
|
|
125 |
|
126 |
// translations exist but are not managed by Lingotek TMS
|
127 |
-
elseif (empty($document->source))
|
128 |
-
return $object_id == $id && !$disabled ?
|
129 |
-
|
130 |
-
|
|
|
131 |
|
132 |
// no translation
|
133 |
-
else
|
134 |
return '<div class="lingotek-color dashicons dashicons-no"></div>';
|
|
|
135 |
}
|
136 |
|
137 |
/*
|
43 |
}
|
44 |
|
45 |
foreach ($this->model->get_languages_list() as $language) {
|
46 |
+
$columns['language_'.$language->locale] = $language->flag ? $language->flag :
|
47 |
sprintf('<a href="" title="%s">%s</a>',
|
48 |
esc_html("$language->name ($language->locale)"),
|
49 |
esc_html($language->slug)
|
70 |
$this->model->get_language($_POST['inline_lang_choice']) :
|
71 |
call_user_func(array($this->model, 'get_' . $type . '_language'), $object_id);
|
72 |
|
73 |
+
if (false === strpos($column, 'language_') || !$lang) {
|
74 |
return '';
|
75 |
+
}
|
76 |
|
77 |
$language = $this->model->get_language(substr($column, 9));
|
78 |
|
79 |
// FIXME should I suppress quick edit?
|
80 |
// yes for uploaded posts, but I will need js as the field is built for all posts
|
81 |
// /!\ also take care not add this field two times when translations are managed by Polylang
|
|
|
82 |
// hidden field containing the post language for quick edit (used to filter categories since Polylang 1.7)
|
83 |
+
if ($column == $this->get_first_language_column() /*&& !$this->model->get_translation_id('post', $post_id)*/) {
|
84 |
printf('<div class="hidden" id="lang_%d">%s</div>', esc_attr($object_id), esc_html($lang->slug));
|
85 |
+
}
|
86 |
|
87 |
$id = ($inline && $lang->slug != $this->model->get_language($_POST['old_lang'])->slug) ?
|
88 |
($language->slug == $lang->slug ? $object_id : 0) :
|
97 |
$disabled = 'disabled' == $profile['profile'];
|
98 |
|
99 |
// post ready for upload
|
100 |
+
if ($this->lgtm->can_upload($type, $object_id) && $object_id == $id) {
|
101 |
return $disabled ?
|
102 |
+
('post' == $type ? parent::post_column($column, $object_id)
|
103 |
+
: parent::term_column('', $column, $object_id))
|
104 |
+
: $actions->upload_icon($object_id);
|
105 |
+
}
|
106 |
|
107 |
// translation disabled
|
108 |
+
elseif (isset($document->source) && $document->is_disabled_target($language)) {
|
109 |
return 'post' == $type ? parent::post_column($column, $object_id) : parent::term_column('', $column, $object_id);
|
110 |
+
}
|
111 |
|
112 |
// source post is uploaded
|
113 |
elseif (isset($document->source) && $document->source == $id) {
|
114 |
// source ready for upload
|
115 |
+
if ($this->lgtm->can_upload($type, $id)) {
|
116 |
return $actions->upload_icon($id);
|
117 |
+
}
|
118 |
|
119 |
// importing source
|
120 |
+
if ($id == $object_id && 'importing' == $document->status) {
|
121 |
return Lingotek_Actions::importing_icon($document);
|
122 |
+
}
|
123 |
|
124 |
// uploaded
|
125 |
return 'post' == $type ? Lingotek_Post_actions::uploaded_icon($id) : Lingotek_Term_actions::uploaded_icon($id);
|
126 |
}
|
127 |
|
128 |
// translations
|
129 |
+
elseif (isset($document->translations[$language->locale]) || (isset($document->source) && 'current' == $document->status)){
|
130 |
return Lingotek_Actions::translation_icon($document, $language);
|
131 |
+
}
|
132 |
|
133 |
// translations exist but are not managed by Lingotek TMS
|
134 |
+
elseif (empty($document->source)) {
|
135 |
+
return $object_id == $id && !$disabled ? $actions->upload_icon($object_id, true)
|
136 |
+
: ('post' == $type ? parent::post_column($column, $object_id)
|
137 |
+
: parent::term_column('', $column, $object_id));
|
138 |
+
}
|
139 |
|
140 |
// no translation
|
141 |
+
else {
|
142 |
return '<div class="lingotek-color dashicons dashicons-no"></div>';
|
143 |
+
}
|
144 |
}
|
145 |
|
146 |
/*
|
admin/manage/view-string-groups.php
CHANGED
@@ -16,12 +16,14 @@ else {
|
|
16 |
$string_actions = $GLOBALS['wp_lingotek']->string_actions;
|
17 |
$table = new Lingotek_Strings_Table($string_actions);
|
18 |
$action = $table->current_action();
|
19 |
-
if (!empty($action))
|
20 |
$string_actions->manage_actions($action);
|
|
|
21 |
|
22 |
$data = Lingotek_Model::get_strings();
|
23 |
-
foreach ($data as $key => $row)
|
24 |
$data[$key]['row'] = $key; // store the row number for convenience
|
|
|
25 |
|
26 |
$table->prepare_items($data); ?>
|
27 |
|
@@ -30,7 +32,8 @@ else {
|
|
30 |
</form><?php
|
31 |
|
32 |
foreach (Lingotek_String_actions::$actions as $action => $strings) {
|
33 |
-
if (!empty($_GET['bulk-lingotek-' . $action]))
|
34 |
printf('<div id="lingotek-progressdialog" title="%s"><div id="lingotek-progressbar"></div></div>', $strings['progress']);
|
|
|
35 |
}
|
36 |
}
|
16 |
$string_actions = $GLOBALS['wp_lingotek']->string_actions;
|
17 |
$table = new Lingotek_Strings_Table($string_actions);
|
18 |
$action = $table->current_action();
|
19 |
+
if (!empty($action)) {
|
20 |
$string_actions->manage_actions($action);
|
21 |
+
}
|
22 |
|
23 |
$data = Lingotek_Model::get_strings();
|
24 |
+
foreach ($data as $key => $row) {
|
25 |
$data[$key]['row'] = $key; // store the row number for convenience
|
26 |
+
}
|
27 |
|
28 |
$table->prepare_items($data); ?>
|
29 |
|
32 |
</form><?php
|
33 |
|
34 |
foreach (Lingotek_String_actions::$actions as $action => $strings) {
|
35 |
+
if (!empty($_GET['bulk-lingotek-' . $action])) {
|
36 |
printf('<div id="lingotek-progressdialog" title="%s"><div id="lingotek-progressbar"></div></div>', $strings['progress']);
|
37 |
+
}
|
38 |
}
|
39 |
}
|
admin/post-actions.php
CHANGED
@@ -94,6 +94,7 @@ class Lingotek_Post_actions extends Lingotek_Actions {
|
|
94 |
*/
|
95 |
public function manage_actions() {
|
96 |
global $typenow;
|
|
|
97 |
$post_type = 'load-upload.php' == current_filter() ? 'attachment' : $typenow;
|
98 |
|
99 |
if (!$this->pllm->is_translated_post_type($post_type))
|
94 |
*/
|
95 |
public function manage_actions() {
|
96 |
global $typenow;
|
97 |
+
printf('<div id="auto-update" class="hidden"></div>');
|
98 |
$post_type = 'load-upload.php' == current_filter() ? 'attachment' : $typenow;
|
99 |
|
100 |
if (!$this->pllm->is_translated_post_type($post_type))
|
admin/tutorial/faq.php
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
</p>
|
26 |
|
27 |
<b><?php _e("Why can't I upload my existing content to Lingotek?", 'wp-lingotek') ?></b>
|
28 |
-
<p><?php printf(__("You must assign a language to content that existed before you installed the <i>Polylang</i> and <i>Lingotek</i> plugins. You can do this manually or use the <a href='%s'><i>Lingotek Language Utility</i></a> to set all content that doesn't have an assigned language to the default language. This will allow you to upload your
|
29 |
|
30 |
<b><?php _e("Can I use my own translation agency with Lingotek?", 'wp-lingotek') ?></b>
|
31 |
<p><?php _e( "Use your own translation agency or tap into Lingotek's network of more than 5,000+ in-country translators. Content transfer is fully automated between WordPress and Lingotek. You'll have full visibility into the translation process every step of the way. And once the translations are completed, they'll automatically download and publish to your website according to the preferences you've set." , 'wp-lingotek'); ?></p>
|
@@ -44,7 +44,7 @@
|
|
44 |
</ul>
|
45 |
|
46 |
<b><?php _e('What happens when I <i>Disassociate Translations</i>?', 'wp-lingotek') ?></b>
|
47 |
-
<p><?php _e('When content is disassociated the connection between WordPress and <i>Lingotek</i> safely
|
48 |
|
49 |
<b><?php _e("How do I translate strings within widgets or general WordPress settings (e.g., Site Title, Tagline)?", 'wp-lingotek') ?></b>
|
50 |
<p><?php printf(__( "Groups of strings can be sent for translation and managed using the <a href='%s'>String Groups</a> page. Individual strings may be viewed on the <a href='%s'>Strings</a> page." , 'wp-lingotek'),'admin.php?page=wp-lingotek_manage&sm=string-groups','admin.php?page=wp-lingotek_manage&sm=strings'); ?></p>
|
25 |
</p>
|
26 |
|
27 |
<b><?php _e("Why can't I upload my existing content to Lingotek?", 'wp-lingotek') ?></b>
|
28 |
+
<p><?php printf(__("You must assign a language to content that existed before you installed the <i>Polylang</i> and <i>Lingotek</i> plugins. You can do this manually or use the <a href='%s'><i>Lingotek Language Utility</i></a> to set all content that doesn't have an assigned language to the default language. This will allow you to upload your existing content to Lingotek.", 'wp-lingotek'), 'admin.php?page=wp-lingotek_settings&sm=utilities'); ?></p>
|
29 |
|
30 |
<b><?php _e("Can I use my own translation agency with Lingotek?", 'wp-lingotek') ?></b>
|
31 |
<p><?php _e( "Use your own translation agency or tap into Lingotek's network of more than 5,000+ in-country translators. Content transfer is fully automated between WordPress and Lingotek. You'll have full visibility into the translation process every step of the way. And once the translations are completed, they'll automatically download and publish to your website according to the preferences you've set." , 'wp-lingotek'); ?></p>
|
44 |
</ul>
|
45 |
|
46 |
<b><?php _e('What happens when I <i>Disassociate Translations</i>?', 'wp-lingotek') ?></b>
|
47 |
+
<p><?php _e('When content is disassociated, the connection between WordPress and <i>Lingotek</i> is safely removed so that translations can be solely managed inside of WordPress.', 'wp-lingotek') ?></p>
|
48 |
|
49 |
<b><?php _e("How do I translate strings within widgets or general WordPress settings (e.g., Site Title, Tagline)?", 'wp-lingotek') ?></b>
|
50 |
<p><?php printf(__( "Groups of strings can be sent for translation and managed using the <a href='%s'>String Groups</a> page. Individual strings may be viewed on the <a href='%s'>Strings</a> page." , 'wp-lingotek'),'admin.php?page=wp-lingotek_manage&sm=string-groups','admin.php?page=wp-lingotek_manage&sm=strings'); ?></p>
|
js/progress.js
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
jQuery(document).ready(function($) {
|
2 |
-
|
3 |
function lingotek_progress(i) {
|
4 |
if (i < lingotek_data.ids.length) {
|
5 |
var data = {
|
1 |
jQuery(document).ready(function($) {
|
|
|
2 |
function lingotek_progress(i) {
|
3 |
if (i < lingotek_data.ids.length) {
|
4 |
var data = {
|
js/updater.js
ADDED
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function($) {
|
2 |
+
var checkboxes = $('#the-list').find('input');
|
3 |
+
var current_ids = {};
|
4 |
+
var post_data = {"check_ids" : current_ids};
|
5 |
+
var url = window.location.href;
|
6 |
+
var end = url.indexOf('wp-admin') + 'wp-admin'.length;
|
7 |
+
var relative_url = url.substring(0,end);
|
8 |
+
var ajax_url = relative_url + '/admin-ajax.php?action=get_current_status';
|
9 |
+
var page_params = '/edit.php?';
|
10 |
+
var tr_id = '#post-';
|
11 |
+
if(url.indexOf('taxonomy') > -1){
|
12 |
+
var begin = url.indexOf('taxonomy=') + 'taxonomy='.length;
|
13 |
+
var taxonomy_type = url.substring(begin);
|
14 |
+
}
|
15 |
+
$(checkboxes).each(function(){
|
16 |
+
current_ids[$(this).val()] = $(this).val();
|
17 |
+
});
|
18 |
+
if(taxonomy_type === 'category'){
|
19 |
+
var uncategorized_id = 1;
|
20 |
+
current_ids[uncategorized_id] = uncategorized_id;
|
21 |
+
}
|
22 |
+
if($('.edit-tags-php').length > 0){
|
23 |
+
post_data['terms_translations'] = true;
|
24 |
+
page_params = '/edit-tags.php?taxonomy=' + taxonomy_type + '&';
|
25 |
+
tr_id = '#tag-';
|
26 |
+
}
|
27 |
+
setInterval(function(){
|
28 |
+
$.ajax({
|
29 |
+
type: 'POST',
|
30 |
+
url: ajax_url,
|
31 |
+
data: post_data,
|
32 |
+
dataType: 'json',
|
33 |
+
success: function (data) {
|
34 |
+
if (data !== null) {
|
35 |
+
update_indicators(data);
|
36 |
+
}
|
37 |
+
}
|
38 |
+
});
|
39 |
+
},10000);
|
40 |
+
|
41 |
+
|
42 |
+
function update_indicators(data){
|
43 |
+
for(var key in data){
|
44 |
+
if(key.indexOf('_nonce') > -1) {
|
45 |
+
continue;
|
46 |
+
}
|
47 |
+
var tr = $(tr_id + key);
|
48 |
+
for(var locale in data[key]){
|
49 |
+
if(locale === 'source' || locale === 'doc_id'){
|
50 |
+
continue;
|
51 |
+
}
|
52 |
+
var td = $(tr).find('td.language_' + locale);
|
53 |
+
switch(data[key][locale]['status']){
|
54 |
+
case 'current':
|
55 |
+
if(locale === data[key]['source']){
|
56 |
+
$(td).find('.lingotek-color').remove();
|
57 |
+
|
58 |
+
if(post_data['terms_translations'] === true){
|
59 |
+
var request_link = $('<a></a>').attr('href', relative_url
|
60 |
+
+ '/edit-tags.php?action=edit'
|
61 |
+
+ '&taxonomy=' + taxonomy_type
|
62 |
+
+ '&tag_ID=' + key
|
63 |
+
+ '&post_type=post')
|
64 |
+
.attr('title','Source uploaded')
|
65 |
+
.addClass('lingotek-color dashicons dashicons-yes');
|
66 |
+
}
|
67 |
+
else {
|
68 |
+
var request_link = $('<a></a>').attr('href', relative_url
|
69 |
+
+ '/post.php?post= ' + key
|
70 |
+
+ '&action=edit')
|
71 |
+
.attr('title','Source uploaded')
|
72 |
+
.addClass('lingotek-color dashicons dashicons-yes');
|
73 |
+
}
|
74 |
+
|
75 |
+
$(td).append(request_link);
|
76 |
+
}
|
77 |
+
else {
|
78 |
+
$(td).find('.lingotek-color').remove();
|
79 |
+
var request_link = $('<a></a>').attr('href', data[key][locale]['workbench_link'])
|
80 |
+
.attr('title','Current')
|
81 |
+
.attr('target','_blank')
|
82 |
+
.addClass('lingotek-color dashicons dashicons-edit');
|
83 |
+
$(td).append(request_link);
|
84 |
+
}
|
85 |
+
break;
|
86 |
+
case 'pending':
|
87 |
+
$(td).find('.lingotek-color').remove();
|
88 |
+
var request_link = $('<a></a>').attr('href', data[key][locale]['workbench_link'])
|
89 |
+
.attr('title','In Progress')
|
90 |
+
.attr('target','_blank')
|
91 |
+
.addClass('lingotek-color dashicons dashicons-clock');
|
92 |
+
$(td).append(request_link);
|
93 |
+
break;
|
94 |
+
case 'importing':
|
95 |
+
$(td).find('.lingotek-color').remove();
|
96 |
+
var request_link = $('<a></a>').attr('href', relative_url
|
97 |
+
+ page_params + 'document_id=' + data[key]['doc_id']
|
98 |
+
+ '&locale=' + locale
|
99 |
+
+ '&action=lingotek-status'
|
100 |
+
+ '&noheader=1'
|
101 |
+
+ '&_wpnonce=' + data['status_nonce'])
|
102 |
+
.attr('title','Importing source')
|
103 |
+
.addClass('lingotek-color dashicons dashicons-clock');
|
104 |
+
$(td).append(request_link);
|
105 |
+
break;
|
106 |
+
case 'not-current' :
|
107 |
+
$(td).find('.lingotek-color').remove();
|
108 |
+
var request_link = $('<a></a>').attr('href', data[key][locale]['workbench_link'])
|
109 |
+
.attr('title','The target translation is no longer current as the source content has been updated')
|
110 |
+
.attr('target','_blank')
|
111 |
+
.addClass('lingotek-color dashicons dashicons-edit');
|
112 |
+
$(td).append(request_link);
|
113 |
+
break;
|
114 |
+
case 'edited':
|
115 |
+
$(td).find('.lingotek-color').remove();
|
116 |
+
var request_link = $('<a></a>').attr('href', relative_url
|
117 |
+
+ page_params + 'post= ' + key
|
118 |
+
+ '&locale=' + locale
|
119 |
+
+ '&action=lingotek-upload'
|
120 |
+
+ '&noheader=1'
|
121 |
+
+ '&_wpnonce=' + data['upload_nonce'])
|
122 |
+
.attr('title','Upload Now')
|
123 |
+
.addClass('lingotek-color dashicons dashicons-upload');
|
124 |
+
$(td).append(request_link);
|
125 |
+
break;
|
126 |
+
case 'ready':
|
127 |
+
$(td).find('.lingotek-color').remove();
|
128 |
+
var request_link = $('<a></a>').attr('href', relative_url
|
129 |
+
+ page_params + 'document_id=' + data[key]['doc_id']
|
130 |
+
+ '&locale=' + locale
|
131 |
+
+ '&action=lingotek-download'
|
132 |
+
+ '&noheader=1'
|
133 |
+
+ '&_wpnonce='+data['download_nonce'])
|
134 |
+
.attr('title','Ready to download')
|
135 |
+
.addClass('lingotek-color dashicons dashicons-download');
|
136 |
+
$(td).append(request_link);
|
137 |
+
break;
|
138 |
+
default:
|
139 |
+
if(locale === data[key]['source']){
|
140 |
+
$(td).find('.lingotek-color').remove();
|
141 |
+
var request_link = $('<a></a>').attr('href', relative_url
|
142 |
+
+ page_params + 'post= ' + key
|
143 |
+
+ '&locale=' + locale
|
144 |
+
+ '&action=lingotek-upload'
|
145 |
+
+ '&noheader=1'
|
146 |
+
+ '&_wpnonce=' + data['upload_nonce'])
|
147 |
+
.attr('title','Upload Now')
|
148 |
+
.addClass('lingotek-color dashicons dashicons-upload');
|
149 |
+
$(td).append(request_link);
|
150 |
+
}
|
151 |
+
else if ($(td).find('.pll_icon_add').length > 0 && data[key][data[key]['source']]['status'] === 'none'){
|
152 |
+
break;
|
153 |
+
}
|
154 |
+
else if(data[key][data[key]['source']]['status'] === 'current'){
|
155 |
+
$(td).find('.pll_icon_add').remove();
|
156 |
+
$(td).find('.lingotek-color').remove();
|
157 |
+
var request_link = $('<a></a>').attr('href', relative_url
|
158 |
+
+ page_params + 'document_id=' + data[key]['doc_id']
|
159 |
+
+ '&locale='+locale+'&action=lingotek-request'
|
160 |
+
+ '&noheader=1'
|
161 |
+
+ '&_wpnonce='+data['request_nonce'])
|
162 |
+
.attr('title','Request a translation')
|
163 |
+
.addClass('lingotek-color dashicons dashicons-plus');
|
164 |
+
$(td).append(request_link);
|
165 |
+
}
|
166 |
+
else {
|
167 |
+
$(td).find('.pll_icon_add').remove();
|
168 |
+
$(td).find('.lingotek-color').remove();
|
169 |
+
var indicator = $('<div></div>').addClass('lingotek-color dashicons dashicons-no');
|
170 |
+
$(td).append(indicator);
|
171 |
+
}
|
172 |
+
break;
|
173 |
+
}
|
174 |
+
}
|
175 |
+
}
|
176 |
+
}
|
177 |
+
});
|
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.2
|
6 |
Author: Lingotek and Frédéric Demarle
|
7 |
Author uri: http://lingotek.com
|
8 |
Description: Lingotek offers convenient cloud-based localization and translation.
|
15 |
if (!function_exists('add_action'))
|
16 |
exit();
|
17 |
|
18 |
+
define('LINGOTEK_VERSION', '1.0.2'); // 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,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.2
|
7 |
-
Stable tag: 1.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -24,7 +24,7 @@ WordPress administrators use Translation Profiles to categorize content by its r
|
|
24 |
|
25 |
* __Community__ - If you're looking to save money by avoiding professional translation, you can take the do-it-yourself approach and have your bilingual employees, partners and/or users perform translations right within Wordpress. The plugin integrates with and provides use of the Lingotek Workbench, a professional-grade text editor used for translating, reviewing, and post-editing multilingual content.
|
26 |
|
27 |
-
* __Free Automatic__ - Machine translation is an excellent option if you're on a tight budget, looking for near-instant results, and are okay with less-than-perfect quality. The plugin allows you to quickly and automatically translate your site by providing use of the commercial API for Microsoft Translator (the cost is covered by Lingotek for up to 100,000
|
28 |
|
29 |
= Cloud-Based Translation Management System =
|
30 |
|
@@ -69,7 +69,42 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
|
|
69 |
|
70 |
== Frequently Asked Questions ==
|
71 |
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
== Screenshots ==
|
75 |
|
@@ -80,6 +115,10 @@ Visit the [Lingotek documentation site](https://lingotek.atlassian.net/wiki/disp
|
|
80 |
|
81 |
== Changelog ==
|
82 |
|
|
|
|
|
|
|
|
|
83 |
= 1.0.1 (2015-07-14) =
|
84 |
|
85 |
* Added pointer, updated FAQs, and minor content updates
|
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.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
24 |
|
25 |
* __Community__ - If you're looking to save money by avoiding professional translation, you can take the do-it-yourself approach and have your bilingual employees, partners and/or users perform translations right within Wordpress. The plugin integrates with and provides use of the Lingotek Workbench, a professional-grade text editor used for translating, reviewing, and post-editing multilingual content.
|
26 |
|
27 |
+
* __Free Automatic__ - Machine translation is an excellent option if you're on a tight budget, looking for near-instant results, and are okay with less-than-perfect quality. The plugin allows you to quickly and automatically translate your site by providing use of the commercial API for Microsoft Translator (the cost is covered by Lingotek for up to 100,000 characters). Machine translations can be post-edited at any time using the Lingotek Workbench.
|
28 |
|
29 |
= Cloud-Based Translation Management System =
|
30 |
|
69 |
|
70 |
== Frequently Asked Questions ==
|
71 |
|
72 |
+
= What does the Lingotek plugin do? =
|
73 |
+
|
74 |
+
Lingotek has teamed up with [Polylang](https://wordpress.org/plugins/polylang/) to offer a simple way to make your WordPress site truly multilingual. Manage all your multilingual content in the same site. No need to have a different site for each language!
|
75 |
+
|
76 |
+
= How can I add a language? =
|
77 |
+
|
78 |
+
On the *translation dashboard,* click on the *Translate my site into...* textbox and choose from the list or start typing to quickly find a language.
|
79 |
+
|
80 |
+
= How can I remove a language? =
|
81 |
+
|
82 |
+
On the *translation dashboard,* click on the blue check mark for the language you would like to remove. *Note: if you have translated content in a language you will not be able to remove that language until that content has been deleted.*
|
83 |
+
|
84 |
+
= Why can't I upload my existing content to Lingotek? =
|
85 |
+
|
86 |
+
You must assign a language to content that existed before you installed the Polylang and Lingotek plugins. You can do this manually or use the Lingotek Language Utility to set all content that doesn't have an assigned language to the default language. This will allow you to upload your existing content to Lingotek.
|
87 |
+
|
88 |
+
= Can I use my own translation agency with Lingotek? =
|
89 |
+
|
90 |
+
Use your own translation agency or tap into Lingotek's network of more than 5,000+ in-country translators. Content transfer is fully automated between WordPress and Lingotek. You'll have full visibility into the translation process every step of the way. And once the translations are completed, they'll automatically download and publish to your website according to the preferences you've set.
|
91 |
+
|
92 |
+
= How can I check the overall translation progress of my site? =
|
93 |
+
|
94 |
+
On the *translation dashboard,* the bars under *Completed Percentage* show the translation progress of content for each language. You can filter by content type or show progress for all content.
|
95 |
+
|
96 |
+
= Why are there two different shades of blue in the progress bar? =
|
97 |
+
|
98 |
+
The *translation dashboard* not only shows how much of your content is translated, but also indicates the language that your source content was authored in.
|
99 |
+
|
100 |
+
* *Dark Blue:* Indicates that this is a source language that the content was authored in.
|
101 |
+
* *Light Blue:* Indicates that this is a target language that the content was translated into.
|
102 |
+
|
103 |
+
= What happens when I Disassociate Translations? =
|
104 |
+
|
105 |
+
When content is disassociated, the connection between WordPress and Lingotek is safely removed so that translations can be solely managed inside of WordPress.
|
106 |
+
|
107 |
+
For more, visit the [Lingotek documentation site](https://lingotek.atlassian.net/wiki/display/PDOC/WordPress)
|
108 |
|
109 |
== Screenshots ==
|
110 |
|
115 |
|
116 |
== Changelog ==
|
117 |
|
118 |
+
= 1.0.2 (2015-07-16) =
|
119 |
+
|
120 |
+
* Real-time translation status updates!
|
121 |
+
|
122 |
= 1.0.1 (2015-07-14) =
|
123 |
|
124 |
* Added pointer, updated FAQs, and minor content updates
|