|
-
Jun 3rd, 2004, 08:45 PM
#1
Thread Starter
Frenzied Member
Language Translation.
I know the hard way to do this. I.E. storing strings for each avaliable launguage in the database or in the dll.
What I am wondering is if anyone knows of any Web Services or anything that preform this operation. Hopefully for free, but if not let me know anyway. Please.
I know about Babble Fish, and a few other option for help on doing it the hard way. What I am really hoping to hear about is a web service that will translate anything I pass it on the fly and pass back unicode or whatever. I don't care if I have to make them download the huge font sets from Microsoft.
Thanks for any help.
Magiaus
If I helped give me some points.
-
Apr 19th, 2005, 01:05 PM
#2
Re: Language Translation.
I'd really like to do this also. I've just told someone i'll look into the possibilty of translating their site on the fly into a number of languages but haven't come up with anything yet. I'll let you know if i do.
-
Apr 19th, 2005, 03:33 PM
#3
Re: Language Translation.
ok not sure how google would feel about this but...
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strUrl As String = "http://translate.google.com/translate_t"
Dim strForm As String = ""
Dim strTemp As String = ""
Dim SourceLanguage, TargetLanguage As String
Dim strValue As String
Dim StartText As String = "<textarea name=q rows=5 cols=45 wrap=PHYSICAL>"
Dim StartText2 As String = "<textarea name=q rows=5 cols=45 wrap=PHYSICAL readonly>"
Dim EndText As String = "</textarea>"
Dim translated As String = ""
SourceLanguage = "en"
TargetLanguage = "es"
strValue = txtEng.Text.Trim
strForm = "langpair=" + SourceLanguage + "|" + TargetLanguage
strForm += "&text=" + strValue.Replace(" ", "+")
Dim oRequest As WebRequest = WebRequest.Create(strUrl)
oRequest.ContentType = "application/x-www-form-urlencoded"
oRequest.Method = "POST"
Dim oWriter As StreamWriter = New StreamWriter(oRequest.GetRequestStream())
oWriter.Write(strForm)
oWriter.Close()
Dim oResponse As WebResponse = oRequest.GetResponse()
strTemp = New StreamReader(oResponse.GetResponseStream(), Encoding.ASCII).ReadToEnd()
oResponse.Close()
Dim intStart As Integer = strTemp.IndexOf(StartText)
If intStart < 1 Then
intStart = strTemp.IndexOf(StartText2)
End If
Dim intEnd As Integer = strTemp.IndexOf(EndText)
If intStart > 0 And intEnd > 0 Then
strTemp = strTemp.Substring(intStart, intEnd - intStart)
strTemp = strTemp.Replace(StartText, "")
translated = strTemp.Replace(StartText2, "")
End If
lblTrans.Text = translated
End Sub
Too see an example click here at the mo thats translating from English (en) to Spanish (es).
As this method won't be the fastest and the application i was asked about was a message board, i wondered about translating into various languages as a post was made and storing them all in a database and then retrieving which ever language a user required.
-
Apr 19th, 2005, 03:58 PM
#4
Thread Starter
Frenzied Member
Re: Language Translation.
pretty cool ~ bastante fresco
Maldiga esta base de datos de mierda
Magiaus
If I helped give me some points.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|