Results 1 to 4 of 4

Thread: Language Translation.

  1. #1

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    Exclamation 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.

  2. #2
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    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.

  3. #3
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    Re: Language Translation.

    ok not sure how google would feel about this but...
    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         Dim strUrl As String = "http://translate.google.com/translate_t"
    3.         Dim strForm As String = ""
    4.         Dim strTemp As String = ""
    5.         Dim SourceLanguage, TargetLanguage As String
    6.         Dim strValue As String
    7.         Dim StartText As String = "<textarea name=q rows=5 cols=45 wrap=PHYSICAL>"
    8.         Dim StartText2 As String = "<textarea name=q rows=5 cols=45 wrap=PHYSICAL readonly>"
    9.         Dim EndText As String = "</textarea>"
    10.         Dim translated As String = ""
    11.  
    12.         SourceLanguage = "en"
    13.         TargetLanguage = "es"
    14.         strValue = txtEng.Text.Trim
    15.         strForm = "langpair=" + SourceLanguage + "|" + TargetLanguage
    16.         strForm += "&text=" + strValue.Replace(" ", "+")
    17.  
    18.         Dim oRequest As WebRequest = WebRequest.Create(strUrl)
    19.         oRequest.ContentType = "application/x-www-form-urlencoded"
    20.         oRequest.Method = "POST"
    21.  
    22.         Dim oWriter As StreamWriter = New StreamWriter(oRequest.GetRequestStream())
    23.         oWriter.Write(strForm)
    24.         oWriter.Close()
    25.  
    26.         Dim oResponse As WebResponse = oRequest.GetResponse()
    27.         strTemp = New StreamReader(oResponse.GetResponseStream(), Encoding.ASCII).ReadToEnd()
    28.         oResponse.Close()
    29.  
    30.         Dim intStart As Integer = strTemp.IndexOf(StartText)
    31.         If intStart < 1 Then
    32.             intStart = strTemp.IndexOf(StartText2)
    33.         End If
    34.         Dim intEnd As Integer = strTemp.IndexOf(EndText)
    35.  
    36.         If intStart > 0 And intEnd > 0 Then
    37.             strTemp = strTemp.Substring(intStart, intEnd - intStart)
    38.             strTemp = strTemp.Replace(StartText, "")
    39.             translated = strTemp.Replace(StartText2, "")
    40.         End If
    41.         lblTrans.Text = translated
    42.  
    43.     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.

  4. #4

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    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
  •  



Click Here to Expand Forum to Full Width