Ignore:
Timestamp:
03/04/2010 02:12:58 AM (2 years ago)
Author:
ofer
Message:

Mass translation support for #80

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/WordPress/plugin/transposh/wp/transposh_postpublish.php

    r346 r386  
    1616 *      Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
    1717 * 
    18  */ 
     18*/ 
    1919 
    2020/* 
    2121 * Provides the side widget in the page/edit pages which will do translations 
    22  */ 
     22*/ 
    2323 
    2424/** 
     
    4040        if ($this->transposh->options->get_enable_auto_post_translate()) { 
    4141            add_action('edit_post',array(&$this, 'on_edit')); 
    42            // add_action('publish_post',array(&$this, 'on_publish')); 
     42            // add_action('publish_post',array(&$this, 'on_publish')); 
    4343            add_action('admin_menu', array(&$this, 'on_admin_menu')); 
    4444        } 
     
    5555        if ($_GET['justedited']) { 
    5656            wp_enqueue_script("google","http://www.google.com/jsapi",array(),'1',true); 
    57             wp_enqueue_script("transposh","{$this->transposh->transposh_plugin_url}/js/transposhadmin.js?post_url={$this->transposh->post_url}&post={$_GET['post']}",array("jquery"),TRANSPOSH_PLUGIN_VER,true); 
     57            wp_enqueue_script("transposh","{$this->transposh->transposh_plugin_url}/js/transposhadmin.js",array("jquery"),TRANSPOSH_PLUGIN_VER,true); 
     58            wp_localize_script("transposh","t_jp",array( 
     59                    'post_url' => $this->transposh->post_url, 
     60                    'post' => $_GET['post'], 
     61                    'msnkey'=>$this->transposh->options->get_msn_key(), 
     62                    'msn_langs' => json_encode($GLOBALS['bing_languages']), 
     63                    'google_lang' => json_encode($GLOBALS['google_languages']), 
     64                    'preferred'=> $this->transposh->options->get_preferred_translator()/*, 
     65                    'plugin_url' => $this->transposh_plugin_url, 
     66                    'edit' => ($this->edit_mode? '1' : ''), 
     67                    //'rtl' => (in_array ($this->target_language, $GLOBALS['rtl_languages'])? 'true' : ''), 
     68                    'lang' => $this->target_language, 
     69                    // those two options show if the script can support said engines 
     70                    'prefix' => SPAN_PREFIX, 
     71 
     72                    'progress'=>$this->edit_mode || $this->options->get_widget_progressbar() ? '1' : '')*/ 
     73//                      'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};' 
     74            )); 
    5875            wp_enqueue_style("jquery","http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-lightness/jquery-ui.css",array(),'1.0'); 
    5976            wp_enqueue_script("jqueryui","http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js",array("jquery"),'1.7.2',true); 
     77     /*       if ($this->transposh->options->get_enable_msn_translate() && $this->transposh->options->get_msn_key()) { 
     78                wp_enqueue_script("mstranslate","http://api.microsofttranslator.com/V1/Ajax.svc/Embed?appId=".$this->transposh->options->get_msn_key(),array(),'1',true); 
     79            }*/ 
    6080        } 
    6181    } 
     
    7595        // TODO - grab phrases from rss excerpt 
    7696        //$output = get_the_excerpt(); 
    77         // echo apply_filters('the_excerpt_rss', $output); 
    78  
     97        // echo apply_filters('the_excerpt_rss', $output); 
     98        //TODO - get comments text 
     99         
    79100        $parser = new parser(); 
    80101        $phrases = $parser->get_phrases_list($content); 
     
    106127        } 
    107128 
     129        // add the title 
     130//        if ($json['length']) 
     131            $json['posttitle'] = $title; 
     132         
    108133        // the header helps with debugging 
    109134        header("Content-type: text/javascript"); 
Note: See TracChangeset for help on using the changeset viewer.