Changeset 167
- Timestamp:
- 04/30/2009 03:59:54 PM (3 years ago)
- Location:
- trunk/WordPress/plugin/transposh
- Files:
-
- 9 edited
-
build.sh (modified) (1 diff)
-
core/constants.php (modified) (2 diffs)
-
core/globals.php (modified) (1 diff)
-
core/parser.php (modified) (2 diffs)
-
js/transposh.js (modified) (14 diffs)
-
readme.txt (modified) (2 diffs)
-
transposh.php (modified) (1 diff)
-
transposh_admin.php (modified) (3 diffs)
-
transposh_widget.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WordPress/plugin/transposh/build.sh
r148 r167 83 83 fi 84 84 85 echo "Minify .js files" 86 for file in `find . -maxdepth 2 -iname '*.js'`; do 87 echo "minifying $file" 88 java -jar /root/yui/yuicompressor-2.4.2/build/yuicompressor-2.4.2.jar $file > $TRANSPOSH_DIR/$file 89 done; 90 85 91 # Remove .svn dirs 86 92 find $TRANSPOSH_DIR -name "*.svn*" -exec rm -rf {} 2>/dev/null \; -
trunk/WordPress/plugin/transposh/core/constants.php
r125 r167 30 30 31 31 //Supported languages, new languages can be added here 32 //the array directs from language code to - Native name, flag 33 $languages = array("en" => "English,us", 34 "sq" => "Shqip,al", 35 "ar" => "Ø§ÙØ¹Ø±ØšÙØ©,sa", 36 "bg" => "ÐÑлгаÑÑкО,bg", 37 "ca" => "Català ,catalonia", 38 "zh" => "äžæ(ç®äœ),cn", 39 "zh-tw" => "äžæ(挢å),tw", 40 "hr" => "Hrvatski,hr", 41 "cs" => "ÄeÅ¡tina,cz", 42 "da" => "dansk,dk", 43 "nl" => "Nederlands,nl", 44 "et" => "Eesti keel,ee", 45 "fi" => "Suomi,fi", 46 "fr" => "Français,fr", 47 "gl" => "Galego,galicia", 48 "de" => "Deutsch,de", 49 "el" => "ÎλληΜικά,gr", 50 "he" => "×¢×ך×ת,il", 51 "hi" => "à€¹à€¿à€šà¥à€Šà¥; à€¹à€¿à€à€Šà¥,in", 52 "hu" => "magyar,hu", 53 "id" => "Bahasa Indonesia,id", 54 "it" => "Italiano,it", 55 "ja" => "æ¥æ¬èª (ã«ã»ããïŒã«ã£ãœãã),jp", 56 "ko" => "ì°ëЬë§,kr", 57 "lv" => "latvieÅ¡u valoda,lv", 58 "lt" => "lietuvių kalba,lt", 59 "mt" => "Malti,mt", 60 "no" => "Norsk,no", 61 "pl" => "Polski,pl", 62 "pt" => "Português,pt", 63 "ro" => "RomânÄ,ro", 64 "ru" => "Ð ÑÑÑкОй,ru", 65 "sr" => "ÑÑпÑкО ÑезОк,rs", 66 "sk" => "slovenÄina,sk", 67 "sl" => "slovenÅ¡Äina,sl", 68 "es" => "Español,es", 69 "sv" => "svenska,se", 70 "tl" => "Tagalog,ph", 71 "th" => "àž àž²àž©àž²à¹àžàž¢,th", 72 "tr" => "TÃŒrkçe,tr", 73 "uk" => "УкÑаÑМÑÑка,ua", 74 "vi" => "Tiếng Viá»t,vn"); 32 //the array directs from language code to - Native name, flag, auto-translatable 33 $languages = array("en" => "English,us,1", 34 "sq" => "Shqip,al,1", 35 "ar" => "Ø§ÙØ¹Ø±ØšÙØ©,sa,1", 36 "bg" => "ÐÑлгаÑÑкО,bg,1", 37 "ca" => "Català ,catalonia,1", 38 "zh" => "äžæ(ç®äœ),cn,1", 39 "zh-tw" => "äžæ(挢å),tw,1", 40 "hr" => "Hrvatski,hr,1", 41 "cs" => "ÄeÅ¡tina,cz,1", 42 "da" => "dansk,dk,1", 43 "nl" => "Nederlands,nl,1", 44 "et" => "Eesti keel,ee,1", 45 "fi" => "Suomi,fi,1", 46 "fr" => "Français,fr,1", 47 "gl" => "Galego,galicia,1", 48 "de" => "Deutsch,de,1", 49 "el" => "ÎλληΜικά,gr,1", 50 "he" => "×¢×ך×ת,il,1", 51 "hi" => "à€¹à€¿à€šà¥à€Šà¥; à€¹à€¿à€à€Šà¥,in,1", 52 "hu" => "magyar,hu,1", 53 "id" => "Bahasa Indonesia,id,1", 54 "it" => "Italiano,it,1", 55 "is" => "Ãslenska,is,0", 56 "ja" => "æ¥æ¬èª (ã«ã»ããïŒã«ã£ãœãã),jp,1", 57 "ko" => "ì°ëЬë§,kr,1", 58 "lv" => "latvieÅ¡u valoda,lv,1", 59 "lt" => "lietuvių kalba,lt,1", 60 "mt" => "Malti,mt,1", 61 "no" => "Norsk,no,1", 62 "pl" => "Polski,pl,1", 63 "pt" => "Português,pt,1", 64 "ro" => "RomânÄ,ro,1", 65 "ru" => "Ð ÑÑÑкОй,ru,1", 66 "sr" => "ÑÑпÑкО ÑезОк,rs,1", 67 "sk" => "slovenÄina,sk,1", 68 "sl" => "slovenÅ¡Äina,sl,1", 69 "es" => "Español,es,1", 70 "sv" => "svenska,se,1", 71 "tl" => "Tagalog,ph,1", 72 "th" => "àž àž²àž©àž²à¹àžàž¢,th,1", 73 "tr" => "TÃŒrkçe,tr,1", 74 "uk" => "УкÑаÑМÑÑка,ua,1", 75 "vi" => "Tiếng Viá»t,vn,1"); 75 76 76 77 //Language which are read from right to left (rtl) … … 103 104 //Define segment id prefix, will be included in span tag. also used as class identifier 104 105 define("SPAN_PREFIX", "tr_"); 105 106 //Define segment id prefix, will be included in img tag.107 define("IMG_PREFIX", "tr_img_");108 109 106 ?> -
trunk/WordPress/plugin/transposh/core/globals.php
r126 r167 31 31 $home_url_quoted; 32 32 33 //The url pointing to the base of the plugin. Used for generatin turls to resources33 //The url pointing to the base of the plugin. Used for generating urls to resources 34 34 $plugin_url; 35 35 -
trunk/WordPress/plugin/transposh/core/parser.php
r165 r167 833 833 update_translated_page($start, $end, $span); 834 834 835 836 //Insert image to allow editing this segment (only in explicit edit)837 // TODO: check removal838 /*if($is_edit_mode) {839 $img = get_img_tag($original_text, $translated_text, $source, $segment_id, $is_translated);840 update_translated_page($end + 1, - 1, $img);841 }*/842 835 //Increment only after both text and image are generated so they 843 836 //will be the same for each translated segement … … 944 937 logger(__METHOD__ . " $home_url href: $href"); 945 938 } 946 /*947 * Return the img tag that will added to enable editing a translatable948 * item on the page.949 * param segement_id The id (number) identifying this segment. Needs to be950 * placed within the img tag for use on client side operation (jquery)951 */952 /*function get_img_tag($original, $translation, $source, $segment_id, $is_translated = FALSE)953 {954 global $plugin_url, $lang, $home_url;955 $url = $home_url . '/index.php';956 957 //For use in javascript, make the following changes:958 //1. Add slashes to escape the inner text959 //2. Convert the html special characters960 //The browser will take decode step 2 and pass it to the js engine which decode step 1 - a bit tricky961 $translation = htmlspecialchars(addslashes($translation));962 //TODO: Need to check this one delicate point963 // $original = htmlspecialchars(addslashes($original));964 965 if ($is_translated)966 {967 $add_img = "_fix";968 }969 970 if ($source == 1) {971 $add_img = "_auto";972 }973 974 $img = "<img src=\"$plugin_url/img/translate$add_img.png\" alt=\"translate\" class=\"".IMG_PREFIX."\" id=\"" . IMG_PREFIX . "$segment_id\" ".975 "onclick=\"translate_dialog('$segment_id'); return false;\" ".976 "title=\"$original\"".977 //"onmouseover=\"hint('$original'); return true;\" ".978 //"onmouseout=\"nd()\"979 "/>";980 981 return $img;982 }*/983 984 939 ?> -
trunk/WordPress/plugin/transposh/js/transposh.js
r165 r167 20 20 { 21 21 jQuery(":button:contains('Suggest - Google')").attr("disabled","disabled").addClass("ui-state-disabled"); 22 google.language.translate(jQuery("#"+transposh_params ['prefix']+"original").val(), "", transposh_params['lang'], function(result) {22 google.language.translate(jQuery("#"+transposh_params.prefix+"original").val(), "", transposh_params.lang, function(result) { 23 23 if (!result.error) { 24 jQuery("#"+transposh_params ['prefix']+"translation").val(jQuery("<div>"+result.translation+"</div>").text())24 jQuery("#"+transposh_params.prefix+"translation").val(jQuery("<div>"+result.translation+"</div>").text()) 25 25 .keyup(); 26 26 } … … 34 34 jQuery.ajax({ 35 35 type: "POST", 36 url: transposh_params ['post_url'],37 data: {token: jQuery("#"+transposh_params ['prefix']+ segment_id).attr('token'),36 url: transposh_params.post_url, 37 data: {token: jQuery("#"+transposh_params.prefix + segment_id).attr('token'), 38 38 translation: translation, 39 lang: transposh_params ['lang'],39 lang: transposh_params.lang, 40 40 source: source, 41 41 translation_posted: "1"}, 42 42 success: function(req) { 43 var pre_translated = jQuery("#"+transposh_params ['prefix']+ segment_id).html();43 var pre_translated = jQuery("#"+transposh_params.prefix + segment_id).html(); 44 44 var new_text = translation; 45 45 //reset to the original content - the unescaped version if translation is empty … … 48 48 } 49 49 // rewrite text for all matching items at once 50 jQuery("."+transposh_params ['prefix']+"t,."+transposh_params['prefix']+"u").filter(function() {return jQuery(this).html() == pre_translated;}).html(new_text)50 jQuery("."+transposh_params.prefix+"t,."+transposh_params.prefix+"u").filter(function() {return jQuery(this).html() == pre_translated;}).html(new_text) 51 51 .each(function (i) { // handle the image changes 52 52 var img_segment_id = jQuery(this).attr('id').substr(jQuery(this).attr('id').lastIndexOf('_')+1); 53 jQuery("#"+transposh_params ['prefix']+"img_" + img_segment_id).removeClass('tr-icon-yellow').removeClass('tr-icon-green');53 jQuery("#"+transposh_params.prefix+"img_" + img_segment_id).removeClass('tr-icon-yellow').removeClass('tr-icon-green'); 54 54 if(jQuery.trim(translation).length != 0) { 55 55 if (source == 1) { 56 56 //switch to the auto img 57 jQuery("#"+transposh_params ['prefix']+"img_" + img_segment_id).addClass('tr-icon-yellow');57 jQuery("#"+transposh_params.prefix+"img_" + img_segment_id).addClass('tr-icon-yellow'); 58 58 } else { 59 59 // switch to the fix img 60 jQuery("#"+transposh_params ['prefix']+"img_" + img_segment_id).addClass('tr-icon-green');60 jQuery("#"+transposh_params.prefix+"img_" + img_segment_id).addClass('tr-icon-green'); 61 61 } 62 62 } … … 64 64 65 65 // Progress bar of saving 66 if (transposh_params ['progress']) {66 if (transposh_params.progress) { 67 67 done_p++; 68 68 if (togo > 4) { … … 71 71 } 72 72 73 //TODO: fix close dialog74 /*if (typeof cClick == 'function' && source == 0) {75 cClick();76 }*/77 73 }, 78 74 … … 87 83 //function for auto translation 88 84 function do_auto_translate() { 89 if (transposh_params ['progress']) {90 togo = jQuery("."+transposh_params ['prefix']+"u").size();85 if (transposh_params.progress) { 86 togo = jQuery("."+transposh_params.prefix+"u").size(); 91 87 // progress bar is for alteast 5 items 92 88 if (togo > 4) { 93 jQuery("#"+transposh_params ['prefix']+"credit").after('<div style="float: left;width: 90%;height: 10px" id="progress_bar"/><div style="float:left;width: 90%;height: 10px" id="progress_bar2"/>')89 jQuery("#"+transposh_params.prefix+"credit").after('<div style="float: left;width: 90%;height: 10px" id="progress_bar"/><div style="float:left;width: 90%;height: 10px" id="progress_bar2"/>') 94 90 jQuery("#progress_bar").progressbar({ 95 91 value: 0 … … 103 99 var done = 0; 104 100 } 105 jQuery("."+transposh_params ['prefix']+"u").each(function (i) {101 jQuery("."+transposh_params.prefix+"u").each(function (i) { 106 102 var translated_id = jQuery(this).attr('id'); 107 google.language.translate(jQuery(this).text(), "", transposh_params ['lang'], function(result) {103 google.language.translate(jQuery(this).text(), "", transposh_params.lang, function(result) { 108 104 if (!result.error) { 109 105 var segment_id = translated_id.substr(translated_id.lastIndexOf('_')+1); 110 106 ajax_translate(jQuery("#"+translated_id).text(),jQuery("<div>"+result.translation+"</div>").text(),1,segment_id); 111 jQuery("#"+translated_id).addClass(transposh_params ['prefix']+"t").removeClass(transposh_params['prefix']+"u");112 if (transposh_params ['progress']) {113 done = togo - jQuery("."+transposh_params ['prefix']+"u").size();107 jQuery("#"+translated_id).addClass(transposh_params.prefix+"t").removeClass(transposh_params.prefix+"u"); 108 if (transposh_params.progress) { 109 done = togo - jQuery("."+transposh_params.prefix+"u").size(); 114 110 if (togo > 4) { 115 111 jQuery("#progress_bar").progressbar('value' , done/togo*100); … … 133 129 buttons: { 134 130 'Discard': function() { 135 jQuery("#"+transposh_params ['prefix']+"translation").data("edit", { changed: false});131 jQuery("#"+transposh_params.prefix+"translation").data("edit", { changed: false}); 136 132 jQuery(this).dialog('close'); 137 jQuery("#"+transposh_params ['prefix']+"d-tabs").dialog('close');133 jQuery("#"+transposh_params.prefix+"d-tabs").dialog('close'); 138 134 }, 139 135 Cancel: function() { … … 146 142 //Open translation dialog 147 143 function translate_dialog(segment_id) { 148 jQuery("#"+transposh_params ['prefix']+"d-tabs").remove();149 jQuery('<div id="'+transposh_params ['prefix']+'d-tabs" title="Edit Translation"/>').appendTo("body");150 jQuery("#"+transposh_params ['prefix']+"d-tabs").append('<ul/>').tabs({ cache: true })151 .tabs('add',"#"+transposh_params ['prefix']+"d-tabs-1",'Translate')152 .tabs('add',transposh_params ['post_url']+'?tr_token_hist='+jQuery("#"+transposh_params['prefix'] + segment_id).attr('token')+'&lang='+transposh_params['lang'],'History')144 jQuery("#"+transposh_params.prefix+"d-tabs").remove(); 145 jQuery('<div id="'+transposh_params.prefix+'d-tabs" title="Edit Translation"/>').appendTo("body"); 146 jQuery("#"+transposh_params.prefix+"d-tabs").append('<ul/>').tabs({ cache: true }) 147 .tabs('add',"#"+transposh_params.prefix+"d-tabs-1",'Translate') 148 .tabs('add',transposh_params.post_url+'?tr_token_hist='+jQuery("#"+transposh_params.prefix + segment_id).attr('token')+'&lang='+transposh_params.lang,'History') 153 149 .css("text-align","left") 154 150 .css("padding",0) … … 156 152 //TODO, formatting here, not server side 157 153 jQuery("table",ui.panel).addClass("ui-widget ui-widget-content").css({'width' : '95%', 'padding' : '0'}); 158 jQuery("table thead th:last",ui.panel).after("<th/>");154 //jQuery("table thead th:last",ui.panel).after("<th/>"); 159 155 jQuery("table thead tr",ui.panel).addClass("ui-widget-header"); 160 jQuery("table tbody tr",ui.panel).append('<td/>');161 jQuery("table tbody td[source='1']",ui.panel).append('<img size="16x16" src="'+transposh_params ['post_url']+'?tp_gif=y" title="computer" style="display: inline; margin-right: 0.3em;" class="ui-icon ui-icon-gear"/>');162 jQuery("table tbody td[source='0']",ui.panel).append('<img size="16x16" src="'+transposh_params ['post_url']+'?tp_gif=y" title="human" style="display: inline; margin-right: 0.3em;" class="ui-icon ui-icon-person"/>');163 //jQuery("table tbody tr:first td:last",ui.panel).append('<span title="remove this translation" id="'+transposh_params ['prefix']+'revert" style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-scissors"/>');164 jQuery("#"+transposh_params['prefix']+"revert").click(function () {165 alert ('hi');166 });156 //jQuery("table tbody tr",ui.panel).append('<td/>'); 157 jQuery("table tbody td[source='1']",ui.panel).append('<img size="16x16" src="'+transposh_params.post_url+'?tp_gif=y" title="computer" style="display: inline; margin-right: 0.3em;" class="ui-icon ui-icon-gear"/>'); 158 jQuery("table tbody td[source='0']",ui.panel).append('<img size="16x16" src="'+transposh_params.post_url+'?tp_gif=y" title="human" style="display: inline; margin-right: 0.3em;" class="ui-icon ui-icon-person"/>'); 159 //jQuery("table tbody tr:first td:last",ui.panel).append('<span title="remove this translation" id="'+transposh_params.prefix+'revert" style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-scissors"/>'); 160 //jQuery("#"+transposh_params.prefix+"revert").click(function () { 161 //alert ('hi'); 162 //}); 167 163 }) 168 164 .bind('tabsselect', function(event, ui) { 169 165 // Change buttons 170 166 if (jQuery(ui.tab).text() == 'Translate') { 171 jQuery("#"+transposh_params ['prefix']+"d-tabs").dialog('option', 'buttons', tButtons);167 jQuery("#"+transposh_params.prefix+"d-tabs").dialog('option', 'buttons', tButtons); 172 168 } else { 173 jQuery("#"+transposh_params ['prefix']+"d-tabs").dialog('option', 'buttons', hButtons);169 jQuery("#"+transposh_params.prefix+"d-tabs").dialog('option', 'buttons', hButtons); 174 170 } 175 171 }) 176 172 .bind('dialogbeforeclose', function(event, ui) { 177 if(jQuery("#"+transposh_params ['prefix']+"translation").data("edit").changed) {173 if(jQuery("#"+transposh_params.prefix+"translation").data("edit").changed) { 178 174 confirm_close(); 179 175 return false; … … 182 178 }); 183 179 // fix for templates messing with li 184 jQuery("#"+transposh_params ['prefix']+"d-tabs li").css("list-style-type","none").css("list-style-position","outside");185 jQuery("#"+transposh_params ['prefix']+"d-tabs-1").append(186 '<form id="'+transposh_params ['prefix']+'form">' +180 jQuery("#"+transposh_params.prefix+"d-tabs li").css("list-style-type","none").css("list-style-position","outside"); 181 jQuery("#"+transposh_params.prefix+"d-tabs-1").append( 182 '<form id="'+transposh_params.prefix+'form">' + 187 183 '<fieldset>' + 188 184 '<label for="original">Original Text</label>' + 189 '<textarea cols="80" row="3" name="original" id="'+transposh_params ['prefix']+'original" class="text ui-widget-content ui-corner-all" readonly="y"/>' +185 '<textarea cols="80" row="3" name="original" id="'+transposh_params.prefix+'original" class="text ui-widget-content ui-corner-all" readonly="y"/>' + 190 186 '<label for="translation">Translate To</label>' + 191 '<textarea cols="80" row="3" name="translation" id="'+transposh_params ['prefix']+'translation" value="" class="text ui-widget-content ui-corner-all"/>' +187 '<textarea cols="80" row="3" name="translation" id="'+transposh_params.prefix+'translation" value="" class="text ui-widget-content ui-corner-all"/>' + 192 188 '</fieldset>' + 193 189 '</form>'); 194 jQuery("#"+transposh_params ['prefix']+"d-tabs-1 label").css("display","block");195 jQuery("#"+transposh_params ['prefix']+"d-tabs-1 textarea.text").css({'margin-bottom':'12px', 'width' : '95%', 'padding' : '.4em'});196 jQuery("#"+transposh_params ['prefix']+"original").val(jQuery("#"+transposh_params['prefix']+ segment_id).attr('orig'));197 jQuery("#"+transposh_params ['prefix']+"translation").val(jQuery("#"+transposh_params['prefix']+ segment_id).html());198 jQuery("#"+transposh_params ['prefix']+"translation").data("edit", { changed: false});199 jQuery("#"+transposh_params ['prefix']+"translation").keyup(function(e){200 if (jQuery("#"+transposh_params ['prefix']+ segment_id).text() != jQuery(this).val()) {190 jQuery("#"+transposh_params.prefix+"d-tabs-1 label").css("display","block"); 191 jQuery("#"+transposh_params.prefix+"d-tabs-1 textarea.text").css({'margin-bottom':'12px', 'width' : '95%', 'padding' : '.4em'}); 192 jQuery("#"+transposh_params.prefix+"original").val(jQuery("#"+transposh_params.prefix + segment_id).attr('orig')); 193 jQuery("#"+transposh_params.prefix+"translation").val(jQuery("#"+transposh_params.prefix + segment_id).html()); 194 jQuery("#"+transposh_params.prefix+"translation").data("edit", { changed: false}); 195 jQuery("#"+transposh_params.prefix+"translation").keyup(function(e){ 196 if (jQuery("#"+transposh_params.prefix + segment_id).text() != jQuery(this).val()) { 201 197 jQuery(this).css("background","yellow"); 202 198 jQuery(this).data("edit", { changed: true}); … … 206 202 } 207 203 }); 208 var tButtons = { 204 var tButtons; 205 if (google.language.isTranslatable(transposh_params.lang) || transposh_params.lang == 'he') { 206 tButtons = { 209 207 'Suggest - Google': function() { 210 208 getgt(); 211 209 }, 212 210 Ok: function() { 213 var translation = jQuery('#'+transposh_params ['prefix']+'translation').val();214 if(jQuery('#'+transposh_params ['prefix']+'translation').data("edit").changed) {215 ajax_translate(jQuery("#"+transposh_params ['prefix']+ segment_id).attr('orig'),translation,0,segment_id);216 jQuery("#"+transposh_params ['prefix']+"translation").data("edit", { changed: false});211 var translation = jQuery('#'+transposh_params.prefix+'translation').val(); 212 if(jQuery('#'+transposh_params.prefix+'translation').data("edit").changed) { 213 ajax_translate(jQuery("#"+transposh_params.prefix + segment_id).attr('orig'),translation,0,segment_id); 214 jQuery("#"+transposh_params.prefix+"translation").data("edit", { changed: false}); 217 215 } 218 216 jQuery(this).dialog('close'); 219 217 } 220 218 }; 219 } else { 220 tButtons = { 221 Ok: function() { 222 var translation = jQuery('#'+transposh_params.prefix+'translation').val(); 223 if(jQuery('#'+transposh_params.prefix+'translation').data("edit").changed) { 224 ajax_translate(jQuery("#"+transposh_params.prefix + segment_id).attr('orig'),translation,0,segment_id); 225 jQuery("#"+transposh_params.prefix+"translation").data("edit", { changed: false}); 226 } 227 jQuery(this).dialog('close'); 228 } 229 }; 230 } 221 231 var hButtons = { 222 232 Close: function() { … … 224 234 } 225 235 }; 226 jQuery("#"+transposh_params ['prefix']+"d-tabs").dialog({236 jQuery("#"+transposh_params.prefix+"d-tabs").dialog({ 227 237 bgiframe: true, 228 238 modal: true, … … 254 264 function() { 255 265 // an implicit param 256 if (typeof(jQuery().progressbar) != 'undefined') 257 transposh_params['progress'] = true; 258 259 do_auto_translate(); 260 if (transposh_params['edit']) { 266 if (typeof(jQuery().progressbar) != 'undefined') { 267 transposh_params.progress = true; 268 } 269 // TODO: he, iw? :) 270 if (google.language.isTranslatable(transposh_params.lang) || transposh_params.lang == 'he') { 271 do_auto_translate(); 272 } 273 if (transposh_params.edit) { 261 274 // lets add the images 262 jQuery("."+transposh_params ['prefix']+"t,."+transposh_params['prefix']+"u").each(function (i) {275 jQuery("."+transposh_params.prefix+"t,."+transposh_params.prefix+"u").each(function (i) { 263 276 var translated_id = jQuery(this).attr('id').substr(jQuery(this).attr('id').lastIndexOf('_')+1); 264 jQuery(this).after('<img id="'+transposh_params ['prefix']+'img_'+translated_id+'" class="tr-icon" size="12x12" title="'+jQuery(this).attr('orig')+'" src="'+transposh_params['post_url']+'?tp_gif=y"/>');265 jQuery('#'+transposh_params ['prefix']+'img_'+translated_id).click(function () {277 jQuery(this).after('<img id="'+transposh_params.prefix+'img_'+translated_id+'" class="tr-icon" size="12x12" title="'+jQuery(this).attr('orig')+'" src="'+transposh_params.post_url+'?tp_gif=y"/>'); 278 jQuery('#'+transposh_params.prefix+'img_'+translated_id).click(function () { 266 279 translate_dialog(translated_id); 267 280 return false; 268 }) ;269 if (jQuery(this).hasClass(transposh_params ['prefix']+'t')) {281 }).css({'border':'0px','margin':'1px','padding':'0px'}); 282 if (jQuery(this).hasClass(transposh_params.prefix+'t')) { 270 283 if (jQuery(this).attr('source') == '1') 271 jQuery('#'+transposh_params ['prefix']+'img_'+translated_id).addClass('tr-icon-yellow');284 jQuery('#'+transposh_params.prefix+'img_'+translated_id).addClass('tr-icon-yellow'); 272 285 else 273 jQuery('#'+transposh_params ['prefix']+'img_'+translated_id).addClass('tr-icon-green');286 jQuery('#'+transposh_params.prefix+'img_'+translated_id).addClass('tr-icon-green'); 274 287 } 275 288 }); -
trunk/WordPress/plugin/transposh/readme.txt
r149 r167 81 81 1. Enabling automatic translation will automatically translate a page (without requiring entering edit mode) for EVERYONE viewing the page regardless of the their role. However it will only take place for languages marked as editable. 82 82 83 If everything is setup correctly and still nothing happens, please contact us.83 Also - please take extra care to validate your html, adding extra tags that are unclosed in the template may lead to our parser breaking. Use the w3c validator service for more details. If everything is setup correctly and still nothing happens, please contact us. 84 84 85 85 == Screenshots == … … 93 93 == Release notes == 94 94 95 * 2009/04/30 - 0.1.4 96 * Moved to jQuery UI instead of overlibmws 97 * Reduced code generated for faster page loading 98 * History is now visible for translated phrases 99 * An optional progress bar shows advancing auto-translation 100 * Script is now minified by default 101 * Better support for not-auto-translatable languages, added islandic 95 102 * 2009/04/02 - 0.1.3 96 103 * Fix for mysql 4.1 (thanks [Amit](http://landscaping-blog.com/)) -
trunk/WordPress/plugin/transposh/transposh.php
r165 r167 2 2 /* 3 3 Plugin Name: Transposh Translation Filter 4 Plugin URI: http://transposh.org/ #4 Plugin URI: http://transposh.org/ 5 5 Description: Translation filter for WordPress, After enabling please set languages at the <a href="options-general.php?page=Transposh">the options page</a> Want to help? visit our development site at <a href="http://trac.transposh.org/">trac.transposh.org</a>. 6 6 Author: Team Transposh -
trunk/WordPress/plugin/transposh/transposh_admin.php
r140 r167 91 91 { 92 92 echo '<th>Language</th><th>Viewable</th><th>Translatable</th>'. 93 '<th>Default</th><th style="padding-right: 80px"></th>';93 '<th>Default</th><th>Auto?</th><th style="padding-right: 80px"></th>'; 94 94 } 95 95 … … 98 98 foreach($languages as $code => $lang) 99 99 { 100 list ($language,$flag ) = explode (",",$lang);100 list ($language,$flag,$autot) = explode (",",$lang); 101 101 if($i % $columns == 0) 102 102 { … … 116 116 echo "<td align=\"center\"><input type=\"radio\" name=\"default_lang\" value=\"$code\" " . 117 117 is_default_lang($code). "/></td>"; 118 // TODO: Add icons? 119 if ($autot) { 120 echo "<td>Y</td>"; 121 } else { 122 echo "<td>N</td>"; 123 } 118 124 119 125 if($i % $columns == 0) -
trunk/WordPress/plugin/transposh/transposh_widget.php
r165 r167 113 113 114 114 $is_showing_languages = FALSE; 115 //TODO: improve this shortening 116 $plugpath = parse_url($plugin_url, PHP_URL_PATH); 115 117 116 118 echo $before_widget . $before_title . __("Translation") . $after_title; … … 137 139 $page_url2 = $page_url; 138 140 } 139 140 echo "<a href=\"" . $page_url2 . "\">". 141 "<img src=\"$plugin_url/img/flags/$flag.png\" title=\"$language\" alt=\"$language\"". 142 " style=\"padding: 1px 3px\"/></a>"; 141 //TODO: improve this hacky! shortening 142 $urlpath = parse_url($page_url2, PHP_URL_PATH); 143 if (trim(parse_url($page_url2, PHP_URL_QUERY)) != '') 144 $urlpath .= '?'.parse_url($page_url2, PHP_URL_QUERY); 145 if (trim(parse_url($page_url2, PHP_URL_FRAGMENT)) != '') 146 $urlpath .= '#'.parse_url($page_url2, PHP_URL_FRAGMENT); 147 148 echo "<a href=\"" . $urlpath . "\">". 149 "<img src=\"$plugpath/img/flags/$flag.png\" title=\"$language\" alt=\"$language\"". 150 " style=\"padding: 1px 3px;border: 0px\"/></a>"; 143 151 $is_showing_languages = TRUE; 144 152 } … … 148 156 // this is the form for the edit... 149 157 echo "<form action=\"$page_url\" method=\"post\">"; 150 echo "<input type=\"hidden\" name=\"lang\" id=\"lang\" value=\"$lang\"/>";158 echo "<input type=\"hidden\" name=\"lang\" id=\"lang\" value=\"$lang\"/>"; 151 159 break; 152 160 default: // language list … … 197 205 echo "</form>"; 198 206 //echo "<button onClick=\"do_auto_translate();\">translate all</button>"; 199 echo "<div id=\"".SPAN_PREFIX."credit\">by <a href=\"http://transposh.org\"><img src=\"$plug in_url/img/tplogo.png\" title=\"Transposh\" alt=\"Transposh\"/></a></div>";207 echo "<div id=\"".SPAN_PREFIX."credit\">by <a href=\"http://transposh.org\"><img src=\"$plugpath/img/tplogo.png\" title=\"Transposh\" alt=\"Transposh\"/></a></div>"; 200 208 echo $after_widget; 201 209 }
Note: See TracChangeset
for help on using the changeset viewer.
