Changeset 1200576
- Timestamp:
- 07/16/2015 10:51:30 PM (11 years ago)
- Location:
- lingotek-translation
- Files:
-
- 84 added
- 8 edited
-
tags/1.0.1 (added)
-
tags/1.0.1/admin (added)
-
tags/1.0.1/admin/actions.php (added)
-
tags/1.0.1/admin/admin.php (added)
-
tags/1.0.1/admin/content-table.php (added)
-
tags/1.0.1/admin/filters-columns.php (added)
-
tags/1.0.1/admin/filters-media.php (added)
-
tags/1.0.1/admin/filters-post.php (added)
-
tags/1.0.1/admin/filters-term.php (added)
-
tags/1.0.1/admin/manage (added)
-
tags/1.0.1/admin/manage/view-string-groups.php (added)
-
tags/1.0.1/admin/manage/view-strings.php (added)
-
tags/1.0.1/admin/post-actions.php (added)
-
tags/1.0.1/admin/profiles-table.php (added)
-
tags/1.0.1/admin/settings (added)
-
tags/1.0.1/admin/settings.php (added)
-
tags/1.0.1/admin/settings/connect-account.php (added)
-
tags/1.0.1/admin/settings/view-account.php (added)
-
tags/1.0.1/admin/settings/view-content.php (added)
-
tags/1.0.1/admin/settings/view-defaults.php (added)
-
tags/1.0.1/admin/settings/view-edit-profile.php (added)
-
tags/1.0.1/admin/settings/view-preferences.php (added)
-
tags/1.0.1/admin/settings/view-profiles.php (added)
-
tags/1.0.1/admin/settings/view-utilities.php (added)
-
tags/1.0.1/admin/string-actions.php (added)
-
tags/1.0.1/admin/strings-table.php (added)
-
tags/1.0.1/admin/table-string.php (added)
-
tags/1.0.1/admin/term-actions.php (added)
-
tags/1.0.1/admin/tutorial (added)
-
tags/1.0.1/admin/tutorial/content.php (added)
-
tags/1.0.1/admin/tutorial/credits.php (added)
-
tags/1.0.1/admin/tutorial/faq.php (added)
-
tags/1.0.1/admin/tutorial/features.php (added)
-
tags/1.0.1/admin/tutorial/img (added)
-
tags/1.0.1/admin/tutorial/img/add-languages.png (added)
-
tags/1.0.1/admin/tutorial/img/add-page.png (added)
-
tags/1.0.1/admin/tutorial/img/add-page2.png (added)
-
tags/1.0.1/admin/tutorial/img/automatic-translation.gif (added)
-
tags/1.0.1/admin/tutorial/img/automatic-translation.png (added)
-
tags/1.0.1/admin/tutorial/img/check-status.png (added)
-
tags/1.0.1/admin/tutorial/img/content-types.png (added)
-
tags/1.0.1/admin/tutorial/img/dashboard.png (added)
-
tags/1.0.1/admin/tutorial/img/polylang-compatible.png (added)
-
tags/1.0.1/admin/tutorial/img/pro-translation.png (added)
-
tags/1.0.1/admin/tutorial/img/professional-translation.png (added)
-
tags/1.0.1/admin/tutorial/img/ready-to-upload.png (added)
-
tags/1.0.1/admin/tutorial/img/request-translations.png (added)
-
tags/1.0.1/admin/tutorial/img/translation-profiles.png (added)
-
tags/1.0.1/admin/tutorial/img/translations-downloaded.png (added)
-
tags/1.0.1/admin/tutorial/img/translations-ready-for-download.png (added)
-
tags/1.0.1/admin/tutorial/img/translations-underway.png (added)
-
tags/1.0.1/admin/tutorial/img/workbench-full.png (added)
-
tags/1.0.1/admin/tutorial/img/workbench.png (added)
-
tags/1.0.1/admin/utilities.php (added)
-
tags/1.0.1/admin/view-dashboard.php (added)
-
tags/1.0.1/admin/view-manage.php (added)
-
tags/1.0.1/admin/view-network.php (added)
-
tags/1.0.1/admin/view-tutorial.php (added)
-
tags/1.0.1/css (added)
-
tags/1.0.1/css/admin.css (added)
-
tags/1.0.1/img (added)
-
tags/1.0.1/img/lingotek-chevrons-blue.png (added)
-
tags/1.0.1/img/lingotek-icon.png (added)
-
tags/1.0.1/img/lingotek-white.png (added)
-
tags/1.0.1/include (added)
-
tags/1.0.1/include/api.php (added)
-
tags/1.0.1/include/callback.php (added)
-
tags/1.0.1/include/dashboard.php (added)
-
tags/1.0.1/include/group-post.php (added)
-
tags/1.0.1/include/group-string.php (added)
-
tags/1.0.1/include/group-term.php (added)
-
tags/1.0.1/include/group.php (added)
-
tags/1.0.1/include/http.php (added)
-
tags/1.0.1/include/model.php (added)
-
tags/1.0.1/include/pointer.php (added)
-
tags/1.0.1/js (added)
-
tags/1.0.1/js/defaults.js (added)
-
tags/1.0.1/js/progress.js (added)
-
tags/1.0.1/languages (added)
-
tags/1.0.1/languages/wp-lingotek-fr_FR.mo (added)
-
tags/1.0.1/languages/wp-lingotek-fr_FR.po (added)
-
tags/1.0.1/lingotek.php (added)
-
tags/1.0.1/readme.txt (added)
-
tags/1.0.1/uninstall.php (added)
-
trunk/admin/actions.php (modified) (1 diff)
-
trunk/admin/admin.php (modified) (4 diffs)
-
trunk/admin/filters-columns.php (modified) (5 diffs)
-
trunk/admin/manage/view-string-groups.php (modified) (2 diffs)
-
trunk/admin/post-actions.php (modified) (1 diff)
-
trunk/admin/tutorial/faq.php (modified) (2 diffs)
-
trunk/js/progress.js (modified) (1 diff)
-
trunk/readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lingotek-translation/trunk/admin/actions.php
r1200571 r1200576 87 87 88 88 'current' => array( 89 'title' => __(' Current', 'wp-lingotek'),89 'title' => __('current', 'wp-lingotek'), 90 90 'icon' => 'edit' 91 91 ), -
lingotek-translation/trunk/admin/admin.php
r1200571 r1200576 9 9 */ 10 10 public function __construct() { 11 11 12 $plugin = Lingotek::get_instance(); 12 13 $this->plugin_slug = $plugin->get_plugin_slug(); … … 26 27 add_filter('set-screen-option', array($this, 'set_screen_option'), 10, 3); 27 28 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')); 29 add_action('wp_ajax_'.$this->ajax_dashboard_language_endpoint, array(&$this->dashboard, 'ajax_language_dashboard')); 30 30 31 //Network admin menu 31 32 add_action('network_admin_menu', array($this, 'add_network_admin_menu')); 32 33 } 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 values44 $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 of54 //ids and nonces. Each id has a source language, languages with statuses, and a workbench link55 $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 Wordpress74 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 actions82 $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 34 107 35 public function get_dashboard_endpoint(){ … … 128 56 $scripts = array( 129 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), 130 'updater' => array(array('edit', 'upload', 'edit-tags'), array('jquery-ui-progressbar', 'jquery-ui-dialog', 'wp-ajax-response'), 1),131 58 ); 132 59 … … 483 410 */ 484 411 public function set_screen_option($status, $option, $value) { 485 if ('lingotek_strings_per_page' == $option) {412 if ('lingotek_strings_per_page' == $option) 486 413 return $value; 487 }488 414 return $status; 489 415 } -
lingotek-translation/trunk/admin/filters-columns.php
r1200571 r1200576 44 44 45 45 foreach ($this->model->get_languages_list() as $language) { 46 $columns['language_'.$language-> locale] = $language->flag ? $language->flag :46 $columns['language_'.$language->slug] = $language->flag ? $language->flag : 47 47 sprintf('<a href="" title="%s">%s</a>', 48 48 esc_html("$language->name ($language->locale)"), … … 71 71 call_user_func(array($this->model, 'get_' . $type . '_language'), $object_id); 72 72 73 if (false === strpos($column, 'language_') || !$lang) {73 if (false === strpos($column, 'language_') || !$lang) 74 74 return ''; 75 }76 75 77 76 $language = $this->model->get_language(substr($column, 9)); … … 80 79 // yes for uploaded posts, but I will need js as the field is built for all posts 81 80 // /!\ also take care not add this field two times when translations are managed by Polylang 81 82 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)*/) {83 if ($column == $this->get_first_language_column() /*&& !$this->model->get_translation_id('post', $post_id)*/) 84 84 printf('<div class="hidden" id="lang_%d">%s</div>', esc_attr($object_id), esc_html($lang->slug)); 85 }86 85 87 86 $id = ($inline && $lang->slug != $this->model->get_language($_POST['old_lang'])->slug) ? … … 98 97 99 98 // post ready for upload 100 if ($this->lgtm->can_upload($type, $object_id) && $object_id == $id) {99 if ($this->lgtm->can_upload($type, $object_id) && $object_id == $id) 101 100 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 } 101 ('post' == $type ? parent::post_column($column, $object_id) : parent::term_column('', $column, $object_id)) : 102 $actions->upload_icon($object_id); 106 103 107 104 // translation disabled 108 elseif (isset($document->source) && $document->is_disabled_target($language)) {105 elseif (isset($document->source) && $document->is_disabled_target($language)) 109 106 return 'post' == $type ? parent::post_column($column, $object_id) : parent::term_column('', $column, $object_id); 110 }111 107 112 108 // source post is uploaded 113 109 elseif (isset($document->source) && $document->source == $id) { 114 110 // source ready for upload 115 if ($this->lgtm->can_upload($type, $id)) {111 if ($this->lgtm->can_upload($type, $id)) 116 112 return $actions->upload_icon($id); 117 }118 113 119 114 // importing source 120 if ($id == $object_id && 'importing' == $document->status) {115 if ($id == $object_id && 'importing' == $document->status) 121 116 return Lingotek_Actions::importing_icon($document); 122 }123 117 124 118 // uploaded … … 127 121 128 122 // translations 129 elseif (isset($document->translations[$language->locale]) || (isset($document->source) && 'current' == $document->status)) {123 elseif (isset($document->translations[$language->locale]) || (isset($document->source) && 'current' == $document->status)) 130 124 return Lingotek_Actions::translation_icon($document, $language); 131 }132 125 133 126 // 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 } 127 elseif (empty($document->source)) 128 return $object_id == $id && !$disabled ? 129 $actions->upload_icon($object_id, true) : 130 ('post' == $type ? parent::post_column($column, $object_id) : parent::term_column('', $column, $object_id)); 139 131 140 132 // no translation 141 else {133 else 142 134 return '<div class="lingotek-color dashicons dashicons-no"></div>'; 143 }144 135 } 145 136 -
lingotek-translation/trunk/admin/manage/view-string-groups.php
r1200571 r1200576 17 17 $table = new Lingotek_Strings_Table($string_actions); 18 18 $action = $table->current_action(); 19 if (!empty($action)) {19 if (!empty($action)) 20 20 $string_actions->manage_actions($action); 21 }22 21 23 22 $data = Lingotek_Model::get_strings(); 24 foreach ($data as $key => $row) {23 foreach ($data as $key => $row) 25 24 $data[$key]['row'] = $key; // store the row number for convenience 26 }27 25 28 26 $table->prepare_items($data); ?> … … 33 31 34 32 foreach (Lingotek_String_actions::$actions as $action => $strings) { 35 if (!empty($_GET['bulk-lingotek-' . $action])) {33 if (!empty($_GET['bulk-lingotek-' . $action])) 36 34 printf('<div id="lingotek-progressdialog" title="%s"><div id="lingotek-progressbar"></div></div>', $strings['progress']); 37 }38 35 } 39 36 } -
lingotek-translation/trunk/admin/post-actions.php
r1200571 r1200576 95 95 public function manage_actions() { 96 96 global $typenow; 97 printf('<div id="auto-update" class="hidden"></div>');98 97 $post_type = 'load-upload.php' == current_filter() ? 'attachment' : $typenow; 99 98 -
lingotek-translation/trunk/admin/tutorial/faq.php
r1199446 r1200576 26 26 27 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 exis ting content to Lingotek.", 'wp-lingotek'), 'admin.php?page=wp-lingotek_settings&sm=utilities'); ?></p>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 exisiting content to Lingotek.", 'wp-lingotek'), 'admin.php?page=wp-lingotek_settings&sm=utilities'); ?></p> 29 29 30 30 <b><?php _e("Can I use my own translation agency with Lingotek?", 'wp-lingotek') ?></b> … … 45 45 46 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 removedso that translations can be solely managed inside of WordPress.', 'wp-lingotek') ?></p>47 <p><?php _e('When content is disassociated the connection between WordPress and <i>Lingotek</i> safely disconnected from Lingotek, so that translations can be solely managed inside of WordPress.', 'wp-lingotek') ?></p> 48 48 49 49 <b><?php _e("How do I translate strings within widgets or general WordPress settings (e.g., Site Title, Tagline)?", 'wp-lingotek') ?></b> -
lingotek-translation/trunk/js/progress.js
r1200571 r1200576 1 1 jQuery(document).ready(function($) { 2 2 3 function lingotek_progress(i) { 3 4 if (i < lingotek_data.ids.length) { -
lingotek-translation/trunk/readme.txt
r1200571 r1200576 5 5 Requires at least: 3.8 6 6 Tested up to: 4.2 7 Stable tag: 1.0. 27 Stable tag: 1.0.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 25 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 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.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 words). Machine translations can be post-edited at any time using the Lingotek Workbench. 28 28 29 29 = Cloud-Based Translation Management System = … … 70 70 == Frequently Asked Questions == 71 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) 72 Visit the [Lingotek documentation site](https://lingotek.atlassian.net/wiki/display/PDOC/WordPress) 108 73 109 74 == Screenshots == … … 115 80 116 81 == Changelog == 117 118 = 1.0.2 (2015-07-16) =119 120 * Real-time translation status updates!121 82 122 83 = 1.0.1 (2015-07-14) =
Note: See TracChangeset
for help on using the changeset viewer.