From: <vi...@us...> - 2009-11-28 14:56:30
|
Revision: 11813 http://amsn.svn.sourceforge.net/amsn/?rev=11813&view=rev Author: vivia Date: 2009-11-28 14:56:21 +0000 (Sat, 28 Nov 2009) Log Message: ----------- Fixed google translation, added language auto-detection, added Chinese support Modified Paths: -------------- trunk/amsn-extras/plugins/whatis/plugininfo.xml trunk/amsn-extras/plugins/whatis/whatis.tcl Modified: trunk/amsn-extras/plugins/whatis/plugininfo.xml =================================================================== --- trunk/amsn-extras/plugins/whatis/plugininfo.xml 2009-11-28 13:55:52 UTC (rev 11812) +++ trunk/amsn-extras/plugins/whatis/plugininfo.xml 2009-11-28 14:56:21 UTC (rev 11813) @@ -5,12 +5,12 @@ <description>Get information from text/word or translate it to an other language!</description> <description_fr>Obtenir des informations \xE0 partir d'un texte/mot ou traduisez le dans un autre langage!</description_fr> <amsn_version>0.94</amsn_version> - <plugin_version>1.6</plugin_version> + <plugin_version>1.7</plugin_version> <plugin_file>whatis.tcl</plugin_file> <plugin_namespace>whatis</plugin_namespace> <init_procedure>init</init_procedure> <deinit_procedure>deInit</deinit_procedure> - <cvs_version>20081004</cvs_version> + <cvs_version>20091128</cvs_version> <url> <plugininfo>http://www.amsn-project.net/autoupdater/plugins/whatis/plugininfo.xml</plugininfo> <main>http://www.amsn-project.net/autoupdater/plugins/whatis/whatis.tcl</main> Modified: trunk/amsn-extras/plugins/whatis/whatis.tcl =================================================================== --- trunk/amsn-extras/plugins/whatis/whatis.tcl 2009-11-28 13:55:52 UTC (rev 11812) +++ trunk/amsn-extras/plugins/whatis/whatis.tcl 2009-11-28 14:56:21 UTC (rev 11813) @@ -125,6 +125,7 @@ $copymenu.whatis add cascade -label "Translate" -menu $copymenu.whatis.translate menu $copymenu.whatis.translate -tearoff 0 -type normal + $copymenu.whatis.translate add command -label "Auto-detect to English" -command "whatis::translateText $w auto en" $copymenu.whatis.translate add command -label "English to Spanish" -command "whatis::translateText $w en es" $copymenu.whatis.translate add command -label "English to French" -command "whatis::translateText $w en fr" $copymenu.whatis.translate add command -label "English to German" -command "whatis::translateText $w en de" @@ -134,6 +135,7 @@ $copymenu.whatis.translate add command -label "English to Russian" -command "whatis::translateText $w en ru" $copymenu.whatis.translate add command -label "English to Greek" -command "whatis::translateText $w en el" $copymenu.whatis.translate add command -label "English to Japanese" -command "whatis::translateText $w en ja" + $copymenu.whatis.translate add command -label "English to Chinese (simpl)" -command "whatis::translateText $w en zh" $copymenu.whatis.translate add command -label "Dutch to English" -command "whatis::translateText $w nl en" $copymenu.whatis.translate add command -label "Spanish to English" -command "whatis::translateText $w es en" $copymenu.whatis.translate add command -label "German to English" -command "whatis::translateText $w de en" @@ -143,6 +145,7 @@ $copymenu.whatis.translate add command -label "Russian to English" -command "whatis::translateText $w ru en" $copymenu.whatis.translate add command -label "Greek to English" -command "whatis::translateText $w el en" $copymenu.whatis.translate add command -label "Japanese to English" -command "whatis::translateText $w ja en" + $copymenu.whatis.translate add command -label "Chinese (simpl) to English" -command "whatis::translateText $w zh en" $copymenu.whatis.translate add command -label "Other..." -command "whatis::manual_langpair $w" } @@ -215,12 +218,13 @@ "ru" { set langTitle "Russian" } "el" { set langTitle "Greek" } "ja" { set langTitle "Japanese" } + "zh" { set langTitle "Chinese (simpl)" } "en" { set langTitle "English" } default { set langTitle "selected language" } } # Strip HTML before translated text - set substring "<div id=result_box dir=\"" + set substring "<span id=result_box" set start [string first $substring $html] if { $start == -1 } { set translation "Problem parsing return text. Translation engine probably returned an error" @@ -228,6 +232,9 @@ set start [expr { $start + [string length $substring]} ] set direction [string range $html $start [expr { [string first "\"" $html $start] - 1}]] set start [string first ">" $html $start] + set substring "<span title=\"" + set start [expr { $start + [string length $substring]} ] + set start [string first ">" $html $start] set start [expr { $start + 1 }] # Stript HTML after translated text This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |