Changeset 770
- Timestamp:
- 01/22/2013 03:00:08 AM (4 months ago)
- Location:
- trunk/WordPress/plugin/transposh
- Files:
-
- 1 added
- 6 edited
-
js/admin/contexthelp.js (added)
-
js/admin/languages.js (modified) (1 diff)
-
js/admin/utils.js (modified) (1 diff)
-
js/transposh.js (modified) (2 diffs)
-
transposh.php (modified) (2 diffs)
-
wp/transposh_admin.php (modified) (8 diffs)
-
wp/transposh_options.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WordPress/plugin/transposh/js/admin/languages.js
r753 r770 1 /* Copyright © 2009-201 0Transposh Team (website : http://transposh.org)1 /* Copyright © 2009-2013 Transposh Team (website : http://transposh.org) 2 2 * 3 3 * This program is free software; you can redistribute it and/or modify -
trunk/WordPress/plugin/transposh/js/admin/utils.js
r755 r770 1 /*2 * To change this template, choose Tools | Templates3 * and open the template in the editor.4 */5 6 7 1 (function ($) { // closure 8 2 $(function() { -
trunk/WordPress/plugin/transposh/js/transposh.js
r750 r770 33 33 loadingmsn = 0 34 34 ; 35 36 // set base uri for jQueryUI37 t_jp.jQueryUI = 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/';38 35 39 36 // This function fixes the page, it gets a token and translation and fixes this, … … 348 345 349 346 $(function () { 350 // set a global binglang (if needed) 351 if (t_jp.msn) { 352 t_jp.binglang = t_jp.lang; 353 if (t_jp.binglang === 'zh') { 354 t_jp.binglang = 'zh-chs'; 355 } else if (t_jp.binglang === 'zh-tw') { 356 t_jp.binglang = 'zh-cht'; 357 } else if (t_jp.binglang === 'mw') { 358 t_jp.binglang = 'mww'; 359 } 360 } 361 362 // this is the set_default_language function 363 // attach a function to the set_default_language link if its there 364 $('.' + t_jp_prefix + 'setdeflang').click(function () { 365 $.ajax({ 366 url: t_jp.ajaxurl, 367 data: { 368 action: 'tp_cookie' 369 }, 370 cache: false 371 } ); 372 $('.' + t_jp_prefix + 'setdeflang').hide("slow"); 373 return false; 374 }); 375 376 // how many phrases are yet untranslated 377 possibly_translateable = $("." + t_jp_prefix + '[data-source=""]').size(); 378 379 //now = new Date(); 380 // we make sure script sub loaded are cached 381 $.ajaxSetup({ 382 cache: true 383 }); 384 // was: we'll only auto-translate and load the stuff if we either have more than 5 candidate translations, or more than one at 4am, and this language is supported... 385 // we'll translate if there's any candidate...? 386 if // ((possibly_translateable > 5 || (now.getHours() === 4 && possibly_translateable > 0)) && 387 (possibly_translateable && !t_jp.noauto && (t_jp.google || t_jp.msn || t_jp.apertium)) { 388 // if we have a progress bar, we need to load the jqueryui before the auto translate, after the google was loaded, otherwise we can just go ahead 389 if (t_jp.progress) { 390 test_for_jqueryui(function () { 391 create_progress_bar(); 392 do_auto_translate(); 393 }); 394 } else { 347 // set a global binglang (if needed) 348 if (t_jp.msn) { 349 t_jp.binglang = t_jp.lang; 350 if (t_jp.binglang === 'zh') { 351 t_jp.binglang = 'zh-chs'; 352 } else if (t_jp.binglang === 'zh-tw') { 353 t_jp.binglang = 'zh-cht'; 354 } else if (t_jp.binglang === 'mw') { 355 t_jp.binglang = 'mww'; 356 } 357 } 358 359 // this is the set_default_language function 360 // attach a function to the set_default_language link if its there 361 $('.' + t_jp_prefix + 'setdeflang').click(function () { 362 $.ajax({ 363 url: t_jp.ajaxurl, 364 data: { 365 action: 'tp_cookie' 366 }, 367 cache: false 368 } ); 369 $('.' + t_jp_prefix + 'setdeflang').hide("slow"); 370 return false; 371 }); 372 373 // how many phrases are yet untranslated 374 possibly_translateable = $("." + t_jp_prefix + '[data-source=""]').size(); 375 376 //now = new Date(); 377 // we make sure script sub loaded are cached 378 $.ajaxSetup({ 379 cache: true 380 }); 381 // was: we'll only auto-translate and load the stuff if we either have more than 5 candidate translations, or more than one at 4am, and this language is supported... 382 // we'll translate if there's any candidate...? 383 if // ((possibly_translateable > 5 || (now.getHours() === 4 && possibly_translateable > 0)) && 384 (possibly_translateable && !t_jp.noauto && (t_jp.google || t_jp.msn || t_jp.apertium)) { 385 // if we have a progress bar, we need to load the jqueryui before the auto translate, after the google was loaded, otherwise we can just go ahead 386 if (t_jp.progress) { 387 test_for_jqueryui(function () { 388 create_progress_bar(); 395 389 do_auto_translate(); 396 } 397 } 398 399 // this is the part when we have editor support 400 if (t_jp.edit) { 401 $.getScript(t_jp.plugin_url + '/js/transposhedit.js'); 402 } 403 }); 390 }); 391 } else { 392 do_auto_translate(); 393 } 394 } 395 396 // this is the part when we have editor support 397 if (t_jp.edit) { 398 $.getScript(t_jp.plugin_url + '/js/transposhedit.js'); 399 } 400 }); 404 401 }(jQuery)); // end of closure -
trunk/WordPress/plugin/transposh/transposh.php
r768 r770 148 148 tp_logger(preg_replace('|^' . preg_quote(WP_PLUGIN_DIR, '|') . '/|', '', __FILE__), 4); // includes transposh dir and php 149 149 150 150 151 // TODO: get_class_methods to replace said mess, other way? 151 152 add_filter('plugin_action_links_' . preg_replace('|^' . preg_quote(WP_PLUGIN_DIR, '|') . '/|', '', __FILE__), array(&$this, 'plugin_action_links')); … … 769 770 if ($this->options->widget_progressbar || $this->edit_mode) { 770 771 $script_params['theme'] = $this->options->widget_theme; 772 if ($this->options->jqueryui_override) { 773 $script_params['jQueryUI'] = 'http://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->options->jqueryui_override . '/'; 774 } else { 775 $script_params['jQueryUI'] = 'http://ajax.googleapis.com/ajax/libs/jqueryui/' . JQUERYUI_VER . '/'; 776 } 771 777 } 772 778 -
trunk/WordPress/plugin/transposh/wp/transposh_admin.php
r766 r770 150 150 case "tp_advanced": 151 151 $this->transposh->options->enable_url_translate = TP_FROM_POST; 152 $this->transposh->options->jqueryui_override = TP_FROM_POST; 152 153 $this->transposh->options->parser_dont_break_puncts = TP_FROM_POST; 153 154 $this->transposh->options->parser_dont_break_numbers = TP_FROM_POST; … … 260 261 wp_localize_script("transposh_backend", "t_be", $script_params); 261 262 } 263 wp_enqueue_script('transposh_context_help', $this->transposh->transposh_plugin_url . '/' . TRANSPOSH_DIR_JS . '/admin/contexthelp.js', array('jquery'), TRANSPOSH_PLUGIN_VER, true); 262 264 wp_enqueue_style('transposh_admin', $this->transposh->transposh_plugin_url . '/' . TRANSPOSH_DIR_CSS . '/admin.css'); ///, array('transposh'), TRANSPOSH_PLUGIN_VER, true) 263 265 } … … 279 281 // retrieve the function output and set it as tab content 280 282 'content' => $this->on_contextual_help())); 283 $screen->add_help_tab(array( 284 'id' => 'keys', // This should be unique for the screen. 285 'title' => __('Engine keys', TRANSPOSH_TEXT_DOMAIN), 286 // retrieve the function output and set it as tab content 287 'content' => __('Will write something about keys...', TRANSPOSH_TEXT_DOMAIN))); 281 288 if ($this->page == 'tp_main') { 282 289 add_screen_option('layout_columns', array('max' => 4, 'default' => 2)); … … 464 471 $this->textinput($this->transposh->options->msn_key_o 465 472 , array('bingicon.png', __('MSN API key', TRANSPOSH_TEXT_DOMAIN)) 466 , __('API Key', TRANSPOSH_TEXT_DOMAIN) );473 , __('API Key', TRANSPOSH_TEXT_DOMAIN), 35, 'keys'); 467 474 $this->textinput($this->transposh->options->google_key_o 468 475 , array('googleicon.png', __('Google API key', TRANSPOSH_TEXT_DOMAIN)) … … 517 524 function tp_advanced() { 518 525 $this->checkbox($this->transposh->options->enable_url_translate_o, __('Enable url translation', TRANSPOSH_TEXT_DOMAIN) . ' (' . __('experimental', TRANSPOSH_TEXT_DOMAIN) . ')', __('Allow translation of permalinks and urls', TRANSPOSH_TEXT_DOMAIN)); 519 526 $this->textinput($this->transposh->options->jqueryui_override_o, __('Override jQueryUI version', TRANSPOSH_TEXT_DOMAIN), __('Version', TRANSPOSH_TEXT_DOMAIN)); 520 527 $this->section(__('Parser related settings', TRANSPOSH_TEXT_DOMAIN) 521 528 , __('This is extremely dangerous, will break your current translations, and might cause severe hickups, only proceed if you really know what you are doing.', TRANSPOSH_TEXT_DOMAIN)); … … 586 593 587 594 $this->sectionstop(); 595 /* 596 require_once("pomo_upgrader.php"); 597 598 $upgrader = new POMO_Upgrader(); 599 $upgrader->run(array('package' => 'http://svn.automattic.com/wordpress-i18n/he_IL/tags/3.5/messages/he_IL.mo', 600 'destination' => '/tmp/', //WP_PLUGIN_DIR . '/themes', 601 'clear_destination' => false, //Do not overwrite files. 602 'clear_working' => false));*/ 588 603 } 589 604 … … 686 701 } 687 702 688 private function header($head ) {703 private function header($head, $help='') { 689 704 if (!isset($head)) return; 705 if ($help) { 706 $help = ' <a class="tp_help" href="#" rel="'.$help.'">[?]</a>'; 707 } 690 708 if (is_array($head)) { 691 echo "<h3><img width=\"16\" height=\"16\" src=\"{$this->transposh->transposh_plugin_url}/img/{$head[0]}\"> {$head[1]} </h3>";709 echo "<h3><img width=\"16\" height=\"16\" src=\"{$this->transposh->transposh_plugin_url}/img/{$head[0]}\"> {$head[1]}$help</h3>"; 692 710 } else { 693 echo '<h3>' . $head . '</h3>';711 echo "<h3> $head $help</h3>"; 694 712 } 695 713 } … … 724 742 } 725 743 726 private function textinput($tpo, $head, $label, $length = 35 ) {727 $this->header($head );744 private function textinput($tpo, $head, $label, $length = 35, $help='') { 745 $this->header($head, $help); 728 746 echo $label . ': <input type="text" size="' . $length . '" class="regular-text" ' . $tpo->post_value_id_name() . '/>'; 729 747 } -
trunk/WordPress/plugin/transposh/wp/transposh_options.php
r759 r770 135 135 * @property boolean $enable_url_translate Option to enable/disable url translation @since 0.5.3 136 136 * @property transposh_option $enable_url_translate_o 137 * @property string $jqueryui_override Option to override the jQueryUI version @since 0.9.1 138 * @property transposh_option $jqueryui_override_o 137 139 * @property boolean $parser_dont_break_puncts Option to allow punctuations such as , . ( not to break @since 0.9.0 138 140 * @property transposh_option $parser_dont_break_puncts_o … … 244 246 245 247 $this->register_option('enable_url_translate', TP_OPT_BOOLEAN, 0); 248 $this->register_option('jqueryui_override', TP_OPT_STRING); 246 249 $this->register_option('parser_dont_break_puncts', TP_OPT_BOOLEAN, 0); 247 250 $this->register_option('parser_dont_break_numbers', TP_OPT_BOOLEAN, 0);
Note: See TracChangeset
for help on using the changeset viewer.
