|
hatespyware Apprentice
Joined: 16 Dec 2002 Posts: 103
|
Posted: Wed Oct 29, 2003 8:44 pm
convert between various foreign languages |
Here are a few cute 1-liners that can convert text between a few different languages using babelfish/borlandbabl via SOAP through COM (ala .NET). You will need to have the MS SOAP Kit installed (you probably already do) in order to use these. FYI, using SOAP is almost always this easy. Check xmethods for a whole bunch of other SOAP services that you might like to use.
Code: |
#CLASS {translate}
#ALIAS chefish {#var SOAPClient %comcreate( "MSSOAP.SOAPClient");#com @SOAPClient.mssoapinit(http://ww6.borland.com/webservices/BorlandBabel/BorlandBabel.exe/wsdl/IBorlandBabel);#say @SOAPClient.BabelFish("Chef", %-1)}
#ALIAS drawl {#var SOAPClient %comcreate( "MSSOAP.SOAPClient");#com @SOAPClient.mssoapinit(http://ww6.borland.com/webservices/BorlandBabel/BorlandBabel.exe/wsdl/IBorlandBabel);#say @SOAPClient.BabelFish("Drawl", %-1)}
#ALIAS jive {#var SOAPClient %comcreate( "MSSOAP.SOAPClient");#com @SOAPClient.mssoapinit(http://ww6.borland.com/webservices/BorlandBabel/BorlandBabel.exe/wsdl/IBorlandBabel);#say @SOAPClient.BabelFish("Jive", %-1)}
#ALIAS french {#var SOAPClient %comcreate( "MSSOAP.SOAPClient");#com @SOAPClient.mssoapinit(http://www.xmethods.net/sd/2001/BabelFishService.wsdl);#say @SOAPClient.BabelFish("en_fr", %-1)}
#ALIAS german {#var SOAPClient %comcreate( "MSSOAP.SOAPClient");#com @SOAPClient.mssoapinit(http://www.xmethods.net/sd/2001/BabelFishService.wsdl);#say @SOAPClient.BabelFish("en_de", %-1)}
#ALIAS italian {#var SOAPClient %comcreate( "MSSOAP.SOAPClient");#com @SOAPClient.mssoapinit(http://www.xmethods.net/sd/2001/BabelFishService.wsdl);#say @SOAPClient.BabelFish("en_it", %-1)}
#ALIAS spanish {#var SOAPClient %comcreate( "MSSOAP.SOAPClient");#com @SOAPClient.mssoapinit(http://www.xmethods.net/sd/2001/BabelFishService.wsdl);#say @SOAPClient.BabelFish("en_es", %-1)}
#ALIAS es_en {#var SOAPClient %comcreate( "MSSOAP.SOAPClient");#com @SOAPClient.mssoapinit(http://www.xmethods.net/sd/2001/BabelFishService.wsdl);#say @SOAPClient.BabelFish("fr_en", %-1)}
#ALIAS de_en {#var SOAPClient %comcreate( "MSSOAP.SOAPClient");#com @SOAPClient.mssoapinit(http://www.xmethods.net/sd/2001/BabelFishService.wsdl);#say @SOAPClient.BabelFish("de_en", %-1)}
#ALIAS fr_en {#var SOAPClient %comcreate( "MSSOAP.SOAPClient");#com @SOAPClient.mssoapinit(http://www.xmethods.net/sd/2001/BabelFishService.wsdl);#say @SOAPClient.BabelFish("it_en", %-1)}
#ALIAS it_en {#var SOAPClient %comcreate( "MSSOAP.SOAPClient");#com @SOAPClient.mssoapinit(http://www.xmethods.net/sd/2001/BabelFishService.wsdl);#say @SOAPClient.BabelFish("es_en", %-1)}
#CLASS 0
|
|
|
|
|
hatespyware Apprentice
Joined: 16 Dec 2002 Posts: 103
|
Posted: Sun Nov 02, 2003 6:46 pm |
It seems that xMethod's Babelfish SOAP service has been discontinued. I've altered my scripts to try to snag the translations directly via the webpage. This method is nowhere near as elegant as the SOAP stuff, so your mileage may vary.
Paste the following into a file named babelcom.WSC in a safe place (i.e. zMud directory).
Code: |
<?xml version="1.0"?>
<component>
<registration
description="babelcom"
progid="babelcom.WSC"
version="1.00"
classid="{27681364-7a29-41ee-8205-33d12bce013e}"
>
</registration>
<public>
<method name="translate">
<PARAMETER name="langpair"/>
<PARAMETER name="text"/>
</method>
</public>
<script language="VBScript">
<![CDATA[
function translate(langpair, text)
set xml = CreateObject("MSXML2.XMLHTTP")
xml.Open "POST", "http://babelfish.altavista.com/babelfish/tr?il=en", FALSE
xml.setrequestheader "Content-Type", "application/x-www-form-urlencoded"
xml.Send "doit=done&urltext=" & escape(text) & "&lp=" & escape(langpair) & "&Submit=Translate&enc=utf8"
l = InStr(xml.responseText, "padding:10px; lang=") + 22
r = InStr(l, xml.responseText, vblf) - 16
translate = Mid(xml.responseText, l, r-l)
end function
]]>
</script>
</component>
|
Then, right-click that file and choose "register." Now, use these zMud aliases:
Code: |
#CLASS {translate}
#ALIAS chefish {#var SOAPClient %comcreate( "MSSOAP.SOAPClient");#com @SOAPClient.mssoapinit(http://ww6.borland.com/webservices/BorlandBabel/BorlandBabel.exe/wsdl/IBorlandBabel);#say @SOAPClient.BabelFish("Chef", %-1)}
#ALIAS drawl {#var SOAPClient %comcreate( "MSSOAP.SOAPClient");#com @SOAPClient.mssoapinit(http://ww6.borland.com/webservices/BorlandBabel/BorlandBabel.exe/wsdl/IBorlandBabel);#say @SOAPClient.BabelFish("Drawl", %-1)}
#ALIAS jive {#var SOAPClient %comcreate( "MSSOAP.SOAPClient");#com @SOAPClient.mssoapinit(http://ww6.borland.com/webservices/BorlandBabel/BorlandBabel.exe/wsdl/IBorlandBabel);#say @SOAPClient.BabelFish("Jive", %-1)}
#ALIAS french {#var plug %comcreate("babelcom.WSC");#say @plug.translate("en_fr", %-1)}
#ALIAS german {#var plug %comcreate("babelcom.WSC");#say @plug.translate("en_de", %-1)}
#ALIAS italian {#var plug %comcreate("babelcom.WSC");#say @plug.translate("en_it", %-1)}
#ALIAS spanish {#var plug %comcreate("babelcom.WSC");#say @plug.translate("en_es", %-1)}
#ALIAS portu {#var plug %comcreate("babelcom.WSC");#say @plug.translate("en_pt", %-1)}
#ALIAS es_en {#var plug %comcreate("babelcom.WSC");#say @plug.translate("es_en", %-1)}
#ALIAS de_en {#var plug %comcreate("babelcom.WSC");#say @plug.translate("de_en", %-1)}
#ALIAS fr_en {#var plug %comcreate("babelcom.WSC");#say @plug.translate("fr_en", %-1)}
#ALIAS it_en {#var plug %comcreate("babelcom.WSC");#say @plug.translate("it_en", %-1)}
#ALIAS pt_en {#var plug %comcreate("babelcom.WSC");#say @plug.translate("pt_en", %-1)}
#CLASS 0
|
One advantage of this method is that it allows you to translate a few extra languages - namely Chinese, Japanese, Korean, and Russian. Unfortunately, doing so is pretty pointless given zMud's current Unicode support. As it is, the other languages will usually work OK, since utf8 is so close to standard ASCII. |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Fri Feb 13, 2004 10:18 am |
Am I the only one to NOT get these three to work
#ALIAS drawl {.....
#ALIAS chefish {....
#ALIAS jive {......
I get a parse error on
#var SOAPClient %comcreate( "MSSOAP.SOAPClient") |
|
|
|
Arian Newbie
Joined: 14 Dec 2003 Posts: 5 Location: USA
|
Posted: Sun May 09, 2004 3:17 am |
Apparently, they changed something at Babelfish yet again and the second method is semi-broken. This was working for me, hadn't used it in a couple months and then needed to translate another player and got this (cut off exactly as shown).
>AltaVista - Babel Fish Translation - Transla
Got this for translating to another language:
>AltaVista - Babel Fish Translation - Transla
The only parts that still seem to work are Chefish, Drawl and Jive. Any ideas on how to fix this? Was a great function to have as a staff member. |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|