Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Visual Basic (https://www.askmehelpdesk.com/forumdisplay.php?f=469)
-   -   Translation (https://www.askmehelpdesk.com/showthread.php?t=208459)

  • Apr 22, 2008, 11:30 AM
    ratu
    Translation
    The ques is, I have to translate a sentence into french and german.
    the followings are been stored in a text file

    yes, oui, ja
    ism, est, ist
    .
    .
    .and the list goes on.

    I try to code this.

    Do Until File.Peek = -1

    Rec = File.ReadLine
    translate = Rec.Split(", ")

    If translate(0) = txtEnglish.Text Then
    lblFrench.Text = "French translation : " & translate(1)
    lblGerman.Text = "German translation : " & translate(2)
    End If

    Loop

    but I can only detect one word translation.
    If I keyed in Yes
    French Translation : oui
    German Translation : ja

    The ques want me to allow sentences to be translated. How can I improve my coding?
    Someone help me. :(
  • Apr 28, 2008, 12:24 PM
    melondotnet
    You will need to loop through individual words, which should be easy with the .spilt method.

    I am assuming something rather like this:

    Words = txtEnglish.Text.Split(" ")

    Now loop through each word, with your current loop inside.

    Do.. 'Word Loop

    Do... 'Translation Loop

    Loop

    Loop

  • All times are GMT -7. The time now is 09:51 PM.