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_admin.php

    r364 r386  
    8686        logger($_POST['languages']); 
    8787        foreach($_POST['languages'] as $code => $lang) { 
    88         list ($langcode, $viewable, $translateable) = explode(",",$lang); 
     88            list ($langcode, $viewable, $translateable) = explode(",",$lang); 
    8989            $sorted_langs[$langcode] = $langcode; 
    9090            if($viewable) { 
     
    162162        wp_enqueue_script('jquery-ui-droppable'); 
    163163        wp_enqueue_script("transposh_control",$this->transposh->transposh_plugin_url."/js/transposhcontrol.js",array(),TRANSPOSH_PLUGIN_VER, true); 
     164        wp_localize_script("transposh_control","t_jp",array( 
     165                'post_url' => $this->transposh->post_url/*, 
     166                    'plugin_url' => $this->transposh_plugin_url, 
     167                    'edit' => ($this->edit_mode? '1' : ''), 
     168                    //'rtl' => (in_array ($this->target_language, $GLOBALS['rtl_languages'])? 'true' : ''), 
     169                    'lang' => $this->target_language, 
     170                    // those two options show if the script can support said engines 
     171                    'msn' => (in_array($this->target_language,$GLOBALS['bing_languages']) && $this->options->get_msn_key()  ? '1' : ''), 
     172                    'google' => (in_array($this->target_language,$GLOBALS['google_languages']) ? '1' : ''), 
     173                    'prefix' => SPAN_PREFIX, 
     174                    'msnkey'=>$this->options->get_msn_key(), 
     175                    'preferred'=> $this->options->get_preferred_translator(), 
     176                    'progress'=>$this->edit_mode || $this->options->get_widget_progressbar() ? '1' : '')*/ 
     177//                      'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};' 
     178        )); 
     179        wp_enqueue_script("google","http://www.google.com/jsapi",array(),'1',true); 
     180        wp_enqueue_script("transposh_admin",$this->transposh->transposh_plugin_url."/js/transposhadmin.js",array(),TRANSPOSH_PLUGIN_VER, true); 
     181        wp_enqueue_style("jquery","http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-lightness/jquery-ui.css",array(),'1.0'); 
     182        wp_enqueue_script("jqueryui","http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js",array("jquery"),'1.7.2',true); 
     183 
    164184 
    165185        //add several metaboxes now, all metaboxes registered during load page can be switched off/on at "Screen Options" automatically, nothing special to do therefore 
     
    168188        add_meta_box('transposh-sidebox-news', 'Plugin news', array(&$this, 'on_sidebox_news_content'), $this->pagehook, 'side', 'core'); 
    169189        add_meta_box('transposh-sidebox-stats', 'Plugin stats', array(&$this, 'on_sidebox_stats_content'), $this->pagehook, 'side', 'core'); 
     190        add_meta_box('transposh-sidebox-translate', 'Translate all', array(&$this, 'on_sidebox_translate_content'), $this->pagehook, 'side', 'core'); 
    170191        add_meta_box('transposh-contentbox-languages', 'Supported languages', array(&$this, 'on_contentbox_languages_content'), $this->pagehook, 'normal', 'core'); 
    171192        add_meta_box('transposh-contentbox-translation', 'Translation settings', array(&$this, 'on_contentbox_translation_content'), $this->pagehook, 'normal', 'core'); 
     
    302323    function on_sidebox_stats_content($data) { 
    303324        $this->transposh->database->db_stats(); 
     325    } 
     326 
     327    function on_sidebox_translate_content($data) { 
     328        echo '<div id="progress_bar_all"></div><div id="tr_translate_title"></div>'; 
     329        echo '<div id="tr_loading" style="margin: 0 0 10px 0">Translate by clicking the button below</div>'; 
     330        echo '<a id="transposh-translate" href="'.$this->transposh->post_url.'?translate_all&offset=1" onclick="return false;" class="button">Translate All Now</a><br/>'; 
     331        //get_posts 
    304332    } 
    305333 
     
    359387                .display_flag("{$this->transposh->transposh_plugin_url}/img/flags", $flag, $langorigname,$this->transposh->options->get_widget_css_flags()) 
    360388                .'<input type="hidden" name="languages[]" value="'. $this->transposh->options->get_default_language() .'" />' 
    361                       .'&nbsp;<span class="langname">'.$langorigname.'</span><span class="langname hidden">'.$langname.'</span></li>'; 
     389                .'&nbsp;<span class="langname">'.$langorigname.'</span><span class="langname hidden">'.$langname.'</span></li>'; 
    362390        echo '</ul></div>'; 
    363391        // list of languages 
     
    428456    } 
    429457 
    430         function on_contentbox_auto_translation_content($data) { 
     458    function on_contentbox_auto_translation_content($data) { 
    431459 
    432460        /* 
     
    498526                'This will redirect the first page accessed in the session to the same page with the detected language.'; 
    499527 
    500        /* WIP2 
     528        /* WIP2 
    501529        echo '<a href="http://transposh.org/services/index.php?flags='.$flags.'">Gen sprites</a>';*/ 
    502530    } 
    503531 
    504532    function on_contentbox_community_content($data) { 
     533   /*     echo '<a tabindex="4" id="transposh-backup" href="/wp-admin/post-new.php?preview=true" class="button">Do Backup Now</a><br/>'; 
     534        //  echo "<p id=\"backup\">Do backup.</p>"; 
     535        echo 'Service Key: <input type="text" size="32" class="regular-text" value="'.$this->transposh->options->get_transposh_key().'" id="'.TRANSPOSH_KEY.'" name="'.TRANSPOSH_KEY.'"/>'; 
     536        echo ' 
     537<script type="text/javascript"> 
     538    //<![CDATA[ 
     539    jQuery(document).ready( function($) { 
     540        // close postboxes that should be closed 
     541        $("#backup").click(function () { 
     542        $.get("'.$this->transposh->post_url.'?backup=" + Math.random()); 
     543        //alert ("hi"); 
     544        }); 
     545    }); 
     546    //]]> 
     547</script>';*/ 
    505548        echo "<p>This space is reserved for the coming community features of Transposh that will help you find translators to help with your site.</p>"; 
    506549    } 
Note: See TracChangeset for help on using the changeset viewer.