- Timestamp:
- 01/27/2010 10:09:19 AM (2 years ago)
- Location:
- trunk/WordPress/plugin/transposh
- Files:
-
- 3 edited
-
js/transposh.js (modified) (3 diffs)
-
js/transposhedit.js (modified) (3 diffs)
-
transposh.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WordPress/plugin/transposh/js/transposh.js
r367 r370 28 28 source = 1, 29 29 //Ajax translation 30 done_posted = 0, /*Timer for translation aggregation*/ timer, tokens = [], translations = [] ,30 done_posted = 0, /*Timer for translation aggregation*/ timer, tokens = [], translations = [] 31 31 // the languages supported externally 32 32 // extracted using function above + he|zh-tw|pt that we know 33 google_langs = 'af|sq|ar|be|bg|ca|zh|zh-CN|zh-TW|hr|cs|da|nl|en|et|tl|fi|fr|gl|de|el|iw|hi|hu|is|id|ga|it|ja|ko|lv|lt|mk|ms|mt|no|fa|pl|pt-PT|ro|ru|sr|sk|sl|es|sw|sv|tl|th|tr|uk|vi|cy|yi|he|zh-tw|pt',33 //google_langs = 'af|sq|ar|be|bg|ca|zh|zh-CN|zh-TW|hr|cs|da|nl|en|et|tl|fi|fr|gl|de|el|iw|hi|hu|is|id|ga|it|ja|ko|lv|lt|mk|ms|mt|no|fa|pl|pt-PT|ro|ru|sr|sk|sl|es|sw|sv|tl|th|tr|uk|vi|cy|yi|he|zh-tw|pt', 34 34 // got this using Microsoft.Translator.GetLanguages() with added zh and zh-tw for our needs 35 bing_langs = 'ar,bg,zh-chs,zh-cht,cs,da,nl,en,ht,fi,fr,de,el,he,it,ja,ko,pl,pt,ru,es,sv,th,zh,zh-tw';36 35 //bing_langs = 'ar,bg,zh-chs,zh-cht,cs,da,nl,en,ht,fi,fr,de,el,he,it,ja,ko,pl,pt,ru,es,sv,th,zh,zh-tw'; 36 ; 37 37 // This function fixes the page, it gets a token and translation and fixes this, 38 38 // since here we only get the automated source, we use this to reduce the code size … … 234 234 // 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... 235 235 if ((possibly_translateable > 5 || (now.getHours() === 4 && possibly_translateable > 0)) && 236 ( google_langs.indexOf(t_jp.lang) > -1 || bing_langs.indexOf(t_jp.lang) > -1)) {236 (t_jp.google || t_jp.msn)) { 237 237 // 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 238 238 langLoaded = function () { … … 259 259 // we now start the chain that leads to auto-translate (with or without progress) 260 260 //if supported in msn and msn is prefered or not supported in google than msn and we have the msn key 261 if (( (bing_langs.indexOf(t_jp.lang) > -1 && t_jp.preferred === 2) || (google_langs.indexOf(t_jp.lang) < 0)) && t_jp.msnkey !== '') {261 if ((t_jp.msn && t_jp.preferred === 2) || !t_jp.google) { 262 262 source = 2; 263 263 getMSN = function () { -
trunk/WordPress/plugin/transposh/js/transposhedit.js
r366 r370 19 19 // fetch translation from google translate... 20 20 (function () { // closure 21 var loadLang, langLoaded ,22 google_langs = 'af|sq|ar|be|bg|ca|zh|zh-CN|zh-TW|hr|cs|da|nl|en|et|tl|fi|fr|gl|de|el|iw|hi|hu|is|id|ga|it|ja|ko|lv|lt|mk|ms|mt|no|fa|pl|pt-PT|ro|ru|sr|sk|sl|es|sw|sv|tl|th|tr|uk|vi|cy|yi|he|zh-tw|pt',21 var loadLang, langLoaded; 22 //google_langs = 'af|sq|ar|be|bg|ca|zh|zh-CN|zh-TW|hr|cs|da|nl|en|et|tl|fi|fr|gl|de|el|iw|hi|hu|is|id|ga|it|ja|ko|lv|lt|mk|ms|mt|no|fa|pl|pt-PT|ro|ru|sr|sk|sl|es|sw|sv|tl|th|tr|uk|vi|cy|yi|he|zh-tw|pt', 23 23 // got this using Microsoft.Translator.GetLanguages() with added zh and zh-tw for our needs 24 bing_langs = 'ar,bg,zh-chs,zh-cht,cs,da,nl,en,ht,fi,fr,de,el,he,it,ja,ko,pl,pt,ru,es,sv,th,zh,zh-tw';24 //bing_langs = 'ar,bg,zh-chs,zh-cht,cs,da,nl,en,ht,fi,fr,de,el,he,it,ja,ko,pl,pt,ru,es,sv,th,zh,zh-tw'; 25 25 26 26 function fix_page_human(token, translation) { … … 175 175 var tButtons = {}, hButtons = {}; 176 176 //only add button is bing support is defined for the language (and we got some key) 177 if ( bing_langs.indexOf(t_jp.lang) > -1 && t_jp.msnkey !== '') {177 if (t_jp.msn) { 178 178 //ar,zh-chs,zh-cht,nl,en,fr,de,he,it,ja,ko,pl,pt,ru,es 179 179 tButtons['Suggest - Bing'] = function () { … … 183 183 184 184 // Only add button if google supports said language 185 if ( google_langs.indexOf(t_jp.lang) > -1) {185 if (t_jp.google) { 186 186 tButtons['Suggest - Google'] = function () { 187 187 getgt(); -
trunk/WordPress/plugin/transposh/transposh.php
r364 r370 507 507 //echo "t_jp.rtl=".(in_array ($this->target_language, $GLOBALS['rtl_languages'])? 'true' : 'false').";"; 508 508 echo "t_jp.lang='{$this->target_language}';"; 509 // those two options show if the script can support said engines 510 echo "t_jp.msn=".(in_array($this->target_language,$GLOBALS['bing_languages']) && $this->options->get_msn_key() ? 'true' : 'false').";"; 511 echo "t_jp.google=".(in_array($this->target_language,$GLOBALS['google_languages']) ? 'true' : 'false').";"; 509 512 echo "t_jp.prefix='".SPAN_PREFIX."';"; 510 513 echo "t_jp.msnkey='{$this->options->get_msn_key()}';";
Note: See TracChangeset
for help on using the changeset viewer.
