Index: openacs-4/packages/xowiki/tcl/xowiki-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-procs.tcl,v diff -u -r1.300 -r1.301 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 10 Oct 2008 16:05:28 -0000 1.300 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 10 Oct 2008 23:49:42 -0000 1.301 @@ -1070,8 +1070,6 @@ # (typed) file links set lang "" set name file:$stripped_name - } elseif {[regexp {^:(..):(.*)$} $link _ lang stripped_name]} { - set link_type language } else { # do we have a typed link? more than two chars... if {[regexp {^([^:][^:][^:]+):((..):)?(.+)$} $link _ \ @@ -1418,6 +1416,30 @@ } + + Page instproc translate {-from -to text} { + set langpair $from|$to + set ie UTF8 + #set url [export_vars -base http://translate.google.com/translate_t {langpair text}] + #set r [xo::HttpRequest new -url $url] + set r [xo::HttpRequest new -url http://translate.google.com/translate_t \ + -post_data [export_vars {langpair text ie}] \ + -content_type application/x-www-form-urlencoded] + #my msg status=[$r set status] + if {[$r set status] eq "finished"} { + set data [$r set data] + dom parse -simple -html $data doc + $doc documentElement root + set n [$root selectNodes {//div[@id="result_box"]}] + #my msg "$text $from=>$to [$n asText]" + return [$n asText] + } else { + util_user_message -message "Could not translate text, \ + status=[$r set status] reason=[$r set cancel_message]" + } + } + + # # Methods of ::xowiki::PlainPage #